Powershell Generic Invoke-RestMethod / WebRequest error handler

From: https://stackoverflow.com/questions/39319680/onelogin-rest-api-with-powershells-invoke-restmethod

Then, wrap all of your Invoke-RestMethod calls in a try Catch block like this.

Now when you run into an error, you can see the actual message, like this

Leave a Reply