Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Alice07
5 years agoExplorer | Level 4
Download API resume
Hello,
I daily need to download a file into iOS from Dropbox using API.
The file is ~1GB.
Whether the screen saver occurs, or under some other conditions (incoming calls), then the download is aborted, I can restart it, but not resume it from where it left.
It is quite frustrating since it happens frequently.
Is there a way to resume a partial download or force dividing download into smaller parts ?
Thanks
Sure, you can use this by setting the "Range" header. You can find information on the syntax in the spec. For example, here's a call that would download only bytes 0 through 5:
curl -X POST https://content.dropboxapi.com/2/files/download \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Dropbox-API-Arg: {\"path\": \"/test.txt\"}" \ --header "Range: bytes=0-5"And here's an example that would download everything from byte index 6 to the end:
curl -X POST https://content.dropboxapi.com/2/files/download \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Dropbox-API-Arg: {\"path\": \"/test.txt\"}" \ --header "Range: bytes=6-"Hope this helps!
3 Replies
Replies have been turned off for this discussion
- Greg-DB5 years ago
Dropbox Community Moderator
Are you using one of the official Dropbox SDKs? If so, which one?
The API itself does support "Range Retrieval Requests", e.g., on /2/files/download, but not all of the SDKs implement that.
- Alice075 years agoExplorer | Level 4
Hello,
thanks for your answer.
I actually using the /2/files/download API
I do not know how to add/implement "Range Retrieval Requests".
Can you provide some examples or suggestions ?
- Greg-DB5 years ago
Dropbox Community Moderator
Sure, you can use this by setting the "Range" header. You can find information on the syntax in the spec. For example, here's a call that would download only bytes 0 through 5:
curl -X POST https://content.dropboxapi.com/2/files/download \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Dropbox-API-Arg: {\"path\": \"/test.txt\"}" \ --header "Range: bytes=0-5"And here's an example that would download everything from byte index 6 to the end:
curl -X POST https://content.dropboxapi.com/2/files/download \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Dropbox-API-Arg: {\"path\": \"/test.txt\"}" \ --header "Range: bytes=6-"Hope this helps!
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
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!