Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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