My team recently adopted the json api convention. In the documentation for the api sorting is not addressed.
They do however address filtering in the recommendations page but in my opinion, sorting is not part of filtering since filtering is used to reduce a set while sorting is used to re-order a set.
Given the json api convention, I'd like to know:
You can sort data returned from the REST API endpoints. The “sort” query string key is used to order the data that is returned. To sort data in ascending order, enter the desired property name as query string value. To sort data in descending order, simply precede the desired property name with a minus (-) character.
JSON:API is a specification for how a client should request that resources be fetched or modified, and how a server should respond to those requests. JSON:API can be easily extended with extensions and profiles.
While SOAP and REST are two leading approaches to transferring data over a network using API calls, JSON is a compact data format that RESTful web services can use. Deciding whether you should create a SOAP vs REST API is an essential question if you are planning to provide a web service.
JSON API is a format that works with HTTP. It delineates how clients should request or edit data from a server, and how the server should respond to said requests.
Sorting is actually documented on the website: http://jsonapi.org/format/#fetching-sorting
Short summary:
sort
as the parameter name sort=lastname,forename
sort=-lastname,forname
), the default order is ascendingIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With