docs
  1. SCAYLE Resource Center
  2. Admin API
  3. Getting Started
  4. Pagination

Pagination

Most of the API resources have support for bulk retrieval. You can get a collection of products, variants, attribute groups and other resources.

These API methods share a common structure, supporting at least these two parameters: limit and cursor.

Parameters

ParameterTypeRequiredDetails
limit

integer

falseThe limit parameter specifies the maximum number of results to be returned per page. Each API resource can have a different default value.
cursor

string

falseA valid cursor for use in pagination. Can be retrieved from the collection response.

Collection Response Format

ParameterTypeRequiredDetails
limitarraytrueAn array containing the requested entities.
cursor?falseAn object containing information for use in pagination.

Example

Iterate over all products from a specific shop category

If the total product count exceeds the default limit of 100, you can retrieve the next page of results as follows:

let options = {
    limit: 5
};
let collection = null;

do {
   let response = await client.apis.AttributeGroups.getAttributeGroups(options);
   collection = response.body;

   collection.entities.forEach(
        attributeGroup => console.log(attributeGroup.name)
   );

   options.cursor = collection.cursor.next;

} while (collection.cursor.next !== null);