Pagination Parameters

Skip

Purpose

  • The $skip parameter defines how many results should be skipped, allowing for pagination in the result set.

Key Points

  • It is used with $top to implement limit and offset paging.

Syntax of $skip Expression

  • The expression follows the format:
NUMBER_OF_ITEMS_TO_BE_SKIPPED
  • Example
$skip=10

How to Use $skip in a Request

  • Add the $skip parameter to specify how many items should be skipped.
http://api2.saleslayer.com/rest/Catalog/Families/?$select=typ_title,typ_stat,typ_modify,typ_creation&$skip=1

Response Format

  • When building your API request, add the $skip parameter to specify how many items should be skipped.
{
    "value": [
        {
            "typ_stat": "V",
            "typ_title": "AV-Air Velocity",
            "typ_modify": "2023-11-23T13:35:59",
            "typ_creation": "2023-11-23T13:35:59"
        }
    ],
    "@count": 2,
    "@readLink": "https://catalog-rest.kp.saleslayer.com/rest/Catalog/Families/?$select=typ_title,typ_stat,typ_modify,typ_creation&$skip=1"
}


SkipToken

Purpose

  • The $skipToken parameter allows continuation token-based pagination for fetching data.

Key Points

  • It is recommended when no sorting is applied and for faster pagination.
  • The continuation token is provided by the API in the response when paging is available.

Syntax of $skipToken Expression

  • The expression follows the format:
CONTINUATION_TOKEN
  • Example of retrieved $skipToken.
$skipToken=5

How to Use $skipToken in a Request

  • When constructing your API request, add the $skipToken parameter to continue fetching the next set of results.
http://api2.saleslayer.com/rest/Catalog/Products?$select=prod_ref,cat_ref,prod_title&$skipToken=5&$top=5

Response Format

  • When you use $top, the response will contain the skipToken as @nextLink.
{
    "value": [
        {
            "prod_ref": "MyPer",
            "prod_title": {
                "en": "My Personify"
            }
        },
        {
            "prod_ref": "CuMoApp",
            "prod_title": {
                "en": "Custom Mobile Apps"
            }
        },
        {
            "prod_ref": "Atrius",
            "prod_title": {
                "en": "Atrius"
            }
        },
        {
            "prod_ref": "Builder",
            "prod_title": {
                "en": "Builder"
            }
        },
        {
            "prod_ref": "X-pressP",
            "prod_title": {
                "en": "X-press gfx Points"
            }
        }
    ],
    "@count": 11,
    "@readLink": "http://api2.saleslayer.com/rest/Catalog/Products?$select=[prod_ref,cat_ref,prod_title]&$top=[5]",
    "@nextLink": "http://api2.saleslayer.com/rest/Catalog/Products?$select=prod_ref,cat_ref,prod_title&$skipToken=5&$top=5"
}

Notes

  • The continuation token is provided by the API in the response when paging is available.
  • Use the @readlink skipToken provided.

Top

Purpose

  • The $top parameter defines the maximum number of items returned in the result set.

Key Points

  • It is typically used with $skip for limit and offset paging.
  • The default maximum page size is 100 items for most resources.

Syntax of $top Expression

  • The expression follows the format:
NUMBER_OF_ITEMS_TO_RETURN
  • Example for retrieving only the first 5 products and paginating 5 items.
$top=5

How to Use $top in a Request

  • When constructing your API request, add the $top parameter to specify the pagination.
http://api2.saleslayer.com/rest/Catalog/Products?$select=prod_ref,cat_ref,prod_description&$top=1

Response Format

  • When constructing your API request, add the $top parameter to specify how the results should be paginated.
{
    "value": [
        {
            "prod_ref": "X-pressP",
            "cat_ref": "DE",
            "prod_description": {
                "en": "X-press gfx Points"
            }
        }
    ],
    "@count": 11,
    "@readLink": "http://api2.saleslayer.com/rest/Catalog/Products?$select=prod_ref,cat_ref,prod_description&$top=1",
    "@nextLink": "http://api2.saleslayer.com/rest/Catalog/Products?$select=prod_ref,cat_ref,prod_description&$skip=1&$top=1"

}