title: Powershell v4 Invoke-RestMethod : HTTP Status 406
body: <p>Hi I'm running the following 'Invoke-RestMethed' command in Powershell v4 but it's throwing HTTP 406 error.</p>
  
  <pre><code>Invoke-RestMethod -Method Post -Uri $url -Headers $head -ContentType "application/xml" -Body $body -OutFile output.txt
  </code></pre>
  
  <p>I made following change to the header: </p>
  
  <pre><code>$head = @{"Authorization"="Basic $auth"; "Accept"="*/*"}
  </code></pre>
  
  <p>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 <strong>"Accept"="application/json"</strong> but getting the same error.</p>
  
  <p>Full error:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>