Using Manage API Pagination
In FoxNose CMS, pagination is utilized to manage large datasets when retrieving lists of resources via the API. This ensures efficient data transfer and improves performance by limiting the amount of data returned in a single request.
When a list endpoint supports pagination, the response will be structured as follows:
Paginated response
{
"count": 22,
"next": "https://api.foxnose.net/.../folders/?limit=10&offset=10",
"previous": null,
"results": [
{
// Item data
}
// Additional items
]
}
Pagination Response Structure
- Name
count
- Type
- integer
- Description
The total number of items available across all pages.
- Name
next
- Type
- string null
- Description
The URL to the next page of results, or null if there are no more pages.
- Name
previous
- Type
- string null
- Description
The URL to the previous page of results, or null if you are on the first page.
- Name
results
- Type
- array
- Description
An array containing the actual data items returned for the current page.
Pagination Query Parameters
You can control the pagination of list endpoints using the following query parameters:
- Name
limit
- Type
- integer
- Description
Specifies the maximum number of items to return in the response. The maximum allowed value is 100. If not specified, a default limit is applied.
- Name
offset
- Type
- integer
- Description
Specifies the starting position within the total set of available items. Use this to skip a certain number of items.
Example
GET https://api.foxnose.net/7c9h4pwu/folders/?limit=20&offset=40
This request would return items 41 to 60 from the total set.
Default Behavior
By default, all list endpoints in FoxNose CMS return paginated responses unless otherwise specified in the documentation for a specific method. If you do not provide any pagination parameters, default values for limit and offset will be used.
Maximum Limit
To ensure optimal performance and prevent excessive data transfer, the maximum number of items that can be returned in a single request is capped at 100. If you request a higher limit, it will automatically be reduced to 100.
Navigating Pages
Use the next and previous URLs provided in the response to navigate through the pages of results. These URLs already include the appropriate limit and offset parameters for the next or previous set of items.
Examples
1. Retrieve the first page of results with default settings:
GET https://api.foxnose.net/7c9h4pwu/folders/
2. Retrieve a specific page of results:
GET https://api.foxnose.net/7c9h4pwu/folders/?limit=50&offset=150
This request retrieves 50 items starting from the 151st item.
3. Navigate to the next page using the next URL
After making a request, use the next field from the response:
"next": "https://api.foxnose.net/7c9h4pwu/folders/?limit=50&offset=200"
Notes
- Consistency: The count value remains constant across pages unless items are added or removed from the dataset.
- Data Integrity: When paginating through results, be aware that underlying data may change between requests if items are being added or deleted.