Pagination
Pagination
List endpoints in the Fenerum API use page-based pagination to help you efficiently retrieve large datasets. By default, each page contains 20 items.
Pagination Parameters
All list endpoints support the following query parameters:
page- The page number to retrieve (default: 1)page_size- Number of results per page (default: 20, max: 100)
Response Format
Paginated responses include these fields:
| Field | Type | Description |
|---|---|---|
count | integer | Total number of items available (across all pages) |
next | string (url), nullable | URL to fetch the next page of results |
previous | string (url), nullable | URL to fetch the previous page of results |
results | array | Array of objects for the current page |
Example Request
GET /api/v1/accounts/?page=2&page_size=50Example Response
{
"count": 247,
"next": "https://app.fenerum.com/api/v1/accounts/?page=3&page_size=50",
"previous": "https://app.fenerum.com/api/v1/accounts/?page=1&page_size=50",
"results": [
{
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"code": "CUST001",
"name": "Example Customer"
}
// ... more results
]
}Iterating Through Pages
To retrieve all items, follow the next URL until it becomes null:
url = '/api/v1/accounts/'
all_accounts = []
while url:
response = requests.get(url, headers=headers)
data = response.json()
all_accounts.extend(data['results'])
url = data['next']Best Practices
- Use appropriate
page_sizevalues based on your needs (smaller for UI, larger for data exports) - Always check the
nextfield to determine if more pages exist - Use filters to reduce the total number of results before paginating
- Cache results when possible to reduce API calls