Configure which properties of aggregated records and their members are accessible to front end applications
You can configure which properties of aggregated records and their member records are accessible to services such as guidedsearch
(which produces search results) and typeahead
(which controls the typeahead function).
This can reduce the amount of data in the JSON returned by calls to these services. In particular, it can make inaccessible the data that is irrelevant to shoppers or is otherwise sensitive, such as profit margins.
Note: By default, all properties of aggregated records are accessible to services.
To configure which properties are accessible, execute the following endpoint with JSON content that configures which properties are accessible:
PUT /gsadmin/v1/cloud/pages/Default/services/service_name
Where service_name is the name of the service, such as guidedsearch
or typeahead
, whose access to properties is limited by this call.
For example:
PUT /gsadmin/v1/cloud/pages/Default/services/guidedsearch
In the JSON content, list the properties that you want to make accessible, as follows:
- List properties of aggregated records in the
attributes
field of theresultsList
element. These properties hold values such as minimum and maximum prices.fieldNames
is deprecated in this release. - List properties of member records in the
childRecordAttributes
field of theresultsList
element. These properties hold values that shoppers search on, such as names, descriptions, brands, and SKU-level data per product, such as swatches.subRecordFieldNames
is deprecated in this release.ThemaxChildRecords
specifies the number of child records to be returned. This configuration expects an integer from the following list:- 0 (no child records)
- 1 (one child record)
- -1 (all matching child records)
For example, execute the following endpoint with the JSON content shown to cause all
matching SKU level data of member records to be accessible to the
guidedsearch
service:
PUT /gsadmin/v1/cloud/pages/Default/services/guidedsearch
"resultsList": {
"@type": "ResultsList",
"maxChildRecords": -1,
"attributes": ["product.repositoryId", "product.displayName" ],
"childRecordAttributes": [ "product.repositoryId", "sku.repositoryId", "product.displayName",
"sku.listPrice", "sku.activePrice", "product.primaryFullImageURL", "product.route" ]
}
You can see your changes to the configuration of aggregated records in you Preview storefront. To see the changes in your Production storefront, you must first publish the changes.
Note: Setting maxChildRecords
to -1 can impact
performance both in terms of response time and the response payload size. We recommend that
you use attributes
, childRecordAttributes
and
maxChildRecords
together to minimize impact on performance.