Pagination

All top-level API resources have support for bulk fetches via "list" API methods. For instance, you can list Users, list Portals, and list Roles. These list API methods share a common structure, taking at least these two parameters: limit, after.

The response of a list API method represents a single page in a chronological stream of objects. If you do not specify after, you will receive the first page of this stream, containing the oldest objects.

In each page, the value to be used to get to the next page in the after parameter is supplied.

See an example of paginated response that returns 2 items:

{
    "data": [
        {
            "id": "ro_ZW9dbXgfX2L0Dg",
            "name": "Admin Builder",
            "is_system": true
        },
        {
            "id": "ro_3zrr1XRrXMyYG6",
            "name": "Builder",
            "is_system": true
        }
    ],
    "paging": {
        "next": {
            "after": "MQit=" // This should be the value to use in the `after` parameter to get to the next page
        }
    }
}

You are at the end of the pages when the after parameter is not longer returned in the responses.

Last updated