Pagination

In this guide, we will look at how to work with paginated responses when querying the K-LINK API. By default, all responses limit results to ten. However, you can go as high as 100 by adding a pageSize parameter to your requests. If you are using one of the official klink.cloud API client libraries, you don't need to worry about pagination, as it's all being taken care of behind the scenes.

When an API response returns a list of objects, no matter the amount, pagination is supported. In paginated responses, objects are nested in a data attribute and have lastPage, attribute that indicates whether you have reached the end of the last page and total number of pages.

Example

You can pass the following attributes as parameters to retrieve the paginated data.

  • Name
    page
    Type
    integer
    Description

    Indicate the page number of total pages.

  • Name
    pageSize
    Type
    integer
    Description

    Limit the number of items returned.

Manual pagination using cURL

curl -G https://api.klink.cloud/api/v1/contacts \
  -H "Authorization: Bearer {token}" \
  -d page=1 \
  -d pageSize=10

Paginated response

{
  "total": 65,
  "page": 1,
  "pageSize": 10,
  "lastPage": 7,
  "data": [
    {
      "id": "WAz8eIbvDR60rouK",
      // ...
    },
    {
      "id": "hSIhXBhNe8X1d8Et"
      // ...
    },
    {
      "id": "fbwYwpi9C2ybt6Yb"
      // ...
    }
  ]
}