Offers Item API

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.

ParameterExampleDefaultOptional/RequiredNotes
effectiveStartTime2001-07-04T12:08:56Current date and timeOptionaleffectiveStartTime 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.
expirationTime2001-07-04T12:08:56effectiveStartTime + TimeToLiveOptionalexpirationTime 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:

1GET /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 

ParameterData TypeDescriptionDefaultOptional/Required
offerIdsList of stringsThe 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/ARequired

Sample Request Body 

This is a sample request for offerIds.

1{
2    "offerIds": [
3        "01t4x000000wx2vAAA",
4        "01t4x000000wx2wAAA",
5        "01t4x000000wx2xAAA",
6        "01t4x000000wx2yAAA",
7        "01t4x000000wx2zAAA",
8        "01t4x000000wx30AAA",
9        "01t4x000000wx31AAA",
10        "a3T4x000000l39BEAQ",
11        "a3T4x000000l39CEAQ"
12    ]
13}

Remote API 

This is an example of how you invoke the API using Apex:

1String methodName;
2String requestBodyJSON;
3Map<String, Object> input = new Map<String, Object>();
4Map<String, Object> output = new Map<String, Object>();
5Map<String, Object> options = new Map<String, Object>();
6
7// Setting remote parameters
8methodName = 'getOffersItem';
9requestBodyJSON = '{"offerIds":["01t5w00000FbI08AAF"]}';
10input.put('apiName', 'CMOffersItem');       // required
11input.put('methodName', methodName);        // required
12input.put('catalogCode', 'TestCatalog');    // required
13input.put('requestBody', requestBodyJSON);  // required
14input.put('effectiveStartTime', null);      // optional
15input.put('expirationTime', null);          // optional
16input.put('requestURL', '/v3/admin/catalogs/TestCatalog/offersitem'); //required
17
18//remote action invocation
19vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
20appHandler.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.

1THREAD1 -  POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offersitem
2THREAD2 -  POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offersitem
3...
4THREAD200 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offersitem
5THREAD201 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog2/offersitem
6......
7THREAD2000 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog10/offersitem

HTTP Headers 

HeaderDescription
Content-Typeapplication/json

Response Body 

This example contains a list of offers and their details.

