For the complete documentation index, see llms.txt. This page is also available as Markdown.

Pagination

Cursor- versus Offset-based Pagination

Cursor-based pagination is fast, but does not support sorting, while offset-based pagination is slower, but supports sorting. If no pagination method is selected in the API call, the sort parameter is used to choose the default pagination.

  • When no sorting is set, cursor based pagination will be used by default.

  • When sorting is requested, offset-based pagination is used.

Cursor-based pagination

Uses a pointer to a specific record and then returns the records following this record. It is able to handle data updates without skipping records or displaying them twice and at a faster speed, but can only handle small data jumps. There is also no easy option to sort or no way to skip pages, so if you want page X, all pages leading up to X must also be requested because each page contains the pointer to the next page.

Cursor-based pagination uses the parameter pageSize (amount of rows to return) in combination with pageToken (the cursor to get subsequent results). The parameter remainingRecords shows the number of records after the current cursor which are not shown. remainingRecords is an approximation only, as this number can increase or decrease while you are paging because records might be added or removed.

Example

Suppose a list of projects, with 2 projects returned per page (enter your API key in the YOUR_API_KEY part of the expression)

https://ica.illumina.com/ica/rest/api/projects?includeHiddenProjects=false&pageSize=2' \ -H 'accept: application/vnd.illumina.v3+json' \ -H 'X-API-Key: YOUR_API_KEY
'https://ica.illumina.com/ica/rest/api/projects?includeHiddenProjects=false&pageSize=2' \
-H 'accept: application/vnd.illumina.v3+json' \
-H 'X-API-Key: YOUR_API_KEY'

The response will contain a pointer to the next page "nextPageToken": "A_STRING_OF_LETTERS_AND_NUMBERS" You then use that pointer (the string of numbers and letters) to get the next 2 entries by replacing A_STRING_OF_LETTERS_AND_NUMBERS by the returned next page token

curl -X 'GET' \
  'https://ica.illumina.com/ica/rest/api/projects?includeHiddenProjects=false&pageToken=A_STRING_OF_LETTERS_AND_NUMBERS_HERE&pageSize=2' \
  -H 'accept: application/vnd.illumina.v3+json' \
  -H 'X-API-Key: YOUR_API_KEY'

Offset-based pagination

Returns records based on their position in a table. The data set is divided into pages and the offset parameter is used to determine which page to display. Offset pagination can quickly perform large jumps in data because you do not need to query previous pages and it allows custom sorting. The downside is that offset-based pagination is susceptible to missing records or displaying records twice when there have been updates while it is paginating.

In Platform Core, offset-based pagination is limited to 200.000 rows, and does not guarantee unique results across all pages as data can be updated during pagination.

Offset pagination uses the parameter pageSize (amount of rows to return) in combination with pageOffset (amount of rows to skip) and totalItemCount (The total number of records matching the search criteria). The larger your page size is, the slower the response time.

Example

GET /api/projects/{projectId}/analyses with pageOffset to 0. This will return the totalItemCount. If you want to sort the results, you can use reference descfor descending)

curl -X 'GET' \'<SERVER>/ica/rest/api/projects/<PROJECT_ID>/analyses?pageOffset=2&pageSize=2&sort=reference%20desc' \ -H 'accept: application/vnd.illumina.v3+json' \ -H 'X-API-Key: <AUTH_KEY>'

Last updated

Was this helpful?