Pagination Guide
This API uses LimitOffsetPagination to manage large datasets efficiently. Requesting too much data at once can result in timeouts.
Here's how to interact with it:
Basic Concepts:
Limit: The maximum number of items to return in a single response.
Offset: The starting point from which to retrieve items. This allows you to 'skip' a certain number of items.
Request Parameters:
- limit: (integer, optional) Default: 50. Set the desired number of items per page. The API generally caps limit at 500. For faster responses, ask for less data at a time.
- offset: (integer, optional) Default: 0. Set the starting point for retrieving items.
Example Requests:
Get the first 10 items:
GET /api/endpoint/?limit=10&offset=0
Get the next 10 items (page 2):
GET /api/endpoint/?limit=10&offset=10
Get items 21-30:
GET /api/endpoint/?limit=10&offset=20
Response Structure:
A typical paginated response might look like:
{
"count": 100, // Total number of items available
"next": "/api/endpoint/?limit=10&offset=10", // URL to the next page (if available)
"previous": "/api/endpoint/?limit=10", // URL to the previous page (if available)
"results": [
{ ... }, // Array of items (up to 'limit' items)
{ ... }
]
}
Key Points:
The 'next' and 'previous' fields will be null if there are no more pages in that direction.
Always use the URLs provided in 'next' and 'previous' for navigating through pages. Do not construct them manually.
If you provide a 'limit' that exceeds the maximum allowed limit set by the server, the server will usually cap it to the maximum limit (500).
Not all API endpoints can support large limit sizes. If too much data is requested the API will timeout.
Some APIs might provide additional metadata in the response, like the current page number or the total number of pages. Refer to the specific API documentation for details.
If you encounter any issues or have further questions, please reach out to our support team.
Happy coding!
Updated 4 months ago