Large content download chunking

You can download large content from the GraphQL API by using the content download endpoint.

You can do uninterrupted download of large content from the GraphQL server if the connections remain open throughout the download. When the size of the downloadable content reaches several gigabytes, you can start to face challenges during download. In some environments, it can be challenging to configure the necessary network components to remain open for longer durations to avoid reset connection errors.

In environments or applications where connections cannot remain open during large content download, you can append the following parameters to the download URL:
  • position - The download endpoint skips ahead in the content stream and starts to return content from this position.
  • length - A maximum of this number of bytes is returned.

Using these parameters, you can download the full content of a large document in chunks. Each request to the download endpoint is a separate request. On each subsequent request, specify a position where the last request left off.

You can download the first chunk with just the length parameter:
https://example.ibm.com/content-services-graphql/content?repositoryIdentifier=OS1&documentId=...guid...&elementSequenceNumber=0&length=6711075
Download subsequent requests with a position and length parameter:
https://example.ibm.com/content-services-graphql/content?repositoryIdentifier=OS1&documentId=...guid...&elementSequenceNumber=0&position=6711075&length=6711075

When the last chunk is reached and the length is larger than what is available to be read, it returns whatever size remains. If the position is greater than the overall size of the content, a zero-length content is returned.