Sorting¶
You can sort results using the query string parameter named “sort”
Note
Examples are not URL encoded for better readability
Example:
GET /persons?sort=name HTTP/1.1
Accept: application/vnd.api+json
Multiple sort¶
You can sort on multiple fields like this:
GET /persons?sort=name,birth_date HTTP/1.1
Accept: application/vnd.api+json
Descending sort¶
You can in descending order using a minus symbol, “-“, like this:
GET /persons?sort=-name HTTP/1.1
Accept: application/vnd.api+json
Multiple sort + Descending sort¶
Of course, you can combine both like this:
GET /persons?sort=-name,birth_date HTTP/1.1
Accept: application/vnd.api+json