Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Odata - nested $select and $expand [duplicate]

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?

like image 468
VladL Avatar asked May 18 '15 15:05

VladL


1 Answers

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))

like image 53
VladL Avatar answered Sep 29 '22 14:09

VladL