Both the GET /products
and GET /transactions
REST API endpoints adhere to a standard result set sorting scheme, which can be controlled via the sort
query parameter.
Request Query Parameter:
sort
A comma-separated list of property keys that must match one of the properties of the subject REST resource (product
or transaction
). The property needs to be supported for sorting.
Sorting Order:
The default sorting order is ascending. To sort the result set in descending order, prefix the property key with the -
character before appending to the comma-separated sort list.
- For
string
valued properties, sorting is alphabetical, with ascending order fromA
toZ
- For
numeric
properties, sorting is based on magnitude, with ascending order from-∞
to∞
. This also applies for ISO 8601 UTCdate-time
properties.
Ordering of Sort Keys:
The result set is sorted in the order the keys appear in the comma-separated list that was sent in the sort
query parameter. For example, if ?sort=A,-B,C
are passed, the initial result set is sorted in ascending order against A
, the output of which is sorted in descending order against B
, and the output of the second sort is sorted in ascending order against C
, before returning the final result set.
Properties that Support Sorting:
The properties currently supported for sorting are enumerated under the sort
query parameter in the RESTful API endpoint reference sections for GET /products
and GET /transactions