cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Download API resume

Download API resume

Alice07
Explorer | Level 4
Go to solution

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

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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! 

View solution in original post

3 Replies 3

Greg-DB
Dropbox Staff
Go to solution

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.

Alice07
Explorer | Level 4
Go to solution

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-DB
Dropbox Staff
Go to solution

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! 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Alice07 Explorer | Level 4
What do Dropbox user levels mean?