Use $expand to request optional aggregate information in a Catalog API response.
On supported Product and Category reads, $expand adds the number of related items. It does not embed those items in the response.
$expand is not documented in the current DAM OpenAPI specification.
Use $expand when an integration needs a relationship count without retrieving the related records. The values and response fields differ by resource:
| Resource | $expand value | Count field added |
|---|---|---|
| Products | Variants | Variants@count |
| Products | Categories | Categories@count |
| Categories | Products | Products___count |
| Categories | SubCategories | SubCategories___count |
Check the endpoint reference for the values supported by the operation you call. Variants and Custom Entities have no supported related-item expansion; an unsupported value returns 400 Bad Request.
$expand=Variants
$expand=ProductsExample:
GET https://api2.saleslayer.com/catalog/Products?$select=prod_ref,prod_title&$expand=Variants
GET https://api2.saleslayer.com/catalog/Categories?$select=cat_ref,cat_title&$expand=Products$expand=Variants adds Variants@count to each Product; it does not return the variant records.
To retrieve the variants associated with a specific product, use the Filter Product Variants endpoint:
GET https://api2.saleslayer.com/catalog/Products({productIdentifier})/Variants?$select=frmt_ref&$top=20Replace {productIdentifier} with the product identifier. You can use the supported query parameters on that endpoint, such as $select, $filter, $orderby, $top, $skip, and $skipToken, to shape and paginate the returned Variant collection.
Supported expansions depend on the resource and endpoint. Check the OpenAPI reference for each operation before using $expand.
For Products and Categories, use the values in the table above. Request related records through their own collection endpoints when you need the items themselves.
- Expansion is optional. Omit it when you do not need the related-item count.
$expandrequests counts only; it does not include the related collection.- Combine
$expandwith$selectand pagination where appropriate.