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.

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

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

getPromotionList

REST Handler

APIPromotionsCartsCpqV2

Apex Remote Service

CpqAppHandler

Apex Remote Input Map

{
  "methodName": "getPromotionList",
  "cartId": "801360000008eNU"
}

Package

Communication (vlocity_cmt)

API Parameters and Response Format

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

Resource Information

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

Example Request

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

{
 "totalSize" => 2,
 "messages" => [],
 "records" => [{
   "messages" => [],
   "actions" => {
    "addtocart" => {
     "rest" => {
      "params" => {
       "items" => [{
        "itemId" => "a2f6A000000hDwJQAU"
       }]
      }, "method" => "POST", "link" => "/services/apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwG3QAI/promotions"
     },
     "remote" => {
      "params" => {
       "items" => [{
        "itemId" => "a2f6A000000hDwJQAU"
       }], "promotionId" => "a2f6A000000hDwJQAU", "cartId" => "8016A000000bwG3QAI", "methodName" => "postCartsPromoItems"
      }
     },
     "client" => {
      "params" => {}
     }
    },
    "validatecart" => {
     "rest" => {
      "params" => {}, "method" => "POST", "link" => "/services/apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwG3QAI/validate"
     },
     "remote" => {
      "params" => {
       "cartId" => "8016A000000bwG3QAI", "methodName" => "runCartValidation"
      }
     },
     "client" => {
      "params" => {}
     }
    }
   },
   "displaySequence" => 0,
   "name" => "PromoOne",
   "code" => "PromoOne",
   "id" => "a2f6A000000hDwJQAU",
   "category" => "Qualified"
  },
  {
   "messages" => [],
   "actions" => {
    "addtocart" => {
     "rest" => {
      "params" => {
       "items" => [{
        "itemId" => "a2f6A000000hpOHQAY"
       }]
      }, "method" => "POST", "link" => "/services/apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwG3QAI/promotions"
     },
     "remote" => {
      "params" => {
       "items" => [{
        "itemId" => "a2f6A000000hpOHQAY"
       }], "promotionId" => "a2f6A000000hpOHQAY", "cartId" => "8016A000000bwG3QAI", "methodName" => "postCartsPromoItems"
      }
     },
     "client" => {
      "params" => {}
     }
    },
    "validatecart" => {
     "rest" => {
      "params" => {}, "method" => "POST", "link" => "/services/apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwG3QAI/validate"
     },
     "remote" => {
      "params" => {
       "cartId" => "8016A000000bwG3QAI", "methodName" => "runCartValidation"
      }
     },
     "client" => {
      "params" => {}
     }
    }
   },
   "displaySequence" => 1,
   "name" => "2146PROMO",
   "code" => "2146PROMO",
   "id" => "a2f6A000000hpOHQAY",
   "category" => "Qualified"
  }
 ]
}