Pagination

Pagination is useful when multiple results are returned.

All REST APIs in PubSub+ Cloud support pagination. For example, here is what the pagination response looks like:

{
  "data": [...],
  "meta": {
  "pagination": {
        "pageNumber": 1,
        "count": 23,
        "pageSize": 20,
        "nextPage": 2,
        "totalPages": 2
        }
    }
}

All responses include pagination information in the meta block in the pagination object:

  • count—The total number of elements available across all pages.
  • pageNumber —The current page number being returned with the first page specified as 1.
  • pageSize—The page size requested by the user or the default page size.
  • nextPage—The next page that is available with results. A value of null is returned if there are no other pages.
  • totalPages—The total number of pages, which is the pageSize divided by count.

The REST APIs in PubSub+ Cloud can accept pageSize and pageNumber as query parameters. Each query parameter is delimited by an ampersand (&). By default, a GET operation returns the first page if no query parameters are specified.