3
votes

Is it not supported to use $orderby in $expand clause? The following link does not sort the OrderID in reverse order.

http://services.odata.org/V4/Northwind/Northwind.svc/Customers?$select=CustomerID&$filter=CustomerID eq 'ALFKI'&$expand=Orders($select=OrderID;$orderby=$it/OrderID desc)

But it does work without $expand clause like this:

http://services.odata.org/V4/Northwind/Northwind.svc/Orders?$select=OrderID&$orderby=OrderID desc

1
OP your syntax is correct for the protocol, the service you have referenced does not fully implement the specification.Chris Schaller
Does this answer your question? Odata v4 orderby expand webapiChris Schaller

1 Answers

1
votes

This was added in Microsoft.Data.OData v5.8 and isn't supported in the northwind v4 demo at services.odata.org. See the GitHub issue for more details.

NOTE:

http://services.odata.org/V5/Northwind/Northwind.svc is no longer being maintained.
Please refer to the service listing at odata.org for the latest supported OData V4 reference APIs: https://www.odata.org/odata-services/