Skip to content

$orderby ​

The $orderby query option sorts the result set.

Syntax ​

GET /odata/Products?$orderby=name asc
GET /odata/Products?$orderby=price desc

Direction ​

DirectionMeaningDefault
ascAscending (A-Z, 0-9)Yes (when omitted)
descDescending (Z-A, 9-0)No
GET /odata/Products?$orderby=name          → ascending (default)
GET /odata/Products?$orderby=name desc     → descending

Multiple sort keys ​

Comma-separated, applied in order:

GET /odata/Products?$orderby=category asc, price desc

Maps to:

sql
ORDER BY category ASC, price DESC

SQL mapping ​

Each $orderby clause maps to an Eloquent/Query Builder ->orderBy($column, $direction) call. Only direct property references are supported — expressions in $orderby are not evaluated.