Forum Discussion

vvittoria's avatar
vvittoria
Copper Contributor
Mar 22, 2022

Invoke-WebRequest : { "type": "Client error", "title": "Missing HTTP body" } - Error Api invoke

Dear all, 

  I need your support about the error indicated in the subject.

 

The Body field in the cmdlet contain the Json data but it is not possible to execute.

 

Invoke-WebRequest -Uri 'xxxxx' -Method POST -Headers $headers -ContentType 'application/problem+json' -body $body

  • Newbie_Jones's avatar
    Newbie_Jones
    Brass Contributor
    I have a couple of inputs\thoughts.

    Had you tried Invoke-RestMethod instead of Invoke-WebRequest?
    Is that content type correct? "application/json"
    Can you provide a sample of the JSON?

Resources