Overview
Endpoints that return lists of resources support pagination to manage large result sets efficiently. Pagination is implemented using page numbers and page sizes.Pagination Parameters
All list endpoints accept these query parameters:| Parameter | Type | Default | Min | Max | Description |
|---|---|---|---|---|---|
page | integer | 1 | 1 | - | Page number to retrieve |
page_size | integer | 20 | 1 | 100 | Number of items per page |
fkapi/api.py:50-51:
fkapi/api.py:828-829:
Paginated Endpoints
The following endpoints support pagination:GET /api/kits- List kits with filteringGET /api/clubs/{club_id}/kits- Get club kits- Any endpoint that returns a list of resources
Request Examples
Basic Pagination
Get the first page with default page size (20 items):Custom Page Size
Get 50 items per page:Navigate Pages
Maximum Page Size
Get maximum allowed items (100) per page:Response Format
Paginated responses return an array of items. The actual pagination metadata (total count, page info) is not included in the response body but can be inferred from the result count. Fromfkapi/api.py:614-619:
Example Response
Determining End of Results
If a page returns fewer items than the requestedpage_size, you’ve reached the end of the result set:
Pagination with Filtering
Combine pagination with filter parameters:Example: Club Kits with Pagination
Implementation Examples
Python
JavaScript
TypeScript
Pagination Best Practices
For API Consumers
-
Use Appropriate Page Size: Balance between request count and response size
- Small datasets: 20-50 items
- Large datasets: 50-100 items
- Avoid requesting 1-2 items per page (inefficient)
- Implement Pagination Logic: Always handle multiple pages when fetching all data
- Cache Results: Cache paginated results to avoid repeated requests
- Handle Empty Results: Check for empty arrays to detect end of data
- Combine with Filters: Use filters to reduce total result count
Performance Tips
Caching Considerations
Paginated responses are cached for performance. Fromfkapi/api.py:603-604,618:
Error Handling
Invalid Page Number
Requesting a page beyond available results returns an empty array:Invalid Page Size
Page size above 100 is automatically capped at 100:Invalid Parameters
Non-numeric or negative values return validation errors:400 Bad Request