Skip to main content

Hello. I noticed that the API docs give Powershell examples using Invoke-WebRequest instead of Invoke-RestMethod. I tend to prefer the latter due to its native deserialization of json and xml responses and due to the improvement of the cmdlet in powershell versions 6 and 7. A member of our team let us know that the doc examples use WebRequest because the Automox engineers have found “…Invoke-WebRequest to be more consistent in it’s returns with less errors…”



Could someone expound on those errors? I’m planning to have my team build scripts with RestMethod and am wondering about some of the errors you’ve seen with it.

Good timing as this was just asked in our internal Slack. You should be able to use either and have it work for our API. If you run into any issues using Invoke-RestMethod let us know so we can look into it on our end.


Reply