1

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

curl -X PATCH "http://172.28.36.62:8080/api/3/http/upstreams/my-api/servers/5" -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.

1

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

Invoke-RestMethod -Uri 'http://172.28.36.62:8080/api/3/http/upstreams/my-api/servers/5' `
    -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.