ChannelEngine: pagination in the APIs
About this article
This article describes the use of pagination in ChannelEngine's REST APIs.
Table of contents
Introduction
If you work with hundreds or even thousands of products across multiple channels, certain API responses may be unwieldy. Pagination can be very useful to filter and better manage those responses.
Pagination is available in, but not limited to, the following Merchant API calls:
GET/v2/cancellationsGET/v2/channelsGET/v2/productsGET/v2/ordersGET/v2/returnsGET/v2/shipmentsGET/v2/productbundlesGET/v2/notifications
Use pagination
With default settings
Some API calls use ChannelEngine's default pagination settings. ChannelEngine's APIs pagination starts at page 1, and lists 100 results per page.
API calls that use the default pagination settings include the page parameter in the call. In the example below, all orders with status Shipped and fromDate equal to 2021-01-01 are retrieved, as long as they belong to page 2 on the list:
curl -X
GET "https://demo.channelengine.net/api/v2/orders?statuses=SHIPPED&fromDate=2021-01-01&page=2&apikey=*******" -H "accept: application/json"With configurable settings
Some API calls include a pageIndex parameter. When the pageIndex parameter is included, you can also specify the pageSize parameter with your request, which enables you to define how many results to include per page.
By default, responses contain up to 100 items. You can increase pageSize, but the maximum allowed value is 500. To retrieve more records, make multiple requests using pageIndex for subsequent pages.
So to retrieve more than 500 records, use multiple pages, e.g.:
-
pageIndex=0&pageSize=500 -
pageIndex=1&pageSize=500 -
pageIndex=2&pageSize=500
Every response includes a total count, which helps you determine how many pages or what specific pages you need to request. In the example below, the total count is 18,920 items. Divided by the maximum number of items per page (i.e.: 100), the response results in 190 pages to be fetched.
For more information on ChannelEngine's APIs, check out the corresponding reference:
Comments
0 comments
Article is closed for comments.