Skip to content

Latest commit

 

History

History
49 lines (29 loc) · 887 Bytes

sorting.rst

File metadata and controls

49 lines (29 loc) · 887 Bytes

Sorting

.. currentmodule:: flask_rest_jsonapi

You can sort results with querystring parameter named "sort"

Note

Examples are not urlencoded for a better readability

Example:

GET /persons?sort=name HTTP/1.1
Accept: application/vnd.api+json

Muliple sort

You can sort on multiple fields like that:

GET /persons?sort=name,birth_date HTTP/1.1
Accept: application/vnd.api+json

Descendant sort

You can make desc sort with the character "-" like that:

GET /persons?sort=-name HTTP/1.1
Accept: application/vnd.api+json

Muliple sort + Descendant sort

Of course, you can combine both like that:

GET /persons?sort=-name,birth_date HTTP/1.1
Accept: application/vnd.api+json