pagination strategies.md

Pagination strategies

Sales Layer APIs expose pagination parameters on list operations so clients can process large datasets in controlled batches.

The current OpenAPI specifications document:

Token-based pagination

Token-based pagination uses $skipToken to continue reading from a position supplied by the API.

When available, this strategy is recommended for large or frequently synchronized datasets because it avoids manually calculating offsets.

Example:

GET https://api2.saleslayer.com/catalog/Products?$select=prod_ref,prod_title&$skipToken=TOKEN_VALUE

Use the @nextLink value from a response when the API provides one.

Limit-based pagination

Limit-based pagination uses $top and $skip.

GET https://api2.saleslayer.com/catalog/Products?$skip=0&$top=50
GET https://api2.saleslayer.com/dam/images?$skip=0&$top=50

Use this strategy when the endpoint does not expose $skipToken or when the integration needs explicit page offsets.

Choosing a strategy

Strategy Use when
$skipToken The endpoint returns a continuation link and the integration processes large or changing datasets.
$skip and $top The endpoint supports offset-style pagination or the integration needs predictable fixed pages.

Recommendations

Note: $skipToken is not compatible with $orderby. When using token-based pagination, omit $orderby from the request. Use $skip and $top with $orderby when sorted pagination is required.