Without sorting instructions, most collections implement a default sorting strategy, as described in the API Reference.
id, name, etc…
Sorting direction (i.e. “ascending” vs “descending”) is indicated through adding a prefix to the name of the property the sorting should be applied to:
| Direction | Prefix | Example |
|---|---|---|
| Descending | "-" (hyphen) | /employees?sort=-familyName: return employees by descending family name. |
| Ascending | "+" (plus) or "" (nothing) | /leaves?sort=startsOn: return leaves by ascending start date. |
When using the ”+” character, then it must be URL encoded, i.e.:
"%2B"./employees?sort=familyName,givenName returns all employees, sorted by ascending family name THEN by ascending given name. In this case, the “Bros” brothers are returned by ascending first name: ‘Luigi (Bros)’, then ‘Mario (Bros)’.
P.S.: Technically, Mario’s and Luigi’s family name should be “Mario”, but it feels wrong for some reason.