cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right 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: 

Upload file with special characters will get INVALID_PATH error with non-json format

Upload file with special characters will get INVALID_PATH error with non-json format

Cloud
Explorer | Level 3

When trying to upload a file with special character to dropbox, dropbox server will response http code 400 and the error message is non-json format with error response "Error in call to API function "files/upload": Invalid path: INVALID_PATH". This kind of error message is not well defined in API documents.

 

Does it is expected behavior and will it possible to align the error behavior to another json-style error response.

Or is there a official document to defined non-json format style error.

 

Example:

curl -v -X POST https://content.dropboxapi.com/2/files/upload --header "Authorization: Bearer access_token" --header "Dropbox-API-Arg: {\"path\": \"/folder1/�}�֌W\",\"mode\": \"add\",\"autorename\": false,\"mute\": false}" --header "Content-Type: application/octet-stream" --data-binary @test.pdf

 

> POST /2/files/upload HTTP/1.1
> Host: content.dropboxapi.com
> User-Agent: curl/7.54.0
> Accept: */*
> Authorization: Bearer access_token
> Dropbox-API-Arg: {"path": "/folder1/�}�֌W","mode": "add","autorename": false,"mute": false}
> Content-Type: application/octet-stream
> Content-Length: 0
>
< HTTP/1.1 400 Bad Request
< Server: envoy
< Date: Fri, 30 Oct 2020 08:29:00 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Security-Policy: sandbox allow-forms allow-scripts
< X-Dropbox-Request-Id: 5a99ff1dacac40da8df0f9439dc8c4f4
< X-Robots-Tag: noindex, nofollow, noimageindex
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< X-Robots-Tag: noindex, nofollow, noimageindex
< Vary: Accept-Encoding
< Transfer-Encoding: chunked

Error in call to API function "files/upload": Invalid path: INVALID_PATH

1 Reply 1

Greg-DB
Dropbox Staff

Yes, depending on the kind of error, the response may be plain text or JSON. You should check the 'Content-Type' response header to check what it is. For example, in this sample you shared it's "text/plain; charset=utf-8". You can find more information on the different kinds of errors the Dropbox API may return in the documentation he... 

 

Please also refer to this document for information on how to properly encode special characters in parameters when calling content-download and content-upload endpoints like this.

 

You can also refer to this article for information on reserved and ignored paths in general.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?