I'm struggling to try and convert the following curl request into powershell using invoke-webrequest:

curl -X PATCH "" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"down\": false}"

Gone and upgraded nginx and it uses a later version of the API with different commands and struggling to swap them over to powershell.


Assuming your API is a REST API you can use the Invoke-RestMethod PowerShell cmdlet:

Invoke-RestMethod -Uri '' `
    -Method Patch -ContentType 'application/json' -Body '{"down": false}'
  • 1
    That works a treat, thank you very much Christophe – John Fox Feb 7 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.