Need to see if your shared folder is taking up space on your dropbox šØāš»? Find out how to check here.
Forum Discussion
SmartPhoneLover
8 years agoExplorer | Level 3
Upload/Download files via shell (Android-Linux)
Hi all, I'm looking for upload and download files from an Application folder I have created on my account (with token). -> e.g. = Applications > app_name > Private > file.xxx The code I will use...
SmartPhoneLover
8 years agoExplorer | Level 3
I tried:
cd /sdcard/Download ; curl -X -O POST https://content.dropboxapi.com/2/files/download \
--header "Authorization: Bearer TOKEN_ID" \
--header "Dropbox-API-Arg: {\"path\": \"/Private/fmc_database.db\"}"
...but Terminal tell me that Dropbox does not support the '-O' argument. So, what I need to add to the cmd to allow saving the file to my local storage's device?
cd /sdcard/Download ; curl -X -O POST https://content.dropboxapi.com/2/files/download \
--header "Authorization: Bearer TOKEN_ID" \
--header "Dropbox-API-Arg: {\"path\": \"/Private/fmc_database.db\"}"
...but Terminal tell me that Dropbox does not support the '-O' argument. So, what I need to add to the cmd to allow saving the file to my local storage's device?
Greg-DB
Dropbox Community Moderator
8 years agoThe "-X" flag takes a parameter for the HTTP method to use, which should be "POST". In your code though, you've put the flag "-O" directly after that, so curl will send that as the method, which isn't valid. You would just need to move that out of that spot, e.g.,:
curl -O -X POST https://content.dropboxapi.com/2/files/download \
--header "Authorization: Bearer TOKEN_ID" \
--header "Dropbox-API-Arg: {\"path\": \"/Private/fmc_database.db\"}"
That "-O" option isn't really well suited for the Dropbox API though anyway, per the curl documentation:
-O, --remote-name
Write output to a local file named like the remote file we get. (Only the file part of the remote file is used, the path is cut off.)
The remote file name to use for saving is extracted from the given URL, nothing else.
That would just take the name from the URL, which would just be "download". The Dropbox API instead returns the file's metadata as JSON in the "dropbox-api-result" result header. You should parse it out from there instead if you want the actual file name.
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!