Get Offer Details API
This API retrieves detailed information about a specific offer (either product or promotion). The API returns the full hierarchy of a product or promotion as defined in the product catalog.
The API response is created from the pre-cached results present in the sObject (current caching layer). The API also handles cache misses. Along with returning the offer detail, the API caches the data for future requests. Prices, adjustments, and overrides are returned along with offers. The API does not use the Salesforce ID as part of the request and response parameters.
Get Offer Details API supports cross-catalog basket and cart operations when products belong to different catalogs but have the same price list.
This API supports the isloggedin flag to indicate whether a user is logged in or anonymous. If the isloggedin flag is true, it indicates a logged-in user, and an accountId must be specified in the context parameter of the API call. If the isloggedin flag is false, it indicates that the user is anonymous.
When executing the Get Offers Details API for anonymous users, Digital Commerce supports the following:
-
Base adjustments, overrides, monthly recurring charges, and non-recurring charges.
-
Product context eligibility rules are not supported for anonymous and known users for Get Offer Details.
-
Starting in CME Spring '22, Digital Commerce supports retrieving usage-based price. When creating a pricing element for usage-based pricing, the usage quantity is defaulted to 1 and you must specify the associated unit of measure.
When executing the Get Offers Details API for known users, Digital Commerce supports the following:
-
Pricing context eligibility rules by tightest match in the API response.
-
Base adjustments, overrides, monthly recurring charges, and non-recurring charges.
-
Starting in CME Spring '22, Digital Commerce supports retrieving usage-based price. When creating a pricing element for usage-based pricing, the usage quantity is defaulted to 1 and you must specify the associated unit of measure.
See Get Offer Details API and Digital Commerce REST API.
-
Anonymous users: Context eligibility rules and qualification rules for products and promotions are not supported.
-
Known users: Context Eligibility Rules rules and Qualification Rules for Price Lists are supported.
-
No advanced rules are supported.
-
Catalog should have CatalogCodec populated and no space is allowed in CatalogCodec.
-
Products should have ProductCode populated and no space is allowed 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.
-
A record should be created under Vlocity API Metadata object for getOfferDetails API; this can be populated by running a batch job named as
LOAD API METADATA
, which is present under CMT Administration → Cacheable API Jobs. -
To cache records related to the getOfferDetails API, run the batch job named Populate API Cache.
Another way is to run the job is through anonymous block using the following statement (After populating, context eligibility and pricing records):
database.executeBatch(new BatchCacheProcessor('getOfferDetails'));
-
Create a custom setting called CacheAPIFields with a value of true. CacheAPIFields is not required for CME 103.1.14 and later versions.
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.
For detailed API response descriptions, see Digital Commerce REST API.
GET /v3/catalogs/{catalog_code}/offers/{offer_code}
In the examples below, substitute your own values for the following parameters:
-
myCatalog = Catalog Code
-
myOfferCode = Offer Code
-
myPromotion = Promotion Code
-
account - account_ID
Example: Retrieve a list of offers for a specified product:
Example: Retrieve offer details about a specific promotion:
Example: Retrieve a list of offers for a specified product:
Example: Retrieve offer details about a specific promotion:
Get Offer Details API supports cross-catalog operations when products belong to different catalogs but have the same price list. You can add offers to the baskets from different catalogs having the same price lists. For example, in the following table, there are two catalogs having products belonging to the same price lists. If you make the cross call, the GetOfferDetails
API returns a successful response, getting the details of the offers when called using different catalogs to which they belong.
Catalog | Products |
---|---|
Catalog 1 | Product 1 |
Catalog 2 | Product 2 |
Full product responses received for GetOfferDetails call to:
- /services/apexrest/vlocity_cmt/v3/catalogs/Catalog1/offers/Product2
- /services/apexrest/vlocity_cmt/v3/catalogs/Catalog2/offers/Product1