Downloading a piece of a file via curl using Range Retrieval Requests

Download dropbox-api eBook


This downloads just a piece of a file, using Range Retrieval Requests, from the Dropbox API at the remote path /Homework/math/Prime_Numbers.txt to the local path Prime_Numbers.txt.partial in the current folder:

 curl -X GET \
     --header "Authorization: Bearer <ACCESS_TOKEN>" \
     --header "Dropbox-API-Arg: {\"path\": \"/Homework/math/Prime_Numbers.txt\"}" \
     --header "Range:bytes=0-10" \
     -o "./Prime_Numbers.txt.partial"

The range specified, 0-10, tells the API to return just the first 10 bytes. If the API responds with a 206 status code, that indicates that the Range was accepted, and only the partial request range was returned.

<ACCESS_TOKEN> should be replaced with your access token.


Contributors: 1
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial:

Download eBook