cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bad request (400) if made in my server

Bad request (400) if made in my server

Asanchez8
Explorer | Level 4

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 2

Re: Bad request (400) if made in my server

Greg-DB
Dropboxer
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.

Re: Bad request (400) if made in my server

Asanchez8
Explorer | 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.

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Asanchez8 Explorer | Level 4
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?