Pagination

Pagination is a mechanism that separates results returned as a response to an API call into multiple pages. It is mostly used by the GET method which gets a list of items, and is useful especially when the response payload is large.

Cursor-based pagination {#cursor-type-pagination}

The LINE WORKS APIs provide cursor based pagination, where a cursor is a pointer that points to the end of the data to get. It is added to the response body of an API call supporting pagination.

Note

  • Note that some API operations to get data do not support pagination.

The offset based pagination previously provided is hard to flexibly deal with the addition or deletion of data which may occur during the process of data retrieval, causing some of the data to be duplicated or lost and thus requiring reprocessing of the data.

The cursor based pagination, however, gets only the specified amount of data based on the end of the previously retrieved data, rather than getting the entire data at once. Therefore, it is a faster and more efficient way to get data without duplication of data elements.

How to use {#how-to-use-pagination}

The response body of an API call to get data includes a cursor value in responseMetaData.nextCursor as shown in the following example.

HTTP/1.1 200 OK{    "calendars": [        {            .....        },        {            .....        }    ],    "responseMetaData": {        "nextCursor": "kBhFZjtIFJKDiX1rE78vAg=="    }}
PropertyDescription
responseMetaDataThe data to be provided to the client, regardless of the API response.
responseMetaData.nextCursorCursor value for pagination

To continue to get the data list, specify the value for the cursor parameter when you make an API call. If the end of the data list is reached and there are no more pages left, responseMetaData.nextCursor is not returned.

Number of data elements to get at once {#request-record-count}

You can use the count parameter to specify the number of data elements to get at a time. If you do not specify the count parameter, each API operation uses the predefined default value.The count value cannot exceed maxCount.