Announcements
Why Use SCAPI
Base URL and Request Formation
Quick Start
Client IP Forwarding
Select Response Properties
Encode Special Characters
SCAPI Specifications
B2C Commerce Release Notes
Ask the Community
Property selectors allow you to set which properties are returned in API responses. You can use them to remove unneeded properties from large responses, reducing their size.
To use property selectors include the select parameter in a request. For example, to select only the name property of getProduct, use the selector select=(name):
1GET /product/shopper-products/v1/organizations/f_ecom_zzte_053/products/25604524M?siteId=RefArch&select=(name)
2
3{
4 "name": "Black Single Pleat Athletic Fit Wool Suit",
5}Selector values must be enclosed in parentheses. The following selectors are supported:
| Capability | Value of select parameter |
|---|---|
| Include a single property. | (property) |
| Exclude a single property. | (-property) |
| Include properties of all levels, including complex properties. | (**) |
| Include properties of top level, except complex properties. | (*) |
| Include the child document properties. | (property.(**)) |
| Return the first document. Index starts with 0. | (property[0].(**)) |
| Return the first 5 documents. | (property[0:4].(**)) |
| Return the second, fourth, and sixth documents. | (property[1,3,5].(**)) |
| Return matching documents matching a condition. | (property[?(@.key==val)]) |
| Return matching documents matching multiple conditions. | (property[?(@.key1==val1) || ?(@.key2=val2)]) |
Use a comma-separated value to select multiple properties. For example, to select name and recommendations including its children, use the selector select=(name,recommendations.(**):
1GET /product/shopper-products/v1/organizations/f_ecom_zzte_053/products/25604524M?siteId=RefArch&select=(name,recommendations.(**))
2
3{
4 "name": "Black Single Pleat Athletic Fit Wool Suit",
5 "recommendations": [
6 {
7 "recommendationType": {
8 "displayValue": "Product Detail Page - Cross Sell",
9 "value": 1
10 },
11 "recommendedItemId": "25686544M"
12 }
13 ]
14}To select child properties, include all result levels. For example, to select the productId of variants, use the selector select=(variants.(productId)):
1GET /product/shopper-products/v1/organizations/f_ecom_zzrf_016/products/25604524M?siteId=RefArch&select=(variants.(productId))
2
3{
4 "variants": [
5 {
6 "productId": "750518699660M"
7 }
8 ]
9}Selectors can also be used to exclude properties. To exclude a property, first include a property. For example, to exclude backorderable from inventory use select=(inventory.(*,-backorderable)):
1GET /product/shopper-products/v1/organizations/f_ecom_zzrf_016/products/25604524M?siteId=RefArch&select=(inventory.(*,-backorderable))
2
3{
4 "inventory": {
5 "ats": 1800,
6 "id": "inventory_m",
7 "orderable": true,
8 "preorderable": false,
9 "stockLevel": 1800
10 }
11}Selectors can be used to filter documents based on one or more conditions. For example, to filter for small and large images use select=(imageGroups[?(@.viewType==small || @.viewType==large)]):
1GET /product/shopper-products/v1/organizations/f_ecom_zzrf_016/products/25604524M?siteId=RefArch&select=(imageGroups[?(@.viewType==small || @.viewType==large)])
2
3{
4 "imageGroups": [
5 {
6 "images": [],
7 "viewType": "large"
8 },
9 {
10 "images": [],
11 "viewType": "small"
12 }
13 ]
14}Property selectors are only supported for a subset of Shopper endpoints. You can check endpoint whether an endpoint supports select by reviewing its query parameters in the API Reference.
Note