Use the example SDK code in this topic to obtain catalog offers with the contains parameter.
// Instantiate the input object for getOffers to specify parameters
const input = digitalCommerce.createGetOffersInput();
input.catalogCode = "Phones"; // use your Catalog Code
input.offset = 0; // use for pagination - optional
input.pageSize = 5; // use for pagination - optional
input.contains = "iPhone8"; // find all offers that CONTAIN "iPhone8" - optional
input.customFields = ["customAttribute__c"]; // optional field which returns custom fields for given keys
input.secureApiCall = false; // set to true if needs secure api calls without context parameters and session key.
// Invoke GetContainsProducts API via method getOffers()
digitalCommerce
.getOffers(input)
.then(result => {
Logger.info("vlocity get offers anonymous user rest call" + result);
})
.catch(error => {
Logger.info("get offers anonymous user rest call failed" + error);
});
Possible error conditions:
"GetOffersInput::getAPIPath() must have catalogCode."
"GetOffersContainsInput::getAPIPath() should not have both sortBy and contains."
"GetOffersInput::getAnonymousRestUrl() must have catalogCode."
"GetOffersContainsInput::getAnonymousRestUrl() should not have both sortBy and contains."