skip to main content
Formulating queries : Navigating relationships : $expand query parameter
 

Try DataDirect Cloud Now

$expand query parameter

The examples in this topic use the following table structure:
Customer ---> Order ---> OrderItem
|
---> Contact
The $expand system query parameter allows the related information to be embedded in the response of the parent or child entity. For example, you can obtain a list of customers with a list of all of their orders by issuing the query:
https://service.datadirectcloud.com/api/odata/OracleDS/Customers?$expand=Orders
Each customer entity in the response contains the list of order entities belonging to that customer embedded in the customer entity. Multiple tables can be expanded. The following query returns the list of customer entities; embedded in each customer entity is the list of their orders and the list of contacts for that customer.
https://service.datadirectcloud.com/api/odata/OracleDS/Customers?$expand=Orders, Contacts
DataDirect Cloud currently only allows expanding to one level deep. For example, the following multi-level query, which attempts to expand orders and order items for a customer, is not currently supported:
https://service.datadirectcloud.com/api/odata/OracleDS/Customers?$expand=Orders/OrderItems