1 Pagination

Many API methods that produce a list of results rely on pagination to break the returned data into discrete chunks. Client developers can make use of pagination to load small chunks of data at a time. For example, a client application may load only the most recent page of messages in a space, loading older pages as a user scrolls up.

There are 2 different pagination implementations used in Avaya Spaces, the API reference of the endpoint will specify which pagination implementation is used. The first is:

NameDescriptionLocationRequired
sizeThe number of results to return.QueryYes
pageThe page number to return.QueryYes

The second implementation is:

NameDescriptionLocationRequired
sizeThe number of results to return.QueryYes
pagerefReadonly. This parameter is not used by Spaces and is only a reference. i.e.: the value sent will be the same value returned.QueryNo
nextRefObjIdThe ObjectId of the last object in the results returned. The next page results will be the ones following this object.QueryYes
prevRefObjIdThe ObjectId of the first object in the results returned. The previous page results will be the ones before this object.QueryYes
pageTokenA reference token generated by the server to query next or previous page.QueryYes

Note: When the first implementation is used, the response payload will include the properties: from and to, whereas with the second implementation the property total is returned.

from
The index (starts at 0) of the first item in the results with respect to all the results not just the ones returned in the current page.
to
The index (starts at 0) of the last item in the results with respect to all the results not just the ones returned in the current page.
total
The total results returned in the current response page.

These API methods will return a URL for the next page of results and the previous page of results, within the return data object, under the keys "nextPageUrl" and "previousPageUrl" respectively. This is done so that the client doesn't have to tinker with the query parameters directly, but can use these returned URLs for pagination.

The typical envisioned use case is that the client first calls the method with just the "size" query parameter specified. This will return the first page of results, as well as the nextPageUrl. To access the next page of results, the client simply makes a request to the nextPageUrl, and from there the process continues.

Thus, as a developer, the only parameter you must really concern yourself with is "size", the number of results returned per page.