Cursor Based Pagination
Using the cursor-based approach, pagination in a collection can be controlled using the page[after], page[before], and page[size] query parameters.
To retrieve the first page of a collection, you don't need to pass any pagination parameters, for example:
https://api.eventtemple.com/v2/events
By default, the page size for pagination is set to 25. However, you can set a custom page size by using the page[size] query parameter in the API request. Note that the maximum allowed page size is 100 unless otherwise specified by the API documentation or the server.
https://api.eventtemple.com/v2/events?page[size]=100
The meta member of the response Response Object will include the after_cursor, before_cursor and has_more information.
{
"data": [
...
],
"included": [
...
],
"meta": {
"user_name": "xxxx xxx",
"after_cursor": "Y3Vyc29yOjEwODg=",
"before_cursor": null,
"has_more": true
}
}
To get records before or after a specific cursor, pass the page[after] or page[before] query parameters with the values from after_cursor or before_cursor responses from the previous request:
https://api.eventtemple.com/v2/events?page[size]=100&page[after]=Y3Vyc29yOjEwODg=
This approach ensures efficient and scalable pagination through large collections of data.
Updated about 1 month ago
