Pagination Guide
When working with endpoints that return a large set of data, the EasyWeek API supports pagination to help you manage and navigate through results efficiently. This guide provides an overview of how pagination works in the EasyWeek API.
Understanding Pagination
Pagination divides a large set of data into smaller, manageable parts or pages. This approach is beneficial for optimizing performance and reducing the amount of data transferred in each API response.
Pagination Parameters
The following parameters are commonly used for pagination in EasyWeek API requests:
page: Specifies the page number you want to retrieve.per_page: Defines the number of items to include per page.
Example:
GET /api/public/v2/endpoint?page=2&per_page=10
This request fetches the second page of results, with 10 items per page.
Paginated Endpoints
Not all endpoints support pagination. Refer to the documentation for specific endpoints to determine if pagination is available and how to use it.
Response Format
A paginated response typically includes information about the current page, total number of items, and the number of items per page. Here's an example:
{
"data": [
// ... paginated items ...
],
"meta": {
"current_page": 1,
"total": 1,
"per_page": 15,
"from": 1,
"to": 1,
"last_page": 1,
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://my.easyweek.io/api/public/v2/locations?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next »",
"active": false
}
],
"path": "https://my.easyweek.io/api/public/v2/locations"
}
}
current_page: The current page number within the paginated results.total: The total number of items across all pages.per_page: The number of items per page, indicating how many items are displayed in a single page.from: The index of the first item on the current page.to: The index of the last item on the current page.last_page: The total number of pages available.data: An array containing the paginated items for the current page.
Next Steps
Now that you understand how pagination works in the EasyWeek API, you can effectively navigate through large sets of data when making requests. If you have any questions or need assistance, feel free to contact our support team.