Pagination

Wristband's queryable APIs support server-side pagination.

Server-side pagination reduces data transfer and optimizes resource use. You can paginate query results using thestart_index and count query parameters.

Start Index

The start_index query parameter determines the starting index of the items to be retrieved in the paginated results. This parameter is 1-based, meaning the index count starts from 1.

  • ?start_index=1 retrieves the first page starting from the first item.
  • ?start_index=2 skips the first item and starts from the second.

Count

The count query parameter specifies the number of items per page. For example, ?count=10 means each page will contain 10 items.

Filtering Results (Query)

Filter results using Wristband's query expression language. Refer to the Query Expressions documentation for more details.

Sorting Results (Sort By)

Sort results by attributes using the sort_by query parameter with the syntax:

<sort_attribute>[:(asc|desc)],...

Sort attributes listed earlier have higher priority. For example, ?sort_by=familyName:asc,givenName:desc sorts by familyName first, then by givenName.

Pagination Response Body Structure

The response body includes a list of items matching the query and metadata about the results:

NameTypeDescription
totalResultsIntegerTotal number of results matching the query.
startIndexInteger1-based index of the first result in the current set.
itemsPerPageIntegerPage size of the query.
itemsListList of items/resources matching the query.

Example Response

For the request to the Query Application Users API:

GET https://yourapp-yourcompany.us.wristband.dev/api/v1/users?start_index=1&count=10&sort_by=givenName:desc&fields=id,givenName HTTP/2.0
Accept: application/json

You might see:

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8

{
  "totalResults": 2,
  "startIndex": 1,
  "itemsPerPage": 10,
  "items": [
    {
      "id": "dEHSSoyIQUmHSMAKkfcyOQ",
      "givenName": "Jeff"
    },
    {
      "id": "GKPP6kmHR2GVIzbnlrL5Og",
      "givenName": "Bill"
    }
  ]
}