Sorting
Issue
Should the standard define any sorting mechanisms for the API endpoints? If so, should we allow users to sort by all attributes or just a subset?
JSON:API recommends sorting parameters to be used as follows:
- Ascending:
/events?sort=startDate - Descending:
/events?sort=-startDate(note the - before the attribute name) - Multiple attributes:
/events?sort=startDate,endDate - Based on relationship attribute:
/events?sort=organizers.name
NOTE: this decision depends on the pagination strategy we choose (discussed in alpha-discussion#24). If we opt to use page numbers or offsets, we adopt any sorting mechanism we want. If we opt for a cursor-based approach, sorting must be fixed, as it is required to define the cursors.
Proposal
In the previous members' meeting (17/10/2019), the group discussed the possibility of not including any customizable sorting mechanism in the first release of the standard. The only thing that servers should do is to sort their responses by a given attribute by default.