You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
wayne606
7 years agoNew member | Level 2
can't upload files with curl
I am trying to upload files with curl. Based on community advice I think this should be correct:
curl -X POST https://content.dropboxapi.com/2/files/upload \
--header "Authorization: Bearer MyOauthApiKey" \
--header "Dropbox-API-Arg: {\"path\": \"/directory/myfile\"}" \
--header "Content-Type: application/octet-stream" \
--data-binary @directory/myfile
but I get a 404 error. Going to https://content.dropboxapi.com/2/files/upload in a browser window also resuts in an error.
What is the correct way to do this?
Yes, /2/files/upload only supports files up to 150 MB. For larger files, use upload sessions.
- Greg-DBDropbox StaffThat code looks correct, and it's working for me. (Browsing there in a browser isn't supposed to work.)
Is this the exact code you're running? Can you share the full code/output? (Just be sure to redact the access token of course.) You can also add a "-v" flag to tell curl to show verbose output.- wayne606New member | Level 2
Intersting, now that I look at the output in more detail I see
< HTTP/1.1 413 Request Entity Too Large
This is a 2.3GB file. Should I be uploading this in a different way?
- Greg-DBDropbox Staff
Yes, /2/files/upload only supports files up to 150 MB. For larger files, use upload sessions.
- cjh39Explorer | Level 3
Hello,
I would like to to do the following:
1. Use curl to upload a file to dropbox using a Raspberry PI
2. This command
curl -X POST https://content.dropboxapi.com/2/files/upload \ --header "Authorization: Bearer MyOauthApiKey" \
--header "Dropbox-API-Arg: {\"path\": \"/directory/myfile\"}" \
--header "Content-Type: application/octet-stream" \
--data-binary @directory/myfile
3. On the dropbox website, I would like to give access to the raspberry pi "MyOAuthAPIKey" , but DO NOT want the raspberry pi to have to complete any steps. Just give the raspberry pi this "Key" and then use the Curl statement.
Please confirm this will work and the instructions. Otherwise how do I use curl ?
Thanks
- Greg-DBDropbox Staff
cjh39 In place of "MyOauthApiKey" you would put your Dropbox API OAuth 2 access token.
Once retrieved, Dropbox API OAuth 2 access tokens can be used entirely programmatically, and don't expire automatically, so they can be used without manual user intervention. E.g., you can use it in unattended code, such as on a Raspberry Pi.
You can find information on getting a Dropbox API OAuth 2 access token in the OAuth Guide.
Once you have an access token, the /2/files/upload endpoint is the right way to upload files smaller than 150 MB.
If you have any further questions or issues, please open a new thread so we can help without spamming anyone else on this old thread.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,888 PostsLatest Activity: 18 hours agoIf 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!