The Offers Item API generates the details of an offer passed in the API request body.
You can obtain the list of offers for this API from the response body of the Catalog Profile API. To get the full list of offers for this catalog, fetch the two lists under apiResponse.data.catalogProductRelationDetails.Promotion and apiResponse.data.catalogProductRelationDetails.Product and merge them.
Pass no more than 20 offers at a time to the API to avoid reaching Salesforce governor limits.
Precondition
You must first run the Catalog Profile API to obtain the list of offers for this API.
URI
/services/apexrest/{namespace}/v3/admin/catalogs/{catalogCode}/offersitem
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/offersitem?effectiveStartTime=2021-07-04T12:08:56&expirationTime=2021-08-04T12:08:56
Request Body Parameters
| Parameter | Data Type | Description | Default | Optional/Required |
|---|---|---|---|---|
| offerIds | List of strings | The list of offer IDs in this catalog for which you populate the offers item cache. You can obtain the list of offers for this API from the response body of the Catalog Profile API. | N/A | Required |
Sample Request Body
This is a sample request for offerIds.
{
"offerIds": [
"01t4x000000wx2vAAA",
"01t4x000000wx2wAAA",
"01t4x000000wx2xAAA",
"01t4x000000wx2yAAA",
"01t4x000000wx2zAAA",
"01t4x000000wx30AAA",
"01t4x000000wx31AAA",
"a3T4x000000l39BEAQ",
"a3T4x000000l39CEAQ"
]
}
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 = 'getOffersItem';
requestBodyJSON = '{"offerIds":["01t5w00000FbI08AAF"]}';
input.put('apiName', 'CMOffersItem'); // required
input.put('methodName', methodName); // required
input.put('catalogCode', 'TestCatalog'); // required
input.put('requestBody', requestBodyJSON); // required
input.put('effectiveStartTime', null); // optional
input.put('expirationTime', null); // optional
input.put('requestURL', '/v3/admin/catalogs/TestCatalog/offersitem'); //required
//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
Parallel Invocation
Each item profile in getOffers API can be processed in parallel. For example, if there are 10 catalogs with 200 offers each, then each of these 2,000 items can be populated in parallel using 2,000 threads. This API can also take a list of offers to reduce the number of API calls.
THREAD1 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offersitem
THREAD2 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offersitem
...
THREAD200 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offersitem
THREAD201 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog2/offersitem
......
THREAD2000 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog10/offersitem
HTTP Headers
| Header | Description |
|---|---|
| Content-Type | application/json |
Response Body
This example contains a list of offers and their details.
{
"priceListId": "a3D5g000000HAiIEAW",
"offerType": "Product",
"Attachments": null,
"AttributeCategory": {
"BASIC": [
{
"$$AttributeDefinitionEnd$$": null,
"attributeRunTimeInfo": {
"uiDisplayType": "Single Value",
"dataType": "Date"
},
"isnotassetizable__c": false,
"attributegrouptype__c": null,
"valuedescription__c": null,
"valuedatatype__c": "Date",
"value__c": null,
"uidisplaytype__c": "Single Value",
"rulemessage__c": null,
"isrequired__c": false,
"id": "a245g000000cEJTAA2",
"querylabel__c": null,
"isquerydriven__c": false,
"isnottranslatable__c": false,
"isreadonly__c": false,
"querycode__c": null,
"objecttype__c": null,
"valueinnumber__c": null,
"ishidden__c": false,
"isconfigurable__c": true,
"hasrule__c": false,
"formatmask__c": null,
"customconfiguitemplate__c": null,
"categorydisplaysequence__c": 1,
"displaysequence__c": null,
"attributedisplayname__c": "DateForBuyBack2",
"isactive__c": true,
"attributecloneable__c": true,
"attributefilterable__c": true,
"attributedisplaysequence__c": "1",
"attributeconfigurable__c": true,
"attributeuniquecode__c": "DateForBuyBack2",
"categoryname__c": "BASIC",
"categorycode__c": "BASIC",
"attributecategoryid__c": "a0W5g0000009UidEAE",
"attributeid__c": "a0X5g000000GZNkEAO",
"objectid__c": "01t5g000002vVUuAAM",
"$$AttributeDefinitionStart$$": null
},
{
"$$AttributeDefinitionEnd$$": null,
"attributeRunTimeInfo": {
"uiDisplayType": "Single Value",
"dataType": "Datetime"
},
"isnotassetizable__c": false,
"attributegrouptype__c": null,
"valuedescription__c": null,
"valuedatatype__c": "Datetime",
"value__c": null,
"uidisplaytype__c": "Single Value",
"rulemessage__c": null,
"isrequired__c": false,
"id": "a245g000000cEJUAA2",
"querylabel__c": null,
"isquerydriven__c": false,
"isnottranslatable__c": false,
"isreadonly__c": false,
"querycode__c": null,
"objecttype__c": null,
"valueinnumber__c": null,
"ishidden__c": false,
"isconfigurable__c": true,
"hasrule__c": false,
"formatmask__c": null,
"customconfiguitemplate__c": null,
"categorydisplaysequence__c": 1,
"displaysequence__c": null,
"attributedisplayname__c": "DateTimeForDelivery2",
"isactive__c": true,
"attributecloneable__c": true,
"attributefilterable__c": true,
"attributedisplaysequence__c": "1",
"attributeconfigurable__c": true,
"attributeuniquecode__c": "DateTimeForDelivery2",
"categoryname__c": "BASIC",
"categorycode__c": "BASIC",
"attributecategoryid__c": "a0W5g0000009UidEAE",
"attributeid__c": "a0X5g000000GZNlEAO",
"objectid__c": "01t5g000002vVUuAAM",
"$$AttributeDefinitionStart$$": null
}
],
"SURVEY": [
{
"$$AttributeDefinitionEnd$$": null,
"attributeRunTimeInfo": {
"default": [],
"values": [
{
"value": "false",
"sequence": 1,
"id": "8a8b4ef3-765a-6933-b99a-8d64dc2194a0",
"displayText": "false"
},
{
"value": "true",
"sequence": 2,
"id": "34c72160-5234-5a70-432b-e2382fcae4f5",
"displayText": "true"
}
],
"uiDisplayType": "Dropdown",
"dataType": "Picklist"
},
"isnotassetizable__c": false,
"attributegrouptype__c": null,
"valuedescription__c": null,
"valuedatatype__c": "Picklist",
"value__c": null,
"uidisplaytype__c": "Dropdown",
"rulemessage__c": null,
"isrequired__c": false,
"id": "a245g000000cEJSAA2",
"querylabel__c": null,
"isquerydriven__c": false,
"isnottranslatable__c": false,
"isreadonly__c": false,
"querycode__c": null,
"objecttype__c": null,
"valueinnumber__c": null,
"ishidden__c": false,
"isconfigurable__c": true,
"hasrule__c": false,
"formatmask__c": null,
"customconfiguitemplate__c": null,
"categorydisplaysequence__c": 2,
"displaysequence__c": null,
"attributedisplayname__c": "IsValueForMoney2",
"isactive__c": true,
"attributecloneable__c": true,
"attributefilterable__c": true,
"attributedisplaysequence__c": "1",
"attributeconfigurable__c": true,
"attributeuniquecode__c": "IsValueForMoney2",
"categoryname__c": "SURVEY",
"categorycode__c": "SURVEY",
"attributecategoryid__c": "a0W5g0000009UieEAE",
"attributeid__c": "a0X5g000000GZNmEAO",
"objectid__c": "01t5g000002vVUuAAM",
"$$AttributeDefinitionStart$$": null
},
{
"$$AttributeDefinitionEnd$$": null,
"attributeRunTimeInfo": {
"uiDisplayType": "Single Value",
"dataType": "Currency"
},
"isnotassetizable__c": false,
"attributegrouptype__c": null,
"valuedescription__c": null,
"valuedatatype__c": "Currency",
"value__c": null,
"uidisplaytype__c": "Single Value",
"rulemessage__c": null,
"isrequired__c": false,
"id": "a245g000000cEJVAA2",
"querylabel__c": null,
"isquerydriven__c": false,
"isnottranslatable__c": false,
"isreadonly__c": false,
"querycode__c": null,
"objecttype__c": null,
"valueinnumber__c": null,
"ishidden__c": false,
"isconfigurable__c": true,
"hasrule__c": false,
"formatmask__c": null,
"customconfiguitemplate__c": null,
"categorydisplaysequence__c": 2,
"displaysequence__c": null,
"attributedisplayname__c": "Networth2",
"isactive__c": true,
"attributecloneable__c": true,
"attributefilterable__c": true,
"attributedisplaysequence__c": "1",
"attributeconfigurable__c": true,
"attributeuniquecode__c": "Networth2",
"categoryname__c": "SURVEY",
"categorycode__c": "SURVEY",
"attributecategoryid__c": "a0W5g0000009UieEAE",
"attributeid__c": "a0X5g000000GZNnEAO",
"objectid__c": "01t5g000002vVUuAAM",
"$$AttributeDefinitionStart$$": null
},
{
"$$AttributeDefinitionEnd$$": null,
"attributeRunTimeInfo": {
"uiDisplayType": "Single Value",
"dataType": "Percent"
},
"isnotassetizable__c": false,
"attributegrouptype__c": null,
"valuedescription__c": null,
"valuedatatype__c": "Percent",
"value__c": null,
"uidisplaytype__c": "Single Value",
"rulemessage__c": null,
"isrequired__c": false,
"id": "a245g000000cEJWAA2",
"querylabel__c": null,
"isquerydriven__c": false,
"isnottranslatable__c": false,
"isreadonly__c": false,
"querycode__c": null,
"objecttype__c": null,
"valueinnumber__c": null,
"ishidden__c": false,
"isconfigurable__c": true,
"hasrule__c": false,
"formatmask__c": null,
"customconfiguitemplate__c": null,
"categorydisplaysequence__c": 2,
"displaysequence__c": null,
"attributedisplayname__c": "LikelhoodOfRecommendation2",
"isactive__c": true,
"attributecloneable__c": true,
"attributefilterable__c": true,
"attributedisplaysequence__c": "1",
"attributeconfigurable__c": true,
"attributeuniquecode__c": "LikelhoodOfRecommendation2",
"categoryname__c": "SURVEY",
"categorycode__c": "SURVEY",
"attributecategoryid__c": "a0W5g0000009UieEAE",
"attributeid__c": "a0X5g000000GZNoEAO",
"objectid__c": "01t5g000002vVUuAAM",
"$$AttributeDefinitionStart$$": null
},
{
"$$AttributeDefinitionEnd$$": null,
"attributeRunTimeInfo": {
"uiDisplayType": "Single Value",
"dataType": "Number"
},
"isnotassetizable__c": false,
"attributegrouptype__c": null,
"valuedescription__c": null,
"valuedatatype__c": "Number",
"value__c": null,
"uidisplaytype__c": "Single Value",
"rulemessage__c": null,
"isrequired__c": false,
"id": "a245g000000cEJXAA2",
"querylabel__c": null,
"isquerydriven__c": false,
"isnottranslatable__c": false,
"isreadonly__c": false,
"querycode__c": null,
"objecttype__c": null,
"valueinnumber__c": null,
"ishidden__c": false,
"isconfigurable__c": true,
"hasrule__c": false,
"formatmask__c": null,
"customconfiguitemplate__c": null,
"categorydisplaysequence__c": 2,
"displaysequence__c": null,
"attributedisplayname__c": "Age2",
"isactive__c": true,
"attributecloneable__c": true,
"attributefilterable__c": true,
"attributedisplaysequence__c": "1",
"attributeconfigurable__c": true,
"attributeuniquecode__c": "Age2",
"categoryname__c": "SURVEY",
"categorycode__c": "SURVEY",
"attributecategoryid__c": "a0W5g0000009UieEAE",
"attributeid__c": "a0X5g000000GZNpEAO",
"objectid__c": "01t5g000002vVUuAAM",
"$$AttributeDefinitionStart$$": null
},
{
"$$AttributeDefinitionEnd$$": null,
"attributeRunTimeInfo": {
"default": false,
"uiDisplayType": "Single Value",
"dataType": "Checkbox"
},
"isnotassetizable__c": false,
"attributegrouptype__c": null,
"valuedescription__c": null,
"valuedatatype__c": "Checkbox",
"value__c": null,
"uidisplaytype__c": "Single Value",
"rulemessage__c": null,
"isrequired__c": false,
"id": "a245g000000cEJYAA2",
"querylabel__c": null,
"isquerydriven__c": false,
"isnottranslatable__c": false,
"isreadonly__c": false,
"querycode__c": null,
"objecttype__c": null,
"valueinnumber__c": null,
"ishidden__c": false,
"isconfigurable__c": true,
"hasrule__c": false,
"formatmask__c": null,
"customconfiguitemplate__c": null,
"categorydisplaysequence__c": 2,
"displaysequence__c": null,
"attributedisplayname__c": "NeedInsurance2",
"isactive__c": true,
"attributecloneable__c": true,
"attributefilterable__c": true,
"attributedisplaysequence__c": "1",
"attributeconfigurable__c": true,
"attributeuniquecode__c": "NeedInsurance2",
"categoryname__c": "SURVEY",
"categorycode__c": "SURVEY",
"attributecategoryid__c": "a0W5g0000009UieEAE",
"attributeid__c": "a0X5g000000GZNqEAO",
"objectid__c": "01t5g000002vVUuAAM",
"$$AttributeDefinitionStart$$": null
}
]
},
"IsActive": true,
"pr_dc_002__IsOrderable__c": true,
"ProductCode": "T10_p_21",
"Name": "T10_p_21",
"Id": "01t5g000002vVUuAAM"
}
HTTP Response Codes
| Code | Description |
|---|---|
| 200 | OK |
| 500 | Internal Server Error |