$expand query parameter
- Last Updated: March 6, 2025
- 1 minute read
- Hybrid Data Pipeline
- Version 4.6
- Documentation
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://<myserver>:<port>/api/odata4/OracleDS/Customers?$expand=OrdersEach 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://<myserver>:<port>/api/odata/OracleDS/Customers?$expand=Orders, ContactsHybrid Data Pipeline 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://<myserver>:<port>/api/odata4/OracleDS/Customers?$expand=Orders/OrderItems
For OData 4 users, the results of the $expand query
parameter can be refined by using $select, *, $filter, and $top system query options. For example, the following query
returns the entity Price in addition to the entities
related to Orders.
https://<myserver>:<port>/api/odata4/OracleDS/Customers?$expand=Orders($select=Price)