cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We are making some updates so the Community might be down for a few hours on Monday the 11th of November. Apologies for the inconvenience and thank you for your patience. You can find out more 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: 

Re: Error when uploading files via API

Error when uploading files via API

Ross82
Explorer | Level 4

Hi, 

I recently started having issues uploading files to dropbox via API. The error returned is

 

HTTP/1.1 400 Bad Request

 

The output via curl is as below

 

* using HTTP/1.x
> POST /2/files/upload HTTP/1.1
Host: content.dropboxapi.com
Accept: */*
Authorization: Bearer MyBearerToken
Dropbox-API-Arg: {
"path":"file_to_upload",
"mode":"add",
"autorename": true,
"mute": false,
"strict_conflict": false
}
Content-Type:application/octet-stream
Content-Length: 1130353
Expect: 100-continue
 
< HTTP/1.1 400 Bad Request
< Content-Length: 1005
< Content-Type: text/html
< Vary: Accept-Encoding
< X-Dropbox-Response-Origin: local
< Date: Sat, 10 Feb 2024 10:02:13 GMT
< Server: envoy
< Connection: close
* Closing connection
 
Anybody know what could be happening?
 
Thank you in advance
 
1 Accepted Solution

Accepted Solutions

Здравко
Legendary | Level 20

Hi @Ross82,

Such an error appear when you have something wrong in your parameters. If you haven't reformatted your headers to post them here, then you have wrong HTTP header (every header in the header block should appear in a single line - your arguments are spread on multiple lines - bad syntax). If not exactly this, then there is something similar. In all cases there is content:


@Ross82 wrote:
...
< Content-Type: text/html
...

A human readable text that explains in details what's wrong. Something you have cut. 😉 In other words - you have ignored the answer of your question. 😀

Hope this gives direction.

View solution in original post

2 Replies 2

Здравко
Legendary | Level 20

Hi @Ross82,

Such an error appear when you have something wrong in your parameters. If you haven't reformatted your headers to post them here, then you have wrong HTTP header (every header in the header block should appear in a single line - your arguments are spread on multiple lines - bad syntax). If not exactly this, then there is something similar. In all cases there is content:


@Ross82 wrote:
...
< Content-Type: text/html
...

A human readable text that explains in details what's wrong. Something you have cut. 😉 In other words - you have ignored the answer of your question. 😀

Hope this gives direction.

Ross82
Explorer | Level 4

Thank you very very muc. This solved my issue. I have been using the code for over 2 years with no issues. Just yesterday the issue began. But I am thankful for the solution. It is now working properly. Many thanks

Need more support?