One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
Cloud
5 years agoExplorer | Level 3
Upload file with special characters will get INVALID_PATH error with non-json format
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
- 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 here.
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.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 2 days ago
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!