user3451326
user3451326

Reputation: 93

Unable to upload pdf using box view curl api - json parse error

I am geting this error while uploading a file using box view api. "JSON parse error - No JSON object could be decoded"

Here is my code from windows command promt.

curl https://view-api.box.com/1/documents \
  -H "Authorization: Token <token>" \
  -H "Content-Type: application/json" \
  -d "url": "http://www.eon.com/content/dam/eon-com/Nachhaltigkeit/CS-Bericht_2013/Downloads/CDP_2013_EON.pdf" \
  -X POST

Any pointer will be highly appreciated!!

Upvotes: 0

Views: 242

Answers (1)

lakenen
lakenen

Reputation: 3496

You need to specify the data as JSON. In this example, your JSON is not formatted properly. Try this (replace <token> with your authentication token):

curl https://view-api.box.com/1/documents \
  -H "Authorization: Token <token>" \
  -H "Content-Type: application/json" \
  -d '{"url": "http://www.eon.com/content/dam/eon-com/Nachhaltigkeit/CS-Bericht_2013/Downloads/CDP_2013_EON.pdf"}' \
  -X POST

Upvotes: 0

Related Questions