As DevOps engineers, you get requirements to do scripts to perform several actions on application or get status of the application backend using API calls. This post explains small issue that we experience while writing PowerShell scripts to trigger APIs.
Issue: Invoke-RestMethod cannot be used to get the return HTTP status from the API. API call failed with mentioning -StatusCodeVariable is not valid. You can learn more about Invoke-RestMethod from here.