Push service giving bad request using curl

When using the One-time notification feature of the Ionic Push service, it has a toggle to show the equivalent curl request. However, when pasting this into the command line and executing it, it returns “Bad Request”. I’m pretty sure I used this previously and it worked fine. Has something changed and the equivalent curl request is now no longer producing the correct request?

1 Like

Not sure if you managed to solve this, I just ran into the exact same problem. For me it was caused by the example on the Ionic site. The example had something like:

curl -u your-private-api-key: -H “Content-Type: application/json” -H “X-Ionic-Application-Id: your-app-id” https://push.ionic.io/api/v1/push -d ‘{“tokens”: [“your”, “target”, “tokens”], “notification”:{“alert”:“Hello World!”}}’

However it basically trips over the quotes, the correct command is:

curl -u your-private-api-key: -H “Content-Type: application/json” -H “X-Ionic-Application-Id: your-app-id” https://push.ionic.io/api/v1/push -d “{“tokens”: [“your”], “notification”:{“aler\t”:“Hello World!”}}”