Odata - nested $select and $expand

VladL picture VladL · May 18, 2015 · Viewed 17.9k times · Source

http://services.odata.org/V4/Northwind/Northwind.svc/

I'm trying to get all Customers, their Orders and corresponding Order_Details at once and using nested $expand for that. To query the data I'm using following link: http://services.odata.org/V4/Northwind/Northwind.svc/Customers?$expand=Orders($expand=Order_Details)

Now I'm trying to limit the data using $select. The problem is that I can not find the proper syntax to use $select for the middle table - Orders. I can apply it just to the top table - Customers and to the bottom one - Order_Details like this:

http://services.odata.org/V4/Northwind/Northwind.svc/Customers?$select=CustomerID&$expand=Orders($expand=Order_Details($select=UnitPrice))

Is it possible to use $select also for tables in between, in my case for Orders?

Answer

VladL picture VladL · May 19, 2015

Thanks @nlips for his comment.

It is possible to use $select for the middle table by just separating select and expand with semicolon:

http://services.odata.org/V4/Northwind/Northwind.svc/Customers?$select=CustomerID&$expand=Orders($select=OrderID;$expand=Order_Details($select=UnitPrice))