Hi Royer, Alexis,
I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to accept the answer.
Ask: Passing data to function does not work using the provided command
Solution: I found the issue. The issue is that the function is case sensitive. Name variable should either be replaced with a minus "n" in the function like below, or pushed using uppercase "N" in the data json.
That's why if we follow the tutorial line by line, it won't works because in the function the "'N" is uppercase but in the json body it's lowercase "n".
$name = $Request.Query.Name
if (-not $name) {
$name = $Request.Body.name
}
If you have any further questions, please feel free to ask,thank you again for your time and patience in resolving this issue.
If you found this information helpful, please consider accepting the answer and selecting "Yes" for "Was this answer helpful?" This can benefit other community members as well.