Search, Sort, and Pagination for the Stratosphere API
Searching, sorting, and pagination allow you to trim down the returned data, allowing you to focus on the data you only need.
Search, sort, and paginate large result sets by defining their values in a query string appended to the URL. The details for searching, sorting, and pagination are outlined in examples below.
A variety of comparison operators are available for use with search, depending on the data type of the property being searched.
Comparison operators:
- Not/Exclude: !
- Equals: eq
- Not Equals: neq
- Greater Than: gt
- Greater Than or Equal: gte
- Less Than: lt
- Less Than or Equal: lte
- Contains: like
- Does Not Contain: notlike
Which comparison operators can be used with each data type:
- Category: Date/Time Data Type: DateTime
- Comparison Operators: eq, !, neq, lt, lte, gt, gte
- Category: Date/Time Data Type: String
- Comparison Operators: eq, neq, !, notlike
- Category: Numeric Data Type: Numeric
- Comparison Operators: eq, !, neq, lt, lte, gt, gte
- Category: Numeric Data Type: String
- Comparison Operators: eq, !, neq, like, notlike
- Category: String Data Type: String
- Comparison Operators: eq, neq, !, notlike
Example:
Search for all items with an expirationDate greater than Feb. 1, 2022.
Sorting allows you to sort return data in ascending or descending order for a property. To sort, append asc or desc to a property. If neither is defined, ascending order is the default.
Example:
Sort all devices by deviceSerialNumber in descending order.
Define pagination by using the PerPage and Page parameters. PerPage dictates how many results display on one page, and Page dictates which page is displayed.
Example:
Retrieve all products, group them in pages of 5 products each, and display page 2.
Searching, sorting, and pagination can be combined using an ampersand (&) between each parameter.
Example:
Retrieve all removed transactions, sort them in ascending order by eventTime, group them in pages of 10 transactions each, and display page 3.