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.

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

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 = 'getPrices';
input.put('apiName', 'CMPrices');           // 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}/prices'); //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, then you can run the API for all 1,000 offers in parallel threads.

THREAD1 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offers/offer1/prices
THREAD2 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offers/offer2/prices
......
THREAD100 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog1/offers/offer100/prices
THREAD101 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog2/offers/offer101/prices
......
THREAD1000 - POST /services/apexrest/{namespace}/v3/admin/catalogs/catalog10/offers/offer1000/prices

HTTP Headers

Header Description
Content-Type application/json

Response Body

This example shows an offer's pricing details.

[
  {
    "UnitPrice": 150,
    "DisplayText__c": "150_OTB_T3_p_21",
    "ChargeType__c": "One-time",
    "RecurringFrequency__c": null,
    "Type__c": "Price",
    "SubType__c": "Standard",
    "effectivefromdatespec": null,
    "effectiveuntildatespec": null,
    "IsBasePrice__c": true,
    "IsVirtualPrice__c": false,
    "Amount__c": 150,
    "baseamount": 150,
    "chargeamount": 143,
    "overrides": [],
    "adjustments": [
      {
        "DisplayText__c": "7_OT_ABS_T3_p_21_T3_promo21",
        "ChargeType__c": "Adjustment",
        "RecurringFrequency__c": null,
        "Type__c": "Price",
        "SubType__c": "Standard",
        "effectivefromdatespec": null,
        "effectiveuntildatespec": null,
        "Id": "a3C5g000000PsXQEA0",
        "Source__c": "promotion",
        "AdjustmentMethod__c": "Absolute",
        "AdjustmentValue__c": -7
      }
    ]
  },
  {
    "DisplayText__c": "15_RB_T3_p_21",
    "ChargeType__c": "Recurring",
    "RecurringFrequency__c": "Monthly",
    "Type__c": "Price",
    "SubType__c": "Standard",
    "effectivefromdatespec": null,
    "effectiveuntildatespec": null,
    "IsBasePrice__c": true,
    "IsVirtualPrice__c": false,
    "Amount__c": 15,
    "baseamount": 15,
    "chargeamount": 12.45,
    "overrides": [],
    "adjustments": [
      {
        "DisplayText__c": "17_REC_PER_T3_p_21_T3_promo21",
        "ChargeType__c": "Adjustment",
        "RecurringFrequency__c": "Monthly",
        "Type__c": "Price",
        "SubType__c": "Standard",
        "effectivefromdatespec": null,
        "effectiveuntildatespec": null,
        "Id": "a3C5g000000PsXPEA0",
        "Source__c": "promotion",
        "AdjustmentMethod__c": "Percent",
        "AdjustmentValue__c": -17
      }
    ]
  }
]

HTTP Response Codes

Code Description
200 OK
500 Internal Server Error