Skip to content

Instantly share code, notes, and snippets.

@AlexanderHolmeset-zz
Created August 10, 2019 09:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexanderHolmeset-zz/0cc887619bf32ce0e8aecbd11e517f1d to your computer and use it in GitHub Desktop.
Save AlexanderHolmeset-zz/0cc887619bf32ce0e8aecbd11e517f1d to your computer and use it in GitHub Desktop.
try{Invoke-RestMethod -Body $RequestBody -Method POST -Uri $uri -ContentType "application/json" -Headers @{Authorization = "Bearer $token"}}
catch{
$ResponseResult = $_.Exception.Response.GetResponseStream()
$ResponseReader = New-Object System.IO.StreamReader($ResponseResult)
$ResponseBody = $ResponseReader.ReadToEnd()
}
$ResponseBody
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment