Sorting
To get data already sorted by one or more field (ascending or descending)
Sorting can be use bot in GET All Data or Pagination strategies. It is extremely useful for paginated APIs because for example you can start reading by name, or by date (ex: lastUpdate) and so on.
They can also be used in combination with Filters
Request
Endpoint
{entity} is the Entity name according to the name provided in the schema
{field} is the name of the field to order by. If you want to sort ASCENDING simply use the field name, but if you want to sort DESCENDING prefix the field name with a minus -
Remember: you can use sorting with Filters and Pagination
Examples
Lets take a look by using some examples and the following schema:
DATE ASCENDING ORDER
And filtered by status SHIPPED, getting the first page with a page size of 20 records
DATE DESCENDING ORDER (note the minus - before the field name)
And filtered by status RECEIVED, getting the first page with a page size of 20 records
Last updated