Pagination in requests to Yandex Market API for sellers
Some queries do not return the result in its entirety, but page by page. To get the full result, run several consecutive queries. — in each new request, pass a parameter with the next page of results.
Outdated type of pagination
Some methods support pagination with the page number (parameter page). This type of pagination is outdated — don't use it. If both types of pagination are available in the method, use pageToken.
How to get all the result pages
Examples of methods with pagination by pageToken:
- POST v2/businesses/{businessId}/offer-cards
- POST v2/campaigns/{campaignId}/offer-prices
- GET v2/campaigns/{campaignId}/returns
- POST v1/businesses/{businessId}/orders
To get the full result:
-
Make a request where:
- Don't pass it on
pageToken. - If desired, send
limit. In the specification of each method for the parameterlimitthe values are specifiedminimum,maximumanddefault. If you do not pass the parameter, the default value will be used.
Automatic reduction
limitSome methods automatically reduce the passed value.
limitbeforemaximumif it exceeds the allowed maximum — this is indicated in the parameter description.limitsuch methods.Examples of methods:
The response will return the parameter
paging. - Don't pass it on
-
If in
pagingthe parameter returnednextPageTokenso there is the next page of the result. Repeat the request, where pass the valuenextPageTokenin the parameterpageToken.Parameter value
nextPageTokenThis is not a page number, but a string that needs to be passed in the request.
If there is no parameter, then the last page is returned. Make more requests no need.
-
Keep executing requests until it returns
nextPageToken.