As adoption of Cisco Spark continues to skyrocket, so does the amount of content being shared by team members. We've addressed this in the Cisco Spark APIs by introducing support for pagination.
It would be impractical to return all messages in a busy room, for example. With pagination, the Cisco Spark API returns a specific number of items at a time; allowing your app to request another page as needed.
Cisco Spark's APIs implement the RFC5988 (Web Linking) standard for pagination. When requesting a list of resources the response may contain a
Link header containing the URLs to the first, next, and previous page.
For example, requesting
GET /people?displayName=Harold may return a link header like this one:
Link: <https://api.ciscospark.com/v1/people?displayName=Harold&max=10&before&after=Y2lzY29zcGFyazovL3VzL1BFT1BMRS83MTZlOWQxYy1jYTQ0LTRmZWQtOGZjYS05ZGY0YjRmNDE3ZjU> rel="next"
rel="next" at the end of the line. This tells your app that another page is available and provides the URL to fetch it.
The list of possible relationship types are:
||Link to the next page|
||Link back to the first page|
||Link to the previous page|
Please note that only the
rel="next" link header is guaranteed at this time. We may include other link types, that are defined in the RFC5988 (Web Linking) standard, in the future.
When requesting a list of resources the
max query parameter may be used to control the number of items returned per page. For example, requesting
GET /people?displayName=Harold&max=2 tells the API to return only 2 items per page.
If the requested
max query parameter value exceeds what a particular API endpoint allows, only the maximum number of items allowed per page for that endpoint will be returned. A
rel="next" link header will be present if another page of results is available.