Prices API

The Prices API takes an offer’s ID as input and populates its prices in the cache. The prices entry contains information about applicable pricing variables, for example, one-time, recurring, override, 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 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}/prices

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/prices?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:

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 = 'getPrices';
9input.put('apiName', 'CMPrices');           // required
10input.put('methodName', methodName);        // required
11input.put('catalogCode', 'TestCatalog');    // required
12input.put('offerId', '01t4x000000x269AAA'); // required
13input.put('effectiveStartTime', null);      // optional
14input.put('expirationTime', null);          // optional
15input.put('requestURL', '/v3/admin/catalogs/{catalogCode}/offers/{offerId}/prices'); //required
16
17//remote action invocation
18vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
19appHandler.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, then you can run the API for all 1,000 offers in parallel threads.

1THREAD1 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offers/offer1/prices
2THREAD2 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offers/offer2/prices
3......
4THREAD100 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offers/offer100/prices
5THREAD101 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog2/offers/offer101/prices
6......
7THREAD1000 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog10/offers/offer1000/prices

HTTP Headers 

HeaderDescription
Content-Typeapplication/json

Response Body 

This example shows an offer’s pricing details.

1[
2  {
3    "UnitPrice": 150,
4    "DisplayText__c": "150_OTB_T3_p_21",
5    "ChargeType__c": "One-time",
6    "RecurringFrequency__c": null,
7    "Type__c": "Price",
8    "SubType__c": "Standard",
9    "effectivefromdatespec": null,
10    "effectiveuntildatespec": null,
11    "IsBasePrice__c": true,
12    "IsVirtualPrice__c": false,
13    "Amount__c": 150,
14    "baseamount": 150,
15    "chargeamount": 143,
16    "overrides": [],
17    "adjustments": [
18      {
19        "DisplayText__c": "7_OT_ABS_T3_p_21_T3_promo21",
20        "ChargeType__c": "Adjustment",
21        "RecurringFrequency__c": null,
22        "Type__c": "Price",
23        "SubType__c": "Standard",
24        "effectivefromdatespec": null,
25        "effectiveuntildatespec": null,
26        "Id": "a3C5g000000PsXQEA0",
27        "Source__c": "promotion",
28        "AdjustmentMethod__c": "Absolute",
29        "AdjustmentValue__c": -7
30      }
31    ]
32  },
33  {
34    "DisplayText__c": "15_RB_T3_p_21",
35    "ChargeType__c": "Recurring",
36    "RecurringFrequency__c": "Monthly",
37    "Type__c": "Price",
38    "SubType__c": "Standard",
39    "effectivefromdatespec": null,
40    "effectiveuntildatespec": null,
41    "IsBasePrice__c": true,
42    "IsVirtualPrice__c": false,
43    "Amount__c": 15,
44    "baseamount": 15,
45    "chargeamount": 12.45,
46    "overrides": [],
47    "adjustments": [
48      {
49        "DisplayText__c": "17_REC_PER_T3_p_21_T3_promo21",
50        "ChargeType__c": "Adjustment",
51        "RecurringFrequency__c": "Monthly",
52        "Type__c": "Price",
53        "SubType__c": "Standard",
54        "effectivefromdatespec": null,
55        "effectiveuntildatespec": null,
56        "Id": "a3C5g000000PsXPEA0",
57        "Source__c": "promotion",
58        "AdjustmentMethod__c": "Percent",
59        "AdjustmentValue__c": -17
60      }
61    ]
62  }
63]

HTTP Response Codes 

CodeDescription
200OK
500Internal Server Error