Reputation: 41
Collections return a maximum of 100 records per page, and by default return 100 records per page. How can I change this default value?
Upvotes: 0
Views: 690
Reputation: 41
You can set this on a per request basis by passing e.g. per_page=50 in the request parameters. You iterate the collection by incrementing the page attribute, e.g. page=3. Collections also include links in the response body for easier navigation, generally they are on this structure:
{
"users": [ ... ],
"count": 1234,
"next_page": "https://account.zendesk.com/api/v2/users.json?page=2&per_page=50",
"previous_page": null
}
Stop paging when the next_page attribute is null.
Upvotes: 2