Pagination

In this guide, we will look at how to work with paginated responses when querying the ola.cv API. By default, all responses limit results to 20. However, you can go as high as 100 by adding a page parameter to your requests.

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 pagination information is included in the meta attribute. You can use the page query parameter to browse pages.

Example using pagination

In this example, we request the first page of the domains resource from an account. As a result, we get a list of three domains and can tell by the next_page_url attribute that we have reached the end of the resultset.

  • Name
    current_page
    Type
    number
    Description

    This is the current page being accessed by your request.

  • Name
    first_page_url
    Type
    string
    Description

    This is the URL at which the first page of records can be obtained.

  • Name
    next_page_url
    Type
    string|null
    Description

    This is the URL at which the next page of records can be obtained when available.

  • Name
    prev_page_url
    Type
    string|null
    Description

    This is the URL at which the previous page of records can be obtained when available.

  • Name
    per_page
    Type
    number
    Description

    This is the number of records per page being accessed by your request.

Example paginated request

curl https://ola.cv/api/v1/domains?page=1 \
  -H "Authorization: Bearer {token}"

Paginated response

{
  "data": [
    {
      "id": "442723857177096192",
      // ...
    },
    {
      "id": "442723857177096206"
      // ...
    },
    {
      "id": "442723857177096224"
      // ...
    }
  ],
  "meta": {
    "current_page": 1,
    "first_page_url": "https://ola.cv/api/v1/domains?page=1",
    "from": 1,
    "next_page_url": null,
    "path": "https://ola.cv/api/v1/domains",
    "per_page": 20,
    "prev_page_url": null
  }
}

Was this page helpful?