Is there a way to store the return code somewhere when calling Invoke-RestMethod
in PowerShell?
My code looks like this:
$url = \"http://www
So the short answer is: You can't.
You should use Invoke-WebRequest
instead.
The two are very similar, the main difference being:
PS> $response = Invoke-WebRequest -Uri $url -Method Get
PS> $response.StatusCode
200
PS> $response.Content
(…xml as string…)