Is it possible to use multiple Query Parameters with an API endpoint? Documentation/examples only ever show a single parameter and when I try using & in the Uri PSU returns an error saying ampersand is not allowed and is reserved for future use. This seems like basic functionality so I’m hoping that PSU just uses another character instead of the industry-standard ampersand.
Can you share your code? It sounds like you don’t have quotes around the invoke-restmethod URL and PS is interpreting the & incorrectly. Multiple query parameters are supported by PSU.
PS C:\Users\adamr> Invoke-WebRequest http://localhost:5000/myapi?query1=1&query2=2
Id Name PSJobTypeName State HasMoreData Location Command
-- ---- ------------- ----- ----------- -------- -------
1 Job1 BackgroundJob Running True localhost Invoke-WebRequest http:/…
query2=2: The term 'query2=2' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Thanks, @adam! The quotes around the URL parameter is actually the issue. Appreciate the quick response! It would probably help to place a note in documentation that states these are required. Looks like PS5.1 and PS7 give different errors when these are not included: