Pagination
In this guide, we will look at how to work with paginated responses when querying the Bob! Desk API. We will see how to use the cursor
parameter to paginate the results. We will also see how to use the updated_after
and created_after
parameters to retrieve only the data that has been updated since a specific date.
What is pagination?
Pagination is a technique used to split a large amount of data into smaller chunks. This allows you to retrieve the data in smaller chunks instead of having to retrieve all the data at once.
Example using cursors
In this example, we request the page that updated after a specific date and we use the cursor
parameter to paginate the results.
optional parameters
- Name
updated_after
- Type
- string => timestamp in ms
- Description
Only return data updated after this date.
- Name
created_before
- Type
- string => timestamp in ms
- Description
Only return data created before this date.
- Name
created_after
- Type
- string => timestamp in ms
- Description
Only return data created after or at this date.
- Name
cursor
- Type
- string
- Description
The cursor is the _id field of the last item of your last request.
Manual pagination using cURL
curl -G https://api.bob-desk.com/api/v3.0/data \
-H "Authorization: Bearer {token}" \
-d updated_after="1669805251942" \
-d created_after="1669805251942" \
-d cursor="63725f259ab7e72a4fb4ae69"
Paginated response
{
"cursor": "63725f259ab7e72a4fb4ae69",
"data": [
{
"_id": "63725f259ab7e72a4fb4ae69",
// ...
},
]
}