Downloading an Object Body

You can divide an object body into multiple pieces and download the pieces one by one.

Suppose that you download an mp4 file of 1.5 MB by calling the API twice. The next example downloads the first 1 MB of this file.

curl -v -X GET \
  -H "Authorization: Bearer {ACCESS_TOKEN}" \
  -H "Range: bytes=0-1048575" \
  -H "Accept: */*" \
  "https://api-jp.kii.com/api/apps/{APP_ID}/groups/{GROUP_ID}/buckets/{BUCKET_ID}/objects/{OBJECT_ID}/body"

The byte range is specified in the "Range" header.

Kii Cloud will return a 206 response with the divided data like the following:

< HTTP/1.1 206 Partial Content
< Server: Apache-Coyote/1.1
< Access-Control-Allow-Origin: *
< ETag: {E_TAG}
< Content-Type: video/mp4
< Content-Length: 1048576
{
  {***THE_FIRST_1_MB_OF_THE_BINARY_DATA***}
}

The remaining data can be downloaded as follows:

curl -v -X GET \
  -H "Authorization: Bearer {ACCESS_TOKEN}" \
  -H "Range: bytes=1048576-1572863" \
  -H "Accept: */*" \
  "https://api-jp.kii.com/api/apps/{APP_ID}/groups/{GROUP_ID}/buckets/{BUCKET_ID}/objects/{OBJECT_ID}/body"

Kii Cloud will return a 206 response with the divided data like the following:

< HTTP/1.1 206 Partial Content
< Server: Apache-Coyote/1.1
< Access-Control-Allow-Origin: *
< ETag: {E_TAG}
< Content-Type: video/mp4
< Content-Length: 524288
{
  {***THE_REMAINING_BINARY_DATA***}
}