Validate Cart Action

Run validation and pricing for the items in the cart. This API runs the implementations defined in your org under the product validation and pricing interfaces.

1POST /v2/cpq/carts/{cart_ID}/validate

Salesforce provides multiple implementations for product validation and pricing interfaces. The product validation implementation will typically run the configuration rules and the pricing implementations will run the pricing rules.

Remote Method 

1runCartValidation

REST Handler 

1validate

Apex Remote Service 

Class:

1vlocity_cmt.CardCanvasController

Method:

1global static Object doGenericInvoke(String sClassName, String sMethodName, String input, String options)

Apex Remote Input Map 

1String sClassName: vlocity_cmt.CpqAppHandler
2String sMethodName: runCartValidation
3String input: {
4 "cartId": "8011N00000157LkQAI",
5 "methodName": "runCartValidation",
6 "price": true,
7 "validate": true
8}
9String options: {
10 "vlcClass": "vlocity_cmt.CpqAppHandler"
11}

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/v2/cpq/carts/{cart_ID}/validate Example: /services/apexrest/vlocity_cmt/v2/cpq/carts/801360000000oQ9/validate

Example Request 

1{
2    "cartId": "8011N00000157LkQAI",
3    "methodName": "runCartValidation",
4    "price": true,
5    "validate": true
6}

Example Response 

1{
2  "totalSize": 0,
3  "messages": [],
4  "actions": {
5    "itemadded": {
6      "rest": {
7        "params": {},
8        "method": null,
9        "link": null
10      },
11      "remote": {
12        "params": {}
13      },
14      "client": {
15        "params": {
16          "items": [
17            {
18              "message": "Product Hier 6 Child 3 has been auto-added to the cart.",
19              "Id": "8021N000006wtUCQAY"
20            }
21          ]
22        },
23        "records": [
24          {
25            "messages": [],
26            "actions": {
27              "addtocart": {
28                "rest": {
29                  "params": {
30                    "items": [
31                      {
32                        "quantity": 1,
33                        "parentId": "8021N000006wtU7QAI",
34                        "itemId": "01u1N00000C1WAlQAN"
35                      }
36                    ],
37                    "cartId": "8011N00000157LkQAI",
38                    "price": true,
39                    "validate": true,
40                    "includeAttachment": false,
41                    "pagesize": 20,
42                    "lastRecordId": null,
43                    "query": null
44                  },
45                  "method": "POST",
46                  "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/8011N00000157LkQAI/items"
47                },
48                "remote": {
49                  "params": {
50                    "methodName": "postCartsItems",
51                    "items": [
52                      {
53                        "quantity": 1,
54                        "parentId": "8021N000006wtU7QAI",
55                        "itemId": "01u1N00000C1WAlQAN"
56                      }
57                    ],
58                    "cartId": "8011N00000157LkQAI",
59                    "price": true,
60                    "validate": true,
61                    "includeAttachment": false,
62                    "pagesize": 20,
63                    "lastRecordId": null,
64                    "query": null
65                  }
66                },
67                "client": {
68                  "params": {}
69                }
70              },
71              "updateitems": {
72                "rest": {
73                  "params": {
74                    "items": [
75                      {
76                        "itemId": "8021N000006wtU7QAI"
77                      }
78                    ],
79                    "filters": null,
80                    "fields": null,
81                    "cartId": "8011N00000157LkQAI",
82                    "price": true,
83                    "validate": true,
84                    "includeAttachment": false,
85                    "pagesize": 20,
86                    "lastRecordId": null,
87                    "query": null
88                  },
89                  "method": "PUT",
90                  "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/8011N00000157LkQAI/items"
91                },
92                "remote": {
93                  "params": {
94                    "methodName": "putCartsItems",
95                    "items": [
96                      {
97                        "itemId": "8021N000006wtU7QAI"
98                      }
99                    ],
100                    "filters": null,
101                    "fields": null,
102                    "cartId": "8011N00000157LkQAI",
103                    "price": true,
104                    "validate": true,
105                    "includeAttachment": false,
106                    "pagesize": 20,
107                    "lastRecordId": null,
108                    "query": null
109                  }
110                },
111                "client": {
112                  "params": {}
113                }
114              },
115...
116[EXAMPLE TRUNCATED FOR BREVITY]