We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
RaviDixit15
8 years agoNew member | Level 2
Testing the upload API via postman fails and returns error
I am working on Xamarin forms application and trying to use the REST API of dropbox to upload files in dropbox and hence for testing i tried to make a postman call to upload files into dropbox, it seems to work on the API explorer of dropbox but on the postman it fails even though i pass all the required parameter as explained in the API explorer.
I am not sure what i am doing incorrect here OR if this is a bug or something not sure
Please let me know if i can make calls via postman OR some issue with my header request.
Given is the error message i am getting
Error in call to API function "files/upload": Bad HTTP "Content-Type" header: "multipart/form-data; boundary=--------------------------387630636170231897718145". Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-hack".
Postman error message
4 Replies
- Mark8 years ago
Super User II
*moves to API area* - Greg-DB8 years ago
Dropbox Community Moderator
The /2/files/upload endpoint expects one of the cited "Content-Type" request headers, ideally "Content-Type: application/octet-stream". Based on the error message though, it appears your client is overriding your header setting and sending something else ("multipart/form-data; boundary..."). I can't offer support on configuring Postman itself, as it's made by a third party, but it's probably a matter of configuring the "Body" tab properly. I.e., make sure it's set to "binary". (Additionally, that "charset" would be part of the "Content-Type" header value itself, not another header. You probably don't need to set that anyway though.)
Also, this would be a different issue, but your "Dropbox-API-Arg" value is incorrect. It should be the JSON for the API call parameters per the documentation: https://www.dropbox.com/developers/documentation/http/documentation#files-upload - RaviDixit158 years agoNew member | Level 2
I will try to check with postman once again based on your comments thanks for the guidance, one more thing is reason why i tried to use the API and not the dropbox native client for xamarin is that when it i try to run the iOS project i get an exception which says Dropbox client not found, i guess i will raise a new ticket for that.
Is there any sample which uses the latest nugget package for dropbo client with .net framework 2.0?
- Greg-DB8 years ago
Dropbox Community Moderator
For .NET, we recommend using the official Dropbox API v2 .NET SDK if possible:
https://github.com/dropbox/dropbox-sdk-dotnet
There examples included with that here:
https://github.com/dropbox/dropbox-sdk-dotnet/tree/master/dropbox-sdk-dotnet/Examples
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!