2

I'm working on an app using Pushbullet's API, but I'm running into odd errors when running through the sample code at https://docs.pushbullet.com/v2/pushes/.

I'm executing the following cURL command (in Windows):

curl -k -u <MY_API_KEY>: -X POST https://api.pushbullet.com/v2/pushes --header 'Content-Type: application/json' --data-binary '{"type": "note", "title": "Note Title", "body": "Note Body"}'

...but it keeps generating the following error:

{"error": {"type":"invalid_request","message":"The param 'type' has an invalid value.","param":"type","cat":"\u003e:3"}}

It also produces this error: enter image description here

The other commands for the other endpoints in the documentation work fine...it's just this one.

Got any suggestions? Thanks for the help! :)

user2302078
  • 142
  • 1
  • 11

2 Answers2

5

It looks like windows doesn't support those kinds of quotes on the command line. Here's an example that works:

curl https://api.pushbullet.com/v2/pushes -X POST -u <access token>: --header "Content-Type: application/json" --data-binary "{\"type\": \"note\", \"title\":\"Note Title\", \"body\": \"Note Body\"}"

I think I'm going to try to replace the curl examples with something that has less confusing behavior.

Chris Pushbullet
  • 1,039
  • 9
  • 10
0

I figured it out - I don't really know why, but the cURL command wasn't working through the DOS prompt, and also wasn't working using the Postman REST client for Chrome, but I got it working in the DHC extension for Chrome. The trick was setting the Authorization header to "Basic", which resolves the Pushbullet access token to some other form, and makes a successful the HTTP request.

Hope this helps someone down the road if they run into this on Windows!

user2302078
  • 142
  • 1
  • 11