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
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!
- Greg-DBDropbox Staff
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.
- Alice07Explorer | 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-DBDropbox Staff
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 & Feedback
Find help with the Dropbox API from other developers.5,918 PostsLatest Activity: 2 days ago
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 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!