We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
Asanchez8
8 years agoExplorer | Level 4
Bad request (400) if made in my server
Hello.
I am barely starting with the dropbox api v2 to make requests to my dropbox account. However, i have a problem with all requests made in my server. I can make functioning requests on JSFiddle by normal ajax http request or with dbx javascript used on the offical documents, this is the example: http://jsfiddle.net/3nfz9fc4/ You can check the object outcomes in console log.
Nevertheless, using the SAME CODE (having specified by the same way the access token and headers if needed), if i try to make ANY request on my server or localhost i get the following:
{status: 400, error: "Error in call to API function "files/list_folder": request body: could not decode input as JSON", response: c}
inside response object, somewhere below the rainbow:
error:Error: cannot POST https://api.dropboxapi.com/2/files/list_folder (400)
The only thing on my mind i got is that is like it could not detect anything written on the body of the request, and therefore it cant detect the {"path":""} JSON, but i am not even sure about it.
Why do the requests both with ajax and dbx work in JSFiddle page but not in my server, localhost, or chrome console (with script src linked)?
2 Replies
- Greg-DB8 years ago
Dropbox Community Moderator
That error message indicates that the Dropbox API couldn't parse the contents of the request body as JSON to read the parameters. Sending an empty request body is one way to cause that.
Can you elaborate on the environment you're using to run this on your server? If you can share the steps to reproduce the issue, I'll be happy to take a look. - Asanchez88 years agoExplorer | Level 4
Never mind. It turns out it was a "necessary" and old script linked which was modifying ajax requests, not made by me. Horrible.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,033 PostsLatest Activity: 3 years ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!