The Offer Details API takes an offer's ID as input and populates its details in the cache. The entry contains information about the product, such as its hierarchy, price-keys, attribute details, etc. You must execute this API for each product offerId that you received in the response from the Catalog Profile API.
You can obtain the offerId required in the URI of this API from the combined result of the apiResponse.data.catalogProductRelationDetails.Product and apiResponse.data.catalogProductRelationDetails.Promotion nodes in the response body of the Catalog Profile API.
Precondition
You must first run the Catalog Profile API to obtain the offerId required in the request body of this API.
URI
/services/apexrest/{namespace}/v3/admin/catalogs/{catalogCode}/offers/{offerId}/offerdetails
HTTP Method
POST
URI Parameters
If you specify just one of these two parameters, it follows the behavior described in the table below and accepts your defined time for the parameter you specified. If you are using one or both parameters, you must specify them with the same values for all of the Populate Cache APIs in this sequence.
| Parameter | Example | Default | Optional/Required | Notes |
|---|---|---|---|---|
| effectiveStartTime | 2001-07-04T12:08:56 | Current date and time | Optional | effectiveStartTime is the time that you want your cached catalog entries to be effective. It should be in the UTC date-time format. Your effectiveStartTime must occur after the current time for which you are executing the Populate Cache APIs or you will receive an error message. |
| expirationTime | 2001-07-04T12:08:56 | effectiveStartTime + TimeToLive | Optional | expirationTime is the time that you want your cached catalog entries to expire. It should also be in the UTC date-time format. Your expirationTime must occur after your effectiveStartTime or you receive an error message. TimeToLive is a custom setting created in CPQ Configuration Setup. It has a default value of 30 days. |
Here is an example of how to pass the URI parameters:
GET /services/apexrest/vlocity_cmt/v3/admin/catalogs/AS-Test-Catalog/offerdetails?effectiveStartTime=2021-07-04T12:08:56&expirationTime=2021-08-04T12:08:56
Remote API
This is an example of how you invoke the API using Apex:
String methodName;
String requestBodyJSON;
Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();
// Setting remote parameters
methodName = 'getOfferDetails';
input.put('apiName', 'CMOfferDetails'); // required
input.put('methodName', methodName); // required
input.put('catalogCode', 'TestCatalog'); // required
input.put('offerId', '01t4x000000x269AAA'); // required
input.put('effectiveStartTime', null); // optional
input.put('expirationTime', null); // optional
input.put('requestURL', '/v3/admin/catalogs/{catalogCode}/offers/{offerId}/offerdetails'); //required
//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
Parallel Invocation
You can run this API in parallel for multiple offers. For example, if there are 10 catalogs (Catalog1, Catalog2..Catalog 10) and each catalog has 100 offers, you can run this API for all 1,000 offers in parallel threads.
THREAD1 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offers/offer1/offerdetails
THREAD2 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offers/offer2/offerdetails
......
THREAD100 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offers/offer100/offerdetails
THREAD101 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog2/offers/offer101/offerdetails
......
THREAD1000 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog10/offers/offer1000/offerdetails
HTTP Headers
| Header | Description |
|---|---|
| Content-Type | application/json |
Response Body
This example contains an offer and its associated details.
{
"offerDetails": {
"offer": {
"offerType": "Promotion",
"childProducts": [
{
"priceKeys": [
"01t5g000002vVZPAA2;;;a3D5g000000HAiNEAW",
"01t5g000002vVZPAA2;;a3T5g000000CvgkEAC;a3D5g000000HAiNEAW"
],
"IsActive": true,
"pr_dc_002__IsOrderable__c": true,
"pr_dc_002__EndOfLifeDate__c": null,
"pr_dc_002__SellingEndDate__c": null,
"pr_dc_002__SellingStartDate__c": null,
"Description": null,
"Id": "01t5g000002vVZPAA2",
"AttributeCategory": {
"records": [
{
"productAttributes": {
"records": [
{
"userValues": null,
"values": [
{
"disabled": false,
"readonly": false
}
],
"isNotTranslatable": false,
"cloneable": true,
"hidden": false,
"hasRules": false,
"displaySequence": 1,
"label": "DateForBuyBack2",
"attributeId": "a0X5g000000GZNkEAO",
"filterable": true,
"disabled": false,
"readonly": false,
"required": false,
"multiselect": false,
"cacheable": true,
"inputType": "date",
"dataType": "date",
"code": "DateForBuyBack2"
},
{
"userValues": null,
"values": [
{
"disabled": false,
"readonly": false
}
],
"isNotTranslatable": false,
"cloneable": true,
"hidden": false,
"hasRules": false,
"displaySequence": 1,
"label": "DateTimeForDelivery2",
"attributeId": "a0X5g000000GZNlEAO",
"filterable": true,
"disabled": false,
"readonly": false,
"required": false,
"multiselect": false,
"cacheable": true,
"inputType": "datetime",
"dataType": "datetime",
"code": "DateTimeForDelivery2"
}
],
"totalSize": 2
},
"id": "a0W5g0000009UidEAE",
"Name": "BASIC",
"Code__c": "BASIC",
"displaySequence": 1
},
{
"productAttributes": {
"records": [
{
"userValues": null,
"values": [
{
"displaySequence": 1,
"defaultSelected": false,
"value": "false",
"disabled": false,
"readonly": false,
"label": "false",
"name": "8a8b4ef3-765a-6933-b99a-8d64dc2194a0",
"id": "8a8b4ef3-765a-6933-b99a-8d64dc2194a0"
},
{
"displaySequence": 2,
"defaultSelected": false,
"value": "true",
"disabled": false,
"readonly": false,
"label": "true",
"name": "34c72160-5234-5a70-432b-e2382fcae4f5",
"id": "34c72160-5234-5a70-432b-e2382fcae4f5"
}
],
"isNotTranslatable": false,
"cloneable": true,
"hidden": false,
"hasRules": false,
"displaySequence": 1,
"label": "IsValueForMoney2",
"attributeId": "a0X5g000000GZNmEAO",
"filterable": true,
"disabled": false,
"readonly": false,
"required": false,
"multiselect": false,
"cacheable": true,
"inputType": "dropdown",
"dataType": "text",
"code": "IsValueForMoney2"
},
{
"userValues": null,
"values": [
{
"disabled": false,
"readonly": false
}
],
"isNotTranslatable": false,
"cloneable": true,
"hidden": false,
"hasRules": false,
"displaySequence": 1,
"label": "Networth2",
"attributeId": "a0X5g000000GZNnEAO",
"filterable": true,
"disabled": false,
"readonly": false,
"required": false,
"multiselect": false,
"cacheable": true,
"inputType": "number",
"dataType": "currency",
"code": "Networth2"
},
{
"userValues": null,
"values": [
{
"disabled": false,
"readonly": false
}
],
"isNotTranslatable": false,
"cloneable": true,
"hidden": false,
"hasRules": false,
"displaySequence": 1,
"label": "LikelhoodOfRecommendation2",
"attributeId": "a0X5g000000GZNoEAO",
"filterable": true,
"disabled": false,
"readonly": false,
"required": false,
"multiselect": false,
"cacheable": true,
"inputType": "number",
"dataType": "percentage",
"code": "LikelhoodOfRecommendation2"
},
{
"userValues": null,
"values": [
{
"disabled": false,
"readonly": false
}
],
"isNotTranslatable": false,
"cloneable": true,
"hidden": false,
"hasRules": false,
"displaySequence": 1,
"label": "Age2",
"attributeId": "a0X5g000000GZNpEAO",
"filterable": true,
"disabled": false,
"readonly": false,
"required": false,
"multiselect": false,
"cacheable": true,
"inputType": "number",
"dataType": "number",
"code": "Age2"
},
{
"userValues": false,
"values": [
{
"defaultValue": false,
"disabled": false,
"readonly": false
}
],
"isNotTranslatable": false,
"cloneable": true,
"hidden": false,
"hasRules": false,
"displaySequence": 1,
"label": "NeedInsurance2",
"attributeId": "a0X5g000000GZNqEAO",
"filterable": true,
"disabled": false,
"readonly": false,
"required": false,
"multiselect": false,
"cacheable": true,
"inputType": "checkbox",
"dataType": "text",
"code": "NeedInsurance2"
}
],
"totalSize": 5
},
"id": "a0W5g0000009UieEAE",
"Name": "SURVEY",
"Code__c": "SURVEY",
"displaySequence": 2
}
],
"totalSize": 2
},
"Attachments": null,
"lineNumber": "0001",
"productHierarchyPath": "01t5g000002vVZPAA2",
"groupMaxQuantity": 99999,
"groupMinQuantity": 0,
"maxQuantity": 2,
"minQuantity": 0,
"Quantity": 0,
"PricebookEntryId": "01u5g000002n2RaAAI",
"Product2Id": "01t5g000002vVZPAA2",
"ProductCode": "T11_p_151",
"Name": "T11_p_151"
}
],
"pr_dc_002__IsOrderable__c": true,
"pr_dc_002__IsActive__c": true,
"pr_dc_002__Code__c": "T11_promo151",
"Name": "T11_promo151",
"Id": "a3T5g000000CvgkEAC"
}
}
}
HTTP Response Codes
| Code | Description |
|---|---|
| 200 | OK |
| 500 | Internal Server Error |