Get Applied or Available Promotions for Cart

Get a list of promotions. The API can return a sorted list of promotions based on the sortBy input parameter.

1GET /v2/cpq/carts/{cart_ID}/promotions

The filters parameter specifies the filters to use to determine the subset of promotions to return. Each filters parameter specifies the field and values to match. The fields parameter specifies the Promotion__c fields to return in the API response.

The filters parameter input is a comma-separated list of sObject fields and values. If one of the fields does not match any sObject fields, it will be discarded. If the filters parameter specifies multiple values separated by underscores, the API matches the field value with OR, for example, SubClass_c:HD_SD will match SubClassc='HD'OR SubClass_c='SD'.

To specify a promotion name using a locale other than the user’s locale, set the localeCode parameter to the desired locale and the query parameter to the name of the promotion. For example:

1GET /services/apexrest/vlocity_cmt/v2/cpq/carts/8011N000002BL2P/promotions?localeCode=fr&query=échantillon

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User Technical Details.

For additional information, ​see UserSecurity Class and CPQ and Digital Commerce Changes for Guest Users.

Remote Method 

1getPromotionList

REST Handler 

1APIPromotionsCartsCpqV2

Apex Remote Service 

1CpqAppHandler

Apex Remote Input Map 

1{
2  "methodName": "getPromotionList",
3  "cartId": "801360000008eNU"
4}

Package 

Communication (vlocity_cmt)

API Parameters and Response Format 

For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information 

Response FormatJSON
Resource URL/services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/promotions

Example Request 

1GET /services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000bARD/promotions?filters=vlocity_cmt_Codec:Test1,Name:Promo1_Promo2&fields=Name,vlocity_cmtCodec,vlocity_cmtIsActive_c

Example Result 

1{
2 "totalSize" => 2,
3 "messages" => [],
4 "records" => [{
5   "messages" => [],
6   "actions" => {
7    "addtocart" => {
8     "rest" => {
9      "params" => {
10       "items" => [{
11        "itemId" => "a2f6A000000hDwJQAU"
12       }]
13      }, "method" => "POST", "link" => "/services/apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwG3QAI/promotions"
14     },
15     "remote" => {
16      "params" => {
17       "items" => [{
18        "itemId" => "a2f6A000000hDwJQAU"
19       }], "promotionId" => "a2f6A000000hDwJQAU", "cartId" => "8016A000000bwG3QAI", "methodName" => "postCartsPromoItems"
20      }
21     },
22     "client" => {
23      "params" => {}
24     }
25    },
26    "validatecart" => {
27     "rest" => {
28      "params" => {}, "method" => "POST", "link" => "/services/apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwG3QAI/validate"
29     },
30     "remote" => {
31      "params" => {
32       "cartId" => "8016A000000bwG3QAI", "methodName" => "runCartValidation"
33      }
34     },
35     "client" => {
36      "params" => {}
37     }
38    }
39   },
40   "displaySequence" => 0,
41   "name" => "PromoOne",
42   "code" => "PromoOne",
43   "id" => "a2f6A000000hDwJQAU",
44   "category" => "Qualified"
45  },
46  {
47   "messages" => [],
48   "actions" => {
49    "addtocart" => {
50     "rest" => {
51      "params" => {
52       "items" => [{
53        "itemId" => "a2f6A000000hpOHQAY"
54       }]
55      }, "method" => "POST", "link" => "/services/apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwG3QAI/promotions"
56     },
57     "remote" => {
58      "params" => {
59       "items" => [{
60        "itemId" => "a2f6A000000hpOHQAY"
61       }], "promotionId" => "a2f6A000000hpOHQAY", "cartId" => "8016A000000bwG3QAI", "methodName" => "postCartsPromoItems"
62      }
63     },
64     "client" => {
65      "params" => {}
66     }
67    },
68    "validatecart" => {
69     "rest" => {
70      "params" => {}, "method" => "POST", "link" => "/services/apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwG3QAI/validate"
71     },
72     "remote" => {
73      "params" => {
74       "cartId" => "8016A000000bwG3QAI", "methodName" => "runCartValidation"
75      }
76     },
77     "client" => {
78      "params" => {}
79     }
80    }
81   },
82   "displaySequence" => 1,
83   "name" => "2146PROMO",
84   "code" => "2146PROMO",
85   "id" => "a2f6A000000hpOHQAY",
86   "category" => "Qualified"
87  }
88 ]
89}