Get Offers by Catalog API

The Get Offers by Catalog API provides the ability to retrieve products and promotions that are modeled within the Shared Catalog.

The specified catalog code identifies the catalog that contains offers (products and promotions). You can optionally specify a page size to limit the number of results returned. The sort order of the result is based on the sequence field or another specified field. You can search either by name or description.

The API also supports Get Filtered Products, where offers that contain specified child offers are returned. A response code of 200 indicates a successful call while 400 indicates a failed response.

This API supports both anonymous and logged-in users. You use the isloggedin flag to indicate whether the user is logged in or not.

For known users - that is, when isloggedIn=true and a context is specified - the Get Offers by Catalog API returns a qualification node for each offer. The qualification node indicates whether the qualification rules passed or failed for a given offer. qualificationType: Pass indicates that the offer passed qualification rules, whereas qualificationType: Fail indicates that the offer did not pass qualification rules.

For anonymous users, the API returns only qualified offers and the qualificationType node is not returned. Offers that are not qualified are not returned.

When executing the Get Offers API for anonymous users, Digital Commerce supports the following:

  • Only qualified offers as part of the API response.

  • Base adjustments and overrides.

When executing the Get Offers API for known users, Digital Commerce supports the following:

  • Qualified and unqualified offers in the API response within the qualification node.

  • Base prices, adjustments, and override prices are supported.

Pricing context eligibility rules are not supported for anonymous and known users for Get Offers.

  • The Catalog should have the CatalogCodec field populated. No spaces are permitted in CatalogCodec.

  • Products should have ProductCode populated. No spaces are permitted in ProductCode.

  • Promotions should have Codec populated and no space is allowed in Codec.

  • Catalog should be present with products and promotions attached to it as records under CatalogProductRelationship__c object.

  • Catalog should be attached to a default price list through DefaultPriceListc field on Catalogc object.

  • Price list entries should exist for all the products attached to the catalog.

  • All products present under associated promotions (for a catalog ), must also have a relationship with catalog. Products should be added to Catalog, before adding them to any promotion associated with the catalog.

  • A record should be created under the Vlocity API Metadata object for getOffers API. This can be populated by running a batch job named as LOAD API METADATA which is present under CMT Administration > Cacheable API Jobs.

  • (Optional) To cache records that are associated with the getOffers API you can optionally run the Populate API Cache batch job (located in CMT Administration > Cacheable API Jobs). After populating, context eligibility and pricing records, you can also run the batch job using the following statement: database.executeBatch(new BatchCacheProcessor('getOffers'));

  • Product Eligibility and Availability interface implementations are not supported. The eligibility rules that are supported by the DC APIs are controlled by context rules.

  • Enable Usage Pricing

For API parameter names and descriptions, see Digital Commerce REST API.

For information about returning Product2 or Promotion fields that are not returned by default, see Retrieving Additional Product2 or Promotion Fields.

In the examples that follow, braces around items ( { } ) indicate replaceable parameters that you specify.

Return a list of offers:

The GetOffersByCatalog API supports pagination. The response contains an action named nextOffersAction which contains a REST URL you can use to fetch the products on the next logical page.

Return a list of offers and specify a page size of 20:

Return a list of offers and specify a page size and offset:

Return a list of offers and specify a context:

Context parameters that specify which offers qualify for the end user can be passed to the API.

Return a list of offers and specify multiple contexts:

Sorting is based on fields passed from the Catalog Product Relationship object. Because the offers list contains both products and promotions, the parameter on which to sort the offer list is added to the records of the Catalog Product Relationship object.

Return a list of offers sorted by sequence number:

Return a list of offers sorted by Active status:

Retrieves offers from the specified Catalog (identified by the Catalog Code). Offers can be a product or a promotion. The sortby parameter can sort featured offers first in the result set.

Here are some examples:

Return a list of offers for a logged-in user:

Return a list of offers for a known user and specify a page size of 20:

The rest of the examples are all in the same format as for anonymous users, except that a context is specified and the isloggedIn parameter is set to true.