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": [...]
}
FieldDescriptionValue Type
limitSpecified limit for the collectionNumber
hasNextFlag to indicate there is more data on next pageBoolean
itemThe array of requested objectsArray[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.

FieldDescriptionValue Type
limitThe limit request parameterInteger
updatedAfterThe time from which to start the next pageDateTime

The following diagram demonstrates an example workflow to retrieve all assets after a specified update time.

1100

What’s Next