cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 

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

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

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?