Use Case
When returning information relating to sessions or facilities, there are several common sorts:
- Distance from location.geo
- startDate
- offers[0].price (low to high, high to low)
References
sort=key1:asc,key2:desc,key3:asc - OpenStack
- Extensible, and consistent with the filtering approach
sort_by=-last_modified,+email - Moesif, Haufe-Lexware, Zalando
- Lacks extensibility, as available sort orders are limited by characters
sort=foo,bar desc - Google, Microsoft, OData
sort_by=desc(last_modified),asc(email) - Moesif
() pattern not used elsewhere
sort=rating,reviews,name&desc=rating,reviews - Octo
- Overall ordering of fields in sort not clear
sort=date_of_birth|asc,zip_code|desc - PayPal
| character not used elsewhere
Proposal
As with filtering, the OpenStack approach appears to be the most user-friendly and explicit, as it strikes the best balance between extensibility and familiarity.
Example
- Distance from location.geo
sort=location.geo:nearest
- startDate
- orders[0].price (low to high, high to low)
sort=offers.price:asc (allows the implementation to flex to take intro account multiple offers and multiple currencies)
sort=offers.price:desc (allows the implementation to flex to take intro account multiple offers and multiple currencies)
Use Case
When returning information relating to sessions or facilities, there are several common sorts:
References
sort=key1:asc,key2:desc,key3:asc- OpenStacksort_by=-last_modified,+email- Moesif, Haufe-Lexware, Zalandosort=foo,bar desc- Google, Microsoft, ODatasort_by=desc(last_modified),asc(email)- Moesif()pattern not used elsewheresort=rating,reviews,name&desc=rating,reviews- Octosort=date_of_birth|asc,zip_code|desc- PayPal|character not used elsewhereProposal
As with filtering, the OpenStack approach appears to be the most user-friendly and explicit, as it strikes the best balance between extensibility and familiarity.
Example
sort=location.geo:nearestsort=startDate:ascsort=offers.price:asc(allows the implementation to flex to take intro account multiple offers and multiple currencies)sort=offers.price:desc(allows the implementation to flex to take intro account multiple offers and multiple currencies)