Expanding Fields
In many endpoints you'll find an expand
query parameter that can be passed to the endpoint. You can use the expand
query parameter to unpack an entity's relations and return them in the response.
Please note that the relations you pass to expand
replace any relations that are expanded by default in the request.
Expanding One Relation
For example, when you retrieve a list of products, you can retrieve their collections by passing to the expand
query parameter the value collection
:
curl "http://localhost:9000/store/products?expand=collection"
Expanding Multiple Relations
You can expand more than one relation by separating the relations in the expand
query parameter with a comma.
For example, to retrieve both the variants and the collection of the products, pass to the expand
query parameter the value variants,collection
:
curl "http://localhost:9000/store/products?expand=variants,collection"
Prevent Expanding Relations
Some requests expand relations by default. You can prevent that by passing an empty expand value to retrieve an entity without any extra relations.
For example:
curl "http://localhost:9000/store/products?expand"
This would retrieve the products with only their properties, without any relations like collection
.