Nested Resources
The with
parameter allows you to modify your API request with additional criteria.
Many resources allow you to request additional information as a nested resource by using the with
request parameter. This parameter is available on all Customer Account API requests and applies the requested additional resources to the response.
By default, a Customer Account API response will only contain the requested resource. If you want to include additional resources in the response, you have to explicitly define their names in the with
parameter.
The 'With' Parameter
Parameter | Type | Details |
---|---|---|
with | String | Comma-separated list of resource names to include. |
Basic Usage
You can include resources by specifying them as comma separated lists. For example, setting the with
parameter to images, variants
on a product will include all images and variants in the response.
Recursive Usage
You can include nested resources recursively by specifying nested fields after a dot. For example, setting the with
parameter to images.attributes,variants.attributes
on a product will include all images and variants with their attributes in the response.