OCAPI property selection 20.4

Property selectors reduce the number of resource properties retrieved by the API, so you can get only those properties you care about, while reducing network bandwidth.

You can specify property selectors for all resource types; to do so, you set the select parameter on the request. The actual selector value must be enclosed within parentheses. The following table lists the different capabilities of property selectors for different select parameter values:

Capability Value of select parameter
Include properties of all levels, including complex properties. (**)
Include properties of top level, except complex properties. (*)
Include a single property. (price) (+price)
Exclude a single property. (-price)
Include the child document properties. (variation_attributes.(**))
Return only the first document in array. Index starts with 0. (variation_attributes[0].(**))
Return only the first 5 documents in array. Index starts with 0. (variation_attributes[0:4].(**))
Return only the second, fourth and sixth document in array. Index starts with 0. (variation_attributes[1,3,5].(**))
Return only documents in array that match the filter. Filter expression syntax is '?(boolean_expression)'. Supported Operators: '==', '!=', '<=', '>=', '<', '>' (variation_attributes[?(@.name=='color')].(**))
Filter expression can be OR ('||') and AND ('$amp;&') combined. (variation_attributes[?(@.name=='color' && @.id=='size')].(**))

You can specify a single property name or a comma-separated list of property names enclosed by parentheses. The following example shows how you can select the name, id, and variation_attributes properties of the product resource instance:

GET /dw/shop/v20_4/products/123/variations?select=(name,id,variation_attributes.(**)) HTTP/1.1
Host: example.com
Accept: application/json

HTTP/1.1 200 OK
Content-Length: 29
Content-Type: application/json; charset=UTF-8

  "_v" : "20.4",
OCAPI obsolete versions 13.x and 14.x will be end of life in 2020 and versions 15.x and 16.x in 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.
X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.