Pagination
How to handle collections
A specific set of resources in the API support keyset pagination. Keyset pagination allows a user to navigate through lists of data using only the updated timestamp of the last item in their current dataset. Endpoints that support this type of pagination are asset and contributors.
An example payload from an endpoint that returns paginated results looks like the following.
{
"limit": 50,
"hasNext": true,
"item": [...]
}
Field | Description | Value Type |
---|---|---|
limit | Specified limit for the collection | Number |
hasNext | Flag to indicate there is more data on next page | Boolean |
item | The array of requested objects | Array[Object] |
When a paginated response contains the hasNext true flag a client can use the updatedAfter in the collection as a query parameter to request the next page.
Here is an example of a request for the next page of data.
curl http://tv.api.pressassociation.io/v2/collection?limit=20&updatedAfter=2018-05-05T00:00:00.000Z
The following parameters are optional.
Field | Description | Value Type |
---|---|---|
limit | The limit request parameter | Integer |
updatedAfter | The time from which to start the next page | DateTime |
The following diagram demonstrates an example workflow to retrieve all assets after a specified update time.
Updated about 5 years ago