Pagination
All top-level API resources have support for bulk fetches via "list" API methods. For instance, you can list shipments.
These list API methods share a common structure, taking at least these two parameters: page and perPage. FourKites® utilizes pagination via the page and perPage parameters.
To fetch the first page of entries in a collection, the API needs to be called either without the page parameter or with the page parameter set to 1. The perPage parameter is optional and defaults to 10.
In order to go the next page, increment the page parameter till the value of totalCount / perPage is reached. For example, if totalCount is 100 and perPage is 10, then we can loop the value of page from 1 to 10.
Query Params
The following query parameters are used to paginate a collection.
Query Parameter | Type | Default | Description |
|---|---|---|---|
page | Integer | 1 | This returns the results associated with the given page number. |
perPage | Integer | 10 | The maximum results to be returned by the List API. The minimum value is 1 and the maximum value is 100. |
Pagination Response
When paginating collections, the API returns an object (Response) that contains the set of results as an array, as well as some information about the current page of results.
Response Field | Type | Description |
|---|---|---|
page | Integer | The current page number, out of the total pages available. |
perPage | Integer | The number of results returned by the List API. This is essentially the array length. |
totalCount | Integer | The total count of results present across all pages. |
