Add applied promotion items to the cart.
POST /v2/cpq/carts/{cart_ID}/promotions
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
postCartsPromoItems
REST Handler
APIPromotionsCartsCpqV2
Apex Remote Service
CpqAppHandler
Apex Remote Input Map
{
"items": [{
"itemId": "a2ff4000000Li5eAAC"
}],
"promotionId": "a2ff4000000Li5eAAC",
"cartId": "801f40000012NEIAA2",
"methodName": "postCartsPromoItems"
}
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
POST
/services/apexrest/vlocity_cmt/v2/cpq/carts/801f40000012NEIAA2/promotions
BODY:
{
"items": [
{
"itemId": "a2ff4000000Li5eAAC"
}
],
"promotionId": "a2ff4000000Li5eAAC",
"cartId": "801f40000012NEIAA2",
"methodName": "postCartsPromoItems"
}
Example Response
{
"totalSize": 0,
"messages": [],
"actions": {
"itempricesupdated": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/801f40000012NEIAA2/price"
},
"remote": {
"params": {
"cartId": "801f40000012NEIAA2",
"methodName": "getCartLineItemPrices"
}
},
"client": {
"params": {}
}
},
"itemadded": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {}
},
"client": {
"params": {
"items": [{
"message": "TestProd-7 has been auto-added to the cart.",
"Id": null
}]
}
}
},
"rootitemadded": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {}
},
"client": {
"params": {},
"records": [{
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "postCartsItems",
"items": [{
"quantity": 1,
"parentId": "802f4000000CuauAAC",
"itemId": "01uf4000000sXvTAAU"
}],
"cartId": "801f40000012NEIAA2",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},
"updateitems": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "putCartsItems",
"items": [{
"itemId": "802f4000000CuauAAC"
}],
"filters": null,
"fields": null,
"cartId": "801f40000012NEIAA2",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},
"deleteitem": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "deleteCartsItems",
"id": "802f4000000CuauAAC",
"filters": null,
"fields": null,
"cartId": "801f40000012NEIAA2",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},
"configdelete": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "configDeleteItem",
"id": "802f4000000CuauAAC",
"cartId": "801f40000012NEIAA2"
}
},
"client": {
"params": {}
}
},
"cloneitem": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "cloneItems",
"items": [{
"itemId": "802f4000000CuauAAC"
}],
"id": "802f4000000CuauAAC",
"cartId": "801f40000012NEIAA2"
}
},
"client": {
"params": {}
}
},
"modifyattributes": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "putItemAttributes",
"items": [{
"itemId": "802f4000000CuauAAC"
}],
"filters": null,
"itemId": "802f4000000CuauAAC",
"id": "802f4000000CuauAAC",
"cartId": "801f40000012NEIAA2"
}
},
"client": {
"params": {}
}
},
...
EXAMPLE TRUNCATED FOR BREVITY