Sorting

JSON API Sorting allows you to sort the results produced by your API according to one by passing one or more criteria to your request using the sort parameter.

Before continuing please note that the default sort order for each field is ascending UNLESS the field is prefixed with a hyphen (-) in which case the sort order will be descending.

Single Field Sorting

To sort by a single field using ascending order:

/currencies?sort=code

To sort descending:

/currencies?sort=-code

Multi Field Sorting

To sort by multiple fields simply pass comma-separated sort fields in the order you want them applied:

  • /currencies?sort=code,name
  • /currencies?sort=-code,name
  • /currencies?sort=-code,-name
  • /currencies?sort=name,code

Combined Sorts

CrudJsonApi supports any combination of the above sorts. E.g.

  • /currencies?include=countries&sort=name,countries.code
  • /currencies?include=countries&sort=name,-countries.code
  v: stable
Versions
latest
stable
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds
Downloads
On GitHub
View
Edit

Free document hosting provided by Read the Docs.