Pagination

In this guide, we will look at how to work with paginated responses when querying CollabPay. By default, all responses limit results to 15. However, you can go as high as 100 by adding a per_page parameter to your requests.

In paginated responses, objects are nested in a data attribute and have pagination is nested in a meta attribute. That will indicate if there are more results, total pages and the current page.

Example

  • Name
    per_page
    Type
    integer
    Description

    Limit the number of items returned. Default 15, max 100.

  • Name
    page
    Type
    integer
    Description

    Page of results to be returned.

Manual pagination using cURL

curl -G https://collabpay.app/api/v1/products \
  -H 'Content-Type: application/json'
  -H 'Accept: application/json'
  -H "Authorization: Bearer {token}" \
  -d per_page=50 \
  -d page=1

Paginated response

{
    "data": [
        {
            "id": "aeda9be5-c9e1-40ec-8c76-be098262b7f6",
            // ...
        },
        {
            "id": "0dd0694a-3dd0-471b-81ec-286ef7ecb30c",
            // ...
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://collabpay.app/api/v1/products",
        "per_page": 15,
        "to": 2,
        "total": 2
    }
}