1{
2  "priceListId": "a3D5g000000HAiIEAW",
3  "offerType": "Product",
4  "Attachments": null,
5  "AttributeCategory": {
6    "BASIC": [
7      {
8        "$$AttributeDefinitionEnd$$": null,
9        "attributeRunTimeInfo": {
10          "uiDisplayType": "Single Value",
11          "dataType": "Date"
12        },
13        "isnotassetizable__c": false,
14        "attributegrouptype__c": null,
15        "valuedescription__c": null,
16        "valuedatatype__c": "Date",
17        "value__c": null,
18        "uidisplaytype__c": "Single Value",
19        "rulemessage__c": null,
20        "isrequired__c": false,
21        "id": "a245g000000cEJTAA2",
22        "querylabel__c": null,
23        "isquerydriven__c": false,
24        "isnottranslatable__c": false,
25        "isreadonly__c": false,
26        "querycode__c": null,
27        "objecttype__c": null,
28        "valueinnumber__c": null,
29        "ishidden__c": false,
30        "isconfigurable__c": true,
31        "hasrule__c": false,
32        "formatmask__c": null,
33        "customconfiguitemplate__c": null,
34        "categorydisplaysequence__c": 1,
35        "displaysequence__c": null,
36        "attributedisplayname__c": "DateForBuyBack2",
37        "isactive__c": true,
38        "attributecloneable__c": true,
39        "attributefilterable__c": true,
40        "attributedisplaysequence__c": "1",
41        "attributeconfigurable__c": true,
42        "attributeuniquecode__c": "DateForBuyBack2",
43        "categoryname__c": "BASIC",
44        "categorycode__c": "BASIC",
45        "attributecategoryid__c": "a0W5g0000009UidEAE",
46        "attributeid__c": "a0X5g000000GZNkEAO",
47        "objectid__c": "01t5g000002vVUuAAM",
48        "$$AttributeDefinitionStart$$": null
49      },
50      {
51        "$$AttributeDefinitionEnd$$": null,
52        "attributeRunTimeInfo": {
53          "uiDisplayType": "Single Value",
54          "dataType": "Datetime"
55        },
56        "isnotassetizable__c": false,
57        "attributegrouptype__c": null,
58        "valuedescription__c": null,
59        "valuedatatype__c": "Datetime",
60        "value__c": null,
61        "uidisplaytype__c": "Single Value",
62        "rulemessage__c": null,
63        "isrequired__c": false,
64        "id": "a245g000000cEJUAA2",
65        "querylabel__c": null,
66        "isquerydriven__c": false,
67        "isnottranslatable__c": false,
68        "isreadonly__c": false,
69        "querycode__c": null,
70        "objecttype__c": null,
71        "valueinnumber__c": null,
72        "ishidden__c": false,
73        "isconfigurable__c": true,
74        "hasrule__c": false,
75        "formatmask__c": null,
76        "customconfiguitemplate__c": null,
77        "categorydisplaysequence__c": 1,
78        "displaysequence__c": null,
79        "attributedisplayname__c": "DateTimeForDelivery2",
80        "isactive__c": true,
81        "attributecloneable__c": true,
82        "attributefilterable__c": true,
83        "attributedisplaysequence__c": "1",
84        "attributeconfigurable__c": true,
85        "attributeuniquecode__c": "DateTimeForDelivery2",
86        "categoryname__c": "BASIC",
87        "categorycode__c": "BASIC",
88        "attributecategoryid__c": "a0W5g0000009UidEAE",
89        "attributeid__c": "a0X5g000000GZNlEAO",
90        "objectid__c": "01t5g000002vVUuAAM",
91        "$$AttributeDefinitionStart$$": null
92      }
93    ],
94    "SURVEY": [
95      {
96        "$$AttributeDefinitionEnd$$": null,
97        "attributeRunTimeInfo": {
98          "default": [],
99          "values": [
100            {
101              "value": "false",
102              "sequence": 1,
103              "id": "8a8b4ef3-765a-6933-b99a-8d64dc2194a0",
104              "displayText": "false"
105            },
106            {
107              "value": "true",
108              "sequence": 2,
109              "id": "34c72160-5234-5a70-432b-e2382fcae4f5",
110              "displayText": "true"
111            }
112          ],
113          "uiDisplayType": "Dropdown",
114          "dataType": "Picklist"
115        },
116        "isnotassetizable__c": false,
117        "attributegrouptype__c": null,
118        "valuedescription__c": null,
119        "valuedatatype__c": "Picklist",
120        "value__c": null,
121        "uidisplaytype__c": "Dropdown",
122        "rulemessage__c": null,
123        "isrequired__c": false,
124        "id": "a245g000000cEJSAA2",
125        "querylabel__c": null,
126        "isquerydriven__c": false,
127        "isnottranslatable__c": false,
128        "isreadonly__c": false,
129        "querycode__c": null,
130        "objecttype__c": null,
131        "valueinnumber__c": null,
132        "ishidden__c": false,
133        "isconfigurable__c": true,
134        "hasrule__c": false,
135        "formatmask__c": null,
136        "customconfiguitemplate__c": null,
137        "categorydisplaysequence__c": 2,
138        "displaysequence__c": null,
139        "attributedisplayname__c": "IsValueForMoney2",
140        "isactive__c": true,
141        "attributecloneable__c": true,
142        "attributefilterable__c": true,
143        "attributedisplaysequence__c": "1",
144        "attributeconfigurable__c": true,
145        "attributeuniquecode__c": "IsValueForMoney2",
146        "categoryname__c": "SURVEY",
147        "categorycode__c": "SURVEY",
148        "attributecategoryid__c": "a0W5g0000009UieEAE",
149        "attributeid__c": "a0X5g000000GZNmEAO",
150        "objectid__c": "01t5g000002vVUuAAM",
151        "$$AttributeDefinitionStart$$": null
152      },
153      {
154        "$$AttributeDefinitionEnd$$": null,
155        "attributeRunTimeInfo": {
156          "uiDisplayType": "Single Value",
157          "dataType": "Currency"
158        },
159        "isnotassetizable__c": false,
160        "attributegrouptype__c": null,
161        "valuedescription__c": null,
162        "valuedatatype__c": "Currency",
163        "value__c": null,
164        "uidisplaytype__c": "Single Value",
165        "rulemessage__c": null,
166        "isrequired__c": false,
167        "id": "a245g000000cEJVAA2",
168        "querylabel__c": null,
169        "isquerydriven__c": false,
170        "isnottranslatable__c": false,
171        "isreadonly__c": false,
172        "querycode__c": null,
173        "objecttype__c": null,
174        "valueinnumber__c": null,
175        "ishidden__c": false,
176        "isconfigurable__c": true,
177        "hasrule__c": false,
178        "formatmask__c": null,
179        "customconfiguitemplate__c": null,
180        "categorydisplaysequence__c": 2,
181        "displaysequence__c": null,
182        "attributedisplayname__c": "Networth2",
183        "isactive__c": true,
184        "attributecloneable__c": true,
185        "attributefilterable__c": true,
186        "attributedisplaysequence__c": "1",
187        "attributeconfigurable__c": true,
188        "attributeuniquecode__c": "Networth2",
189        "categoryname__c": "SURVEY",
190        "categorycode__c": "SURVEY",
191        "attributecategoryid__c": "a0W5g0000009UieEAE",
192        "attributeid__c": "a0X5g000000GZNnEAO",
193        "objectid__c": "01t5g000002vVUuAAM",
194        "$$AttributeDefinitionStart$$": null
195      },
196      {
197        "$$AttributeDefinitionEnd$$": null,
198        "attributeRunTimeInfo": {
199          "uiDisplayType": "Single Value",
200          "dataType": "Percent"
201        },
202        "isnotassetizable__c": false,
203        "attributegrouptype__c": null,
204        "valuedescription__c": null,
205        "valuedatatype__c": "Percent",
206        "value__c": null,
207        "uidisplaytype__c": "Single Value",
208        "rulemessage__c": null,
209        "isrequired__c": false,
210        "id": "a245g000000cEJWAA2",
211        "querylabel__c": null,
212        "isquerydriven__c": false,
213        "isnottranslatable__c": false,
214        "isreadonly__c": false,
215        "querycode__c": null,
216        "objecttype__c": null,
217        "valueinnumber__c": null,
218        "ishidden__c": false,
219        "isconfigurable__c": true,
220        "hasrule__c": false,
221        "formatmask__c": null,
222        "customconfiguitemplate__c": null,
223        "categorydisplaysequence__c": 2,
224        "displaysequence__c": null,
225        "attributedisplayname__c": "LikelhoodOfRecommendation2",
226        "isactive__c": true,
227        "attributecloneable__c": true,
228        "attributefilterable__c": true,
229        "attributedisplaysequence__c": "1",
230        "attributeconfigurable__c": true,
231        "attributeuniquecode__c": "LikelhoodOfRecommendation2",
232        "categoryname__c": "SURVEY",
233        "categorycode__c": "SURVEY",
234        "attributecategoryid__c": "a0W5g0000009UieEAE",
235        "attributeid__c": "a0X5g000000GZNoEAO",
236        "objectid__c": "01t5g000002vVUuAAM",
237        "$$AttributeDefinitionStart$$": null
238      },
239      {
240        "$$AttributeDefinitionEnd$$": null,
241        "attributeRunTimeInfo": {
242          "uiDisplayType": "Single Value",
243          "dataType": "Number"
244        },
245        "isnotassetizable__c": false,
246        "attributegrouptype__c": null,
247        "valuedescription__c": null,
248        "valuedatatype__c": "Number",
249        "value__c": null,
250        "uidisplaytype__c": "Single Value",
251        "rulemessage__c": null,
252        "isrequired__c": false,
253        "id": "a245g000000cEJXAA2",
254        "querylabel__c": null,
255        "isquerydriven__c": false,
256        "isnottranslatable__c": false,
257        "isreadonly__c": false,
258        "querycode__c": null,
259        "objecttype__c": null,
260        "valueinnumber__c": null,
261        "ishidden__c": false,
262        "isconfigurable__c": true,
263        "hasrule__c": false,
264        "formatmask__c": null,
265        "customconfiguitemplate__c": null,
266        "categorydisplaysequence__c": 2,
267        "displaysequence__c": null,
268        "attributedisplayname__c": "Age2",
269        "isactive__c": true,
270        "attributecloneable__c": true,
271        "attributefilterable__c": true,
272        "attributedisplaysequence__c": "1",
273        "attributeconfigurable__c": true,
274        "attributeuniquecode__c": "Age2",
275        "categoryname__c": "SURVEY",
276        "categorycode__c": "SURVEY",
277        "attributecategoryid__c": "a0W5g0000009UieEAE",
278        "attributeid__c": "a0X5g000000GZNpEAO",
279        "objectid__c": "01t5g000002vVUuAAM",
280        "$$AttributeDefinitionStart$$": null
281      },
282      {
283        "$$AttributeDefinitionEnd$$": null,
284        "attributeRunTimeInfo": {
285          "default": false,
286          "uiDisplayType": "Single Value",
287          "dataType": "Checkbox"
288        },
289        "isnotassetizable__c": false,
290        "attributegrouptype__c": null,
291        "valuedescription__c": null,
292        "valuedatatype__c": "Checkbox",
293        "value__c": null,
294        "uidisplaytype__c": "Single Value",
295        "rulemessage__c": null,
296        "isrequired__c": false,
297        "id": "a245g000000cEJYAA2",
298        "querylabel__c": null,
299        "isquerydriven__c": false,
300        "isnottranslatable__c": false,
301        "isreadonly__c": false,
302        "querycode__c": null,
303        "objecttype__c": null,
304        "valueinnumber__c": null,
305        "ishidden__c": false,
306        "isconfigurable__c": true,
307        "hasrule__c": false,
308        "formatmask__c": null,
309        "customconfiguitemplate__c": null,
310        "categorydisplaysequence__c": 2,
311        "displaysequence__c": null,
312        "attributedisplayname__c": "NeedInsurance2",
313        "isactive__c": true,
314        "attributecloneable__c": true,
315        "attributefilterable__c": true,
316        "attributedisplaysequence__c": "1",
317        "attributeconfigurable__c": true,
318        "attributeuniquecode__c": "NeedInsurance2",
319        "categoryname__c": "SURVEY",
320        "categorycode__c": "SURVEY",
321        "attributecategoryid__c": "a0W5g0000009UieEAE",
322        "attributeid__c": "a0X5g000000GZNqEAO",
323        "objectid__c": "01t5g000002vVUuAAM",
324        "$$AttributeDefinitionStart$$": null
325      }
326    ]
327  },
328  "IsActive": true,
329  "pr_dc_002__IsOrderable__c": true,
330  "ProductCode": "T10_p_21",
331  "Name": "T10_p_21",
332  "Id": "01t5g000002vVUuAAM"
333}

HTTP Response Codes 

CodeDescription
200OK
500Internal Server Error