Sorting

Collection APIs support sorting. You can use Field Names for the collection's response to create sorting criteria in the query.

$orderBy=fieldName <direction>

  • Where direction is asc (default) for ascending order or desc for descending order.
  • Multiple sort fields are supported (comma separated).
    • fieldName1 asc, fieldName2 desc

Null values are sorted as if they are larger than any non-null value, meaning they will come last in asc sorts.

If filtering criteria is defined, use the ampersand & to delimit the sort criteria.

$filter=fieldName1 eq 'abc'&$orderBy=fieldName2

If an invalid sort field or direction is provided, the data will be returned with the default sort, as if no sorting was specified.


What’s Next

Did this page help you?