By default, query results are sorted by ID in descending order. This is always reverse chronological, i.e. from the newest to the oldest record. Custom sorting can be configured with the sort
query parameter.
Sorting on a property uses ascending order by default. For example, the following query would return locations sorted by label in alphabetical order:
GET /api/locations?sort=label
Adding a minus sign in front of a property changes the sorting order to descending. For example, the following query would return locations sorted by label in reverse alphabetical order:
GET /api/locations?sort=-label
It is also possible to specify multiple sorting levels using a comma separated list. For example, the following query would return items sorted by technology ascending, and by code descending for items with the same technology:
GET /api/items?sort=technology,-code_hex
Comments
0 comments
Article is closed for comments.