Pagination

Pagination is a common technique used by APIs to limit the amount of data returned in a single request. This is particularly useful when dealing with large datasets that could potentially overwhelm clients with too much data at once.

In the cevoid API, the default value for limit is 10, and the maximum value is 25. This means that if clients don't specify a value for limit in their request, the API will return 10 items by default. If clients want to retrieve more items, they can specify a value up to a maximum of 25.

It's worth noting that all API routes that return multiple items support pagination, so clients can easily navigate through large datasets. This means that clients can specify the number of items they want to retrieve per request (using the limit parameter), and also specify the starting point for the items to retrieve (using the skip parameter).

Example using pagination

In this example, we will explore how skip and limit pagination can be implemented in the cevoid API.

  • Name
    skip
    Type
    integer
    Description

    Define the number of items to skip.

  • Name
    limit
    Type
    integer
    Description

    Limit the number of items returned.

Manual pagination using cURL

curl -G https://api.cevoid.com/v1/posts \
  -H "x-api-key: {key}" \
  -d skip=5 \
  -d limit=10

Paginated response

{
  "count": 30,
  "next": "https://api.cevoid.com/v1/posts?skip=15&limit=10",
  "nodes": [
    {
      "id": "WAz8eIbvDR60rouK",
      // ...
    },
    {
      "id": "hSIhXBhNe8X1d8Et"
      // ...
    },
    {
      "id": "fbwYwpi9C2ybt6Yb"
      // ...
    }
  ]
}