Pagination
We are using a Cursor-based pagination, a method of pagination that uses a unique identifier (cursor) to keep track of the current position in the dataset.
Here's a general overview of how it works:
Usage: The Retrieve Batch API takes in parameters such as
limit,search,before, andafterto control the pagination.Cursor: The
beforeandafterparameters are used to specify the cursor for fetching the previous or next page of results. The cursor typically represents the position of a specific record in the dataset.Sorting: The data is sorted by the
createdAtfollowed byidResult: The response returns the paginated results along with cursors for the next and previous pages, allowing for easy navigation through the dataset.
{
"data": [
{
"id": "message_62a2a141-97f8-4fc8-82db-36f539228322",
"recipient": "6599999999",
"values": {
"recipientName": "Emily Yeo",
"topic": "passport application #12345F"
},
"language": "english",
"latestStatus": "success",
"error": ""
},
...
],
"pageData": {
"hasNextPage": false,
"hasPreviousPage": false,
"startCursor": "WyIyMDIzLTEwLTI0VDE3OjQwOjI1Ljk2OCswODowMCIsIm1lc3NhZ2VfM2E1MWI1ODctMzQ5OS00YTBmLTlkNGUtZTRlOWYzNWZkNmMxIl0=",
"endCursor": "WyIyMDIzLTEwLTI0VDE3OjQwOjI1Ljk2OCswODowMCIsIm1lc3NhZ2VfM2E1MWI1ODctMzQ5OS00YTBmLTlkNGUtZTRlOWYzNWZkNmMxIl0="
}
}For example:
hasNextPagetells you if there's a next page in the querieddataobjectTo go to the next page, you can use the
afterQuery Parameter with the current page'sendCursorvalue.
hasPreviousPagetells you if there's a previous page in the querieddataobjectTo go to the previous page, you can use the
beforeQuery Parameter with the current page'sstartCursorvalue.
List of Apis that has pagination
Last updated
Was this helpful?