Skip to main content

Token-based pagination

Multicart Solution Inc.Api usagepaginationLess than 1 minute

Make paginated requests to the REST API

REST endpoints support token-based pagination. This guide illustrates how to request paginated data from the REST API and access each page of results.

How it works

When you send a request to a REST endpoint that supports token-based pagination, the response body returns the first page of results, and a links to the next page and the previous page of results (if applicable). You can use the links in the response to iterate through the pages of results.

Parameters

The request URL can include these parameters:

  • pageToken: A unique ID used to access a certain page of results. The pageToken parameter can't be modified and must be used exactly as it appears.
  • pageSize: The maximum number of results to show on the page. The default limit value is 50. The maximum limit value is 250.
  • dir: Direction of paging. The dir parameter may be Asc to forward pagination or Desc otherwise.
  • includedProperties: A list of which fields to show in the results. This parameter only works for some endpoints.

pageToken limitation

A request that includes the pageToken parameter can't include any other parameters except for pageSize and includedProperties (if it applies to the endpoint). If you want your results to be filtered by other parameters, then you need to include those parameters in the first request you make.

Response

The response include these parameters:

  • data: List of requested resources.
  • previousPage: Previous page relative url.
  • nextPage: Next page relative url.
  • pageSize: Page size.
  • nextPageToken: Next page token.
  • prevPageToken: Previous page token.