Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hi Team,
we are using the Dropbox REST API with OAuth2.
When attempting to upload a file I don't know where to put the file contents using the wininet for http way.
In the docs there is just a curl example
curl -X POST https://content.dropboxapi.com/2/files/upload \ --header "Authorization: Bearer
" \ --header "Dropbox-API-Arg: {\"path\": \"/Homework/math/Matrices.txt\",\"mode\": \"add\",\"autorename\": true,\"mute\": false}" \ --header "Content-Type: application/octet-stream" \ --data-binary @local_file.txt
but I don't understand how to put the contents file.
I see the 3 headers like in the example but what about the file ?.
data-binary is put in the body ?
or in the header ?
and how ?
I used the postman tool to reproduce the upload I was successful. The problem is that the postman put the file in the body in a binary way selecting the file with a explorer but I cannot see how and where to put it using HttpSendRequest with a POST verb.
Any suggestion to do it ?
Thanks in advance
The /2/files/upload endpoint is a "content-upload" style endpoint, so it does expect the file data for the upload in the request body. That is what curl's "--data-binary" does. (I.e., in the example, that's how you specify what data or file curl should use for the request body.)
I can't offer support for and don't have a sample for WinINet/HttpSendRequest specifically unfortunately though, so you'll need to refer to the documentation for that for instructions on how to configure a request using that with the desired data in the body.
Hi there!
If you need more help you can view your support options (expected response time for a 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!