Users can retrieve a partial object using the HTTP Range header with the DataONE GET /object/{id} API.
Syntax:
-H "Range: bytes={start}-{end}" GET /object/{id}
Rules:
The
startvalue must be specified, and must be greater than or equal to0(since0denotes the first byte).
startmust be less than or equal toend.
endmust be less than the total object size.If
endis omitted, the response will include all bytes fromstartto the end of the object.
# Examples
// Get the first byte of object `foo.1`
curl -H "Range: bytes=0-0" -X GET https://knb.ecoinformatics.org/knb/d1/mn/v2/object/foo.1
// Get 3 bytes of object `foo.1`, starting from the second byte
curl -H "Range: bytes=1-3" -X GET https://knb.ecoinformatics.org/knb/d1/mn/v2/object/foo.1
// Get all bytes of object `foo.1` except the first byte
curl -H "Range: bytes=1-" -X GET https://knb.ecoinformatics.org/knb/d1/mn/v2/object/foo.1