Pagination
The API supports pagination to retrieve a subset of data from a larger dataset. You can adjust the number of results per page and navigate through the available pages.
Adjusting Results per Page
To specify the number of results per page, include the perPage
parameter in the query string of the API endpoint. The maximum value for perPage
is 40, and the default value is 20.
Example:
GET /collection?perPage=30
In this example, the API will return 30 results per page.
Navigating Through Pages
To navigate to a specific page, use the page
parameter in the query string of the API endpoint. The page
parameter represents the page number.
Example:
GET /collection?page=2
In this example, the API will return the results from page 2.
Pagination Metadata
The API response includes pagination metadata in the meta.pagination object. Here are the available properties:
- Name
total
- Type
- Description
- The total number of items across all pages.
- Name
count
- Type
- Description
- The number of items on the current page.
- Name
per_page
- Type
- Description
- The number of items per page.
- Name
current_page
- Type
- Description
- The current page number.
- Name
total_pages
- Type
- Description
- The total number of pages.
Example:
Paginated response
{
"data": [
// Array of data
],
"meta": {
"pagination": {
"total": 100,
"count": 20,
"per_page": 20,
"current_page": 1,
"total_pages": 5
}
}
}