Hi I'm running the following 'Invoke-RestMethed' command in Powershell v4 but it's throwing HTTP 406 error.
Invoke-RestMethod -Method Post -Uri $url -Headers $head -ContentType "application/xml" -Body $body -OutFile output.txt
I made following change to the header:
$head = @{"Authorization"="Basic $auth"; "Accept"="*/*"}
My understanding is the server takes request in xml format but return in JSON format and maybe thats causing the issue? I did tried changing header to "Accept"="application/json" but getting the same error.
Full error:
Invoke-RestMethod : HTTP Status 406 - type Status report message description The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.