Pagination¶
All top-level API resources support bulk fetch via the "list" API methods.
For instance, you can list tenants, resources, and available backup policies.
These list API methods share a common structure, taking at least two parameters - limit and page_token - and returning next_page_token.
The limit parameter defines how many objects should be returned per single API call.
Note that the specific number of objects returned may differ from the requested number and can be smaller than requested.
Also, in some cases the limit parameter can be ignored altogether, usually when an inappropriate limit value is passed (e.g., limit = 0).
You should never assume that all the objects have been listed until the next_page_token value returned by the request is empty.
The page_token parameter defines a starting point in listing and allows you to continue listing from the last returned object by a previous API call identified by the next_page_token response value.
Example¶
When making a GET request to a paginated endpoint https://papi.afi.ai/api/v1/applications/me/installations, you receive a response similar to this:
To get the next page of results, take the next_page_token value from the response body and provide it as the value of the page_token key in a query to the same endpoint: