Forum Discussion

Cloud's avatar
Cloud
Explorer | Level 3
5 years ago

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

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 2 days ago
351 Following

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!