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.

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

runCartValidation

REST Handler

validate

Apex Remote Service

Class:

vlocity_cmt.CardCanvasController

Method:

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

Apex Remote Input Map

String sClassName: vlocity_cmt.CpqAppHandler
String sMethodName: runCartValidation
String input: {
 "cartId": "8011N00000157LkQAI",
 "methodName": "runCartValidation",
 "price": true,
 "validate": true
}
String options: {
 "vlcClass": "vlocity_cmt.CpqAppHandler"
}

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

Example Request

{
    "cartId": "8011N00000157LkQAI",
    "methodName": "runCartValidation",
    "price": true,
    "validate": true
}

Example Response

{
  "totalSize": 0,
  "messages": [],
  "actions": {
    "itemadded": {
      "rest": {
        "params": {},
        "method": null,
        "link": null
      },
      "remote": {
        "params": {}
      },
      "client": {
        "params": {
          "items": [
            {
              "message": "Product Hier 6 Child 3 has been auto-added to the cart.",
              "Id": "8021N000006wtUCQAY"
            }
          ]
        },
        "records": [
          {
            "messages": [],
            "actions": {
              "addtocart": {
                "rest": {
                  "params": {
                    "items": [
                      {
                        "quantity": 1,
                        "parentId": "8021N000006wtU7QAI",
                        "itemId": "01u1N00000C1WAlQAN"
                      }
                    ],
                    "cartId": "8011N00000157LkQAI",
                    "price": true,
                    "validate": true,
                    "includeAttachment": false,
                    "pagesize": 20,
                    "lastRecordId": null,
                    "query": null
                  },
                  "method": "POST",
                  "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/8011N00000157LkQAI/items"
                },
                "remote": {
                  "params": {
                    "methodName": "postCartsItems",
                    "items": [
                      {
                        "quantity": 1,
                        "parentId": "8021N000006wtU7QAI",
                        "itemId": "01u1N00000C1WAlQAN"
                      }
                    ],
                    "cartId": "8011N00000157LkQAI",
                    "price": true,
                    "validate": true,
                    "includeAttachment": false,
                    "pagesize": 20,
                    "lastRecordId": null,
                    "query": null
                  }
                },
                "client": {
                  "params": {}
                }
              },
              "updateitems": {
                "rest": {
                  "params": {
                    "items": [
                      {
                        "itemId": "8021N000006wtU7QAI"
                      }
                    ],
                    "filters": null,
                    "fields": null,
                    "cartId": "8011N00000157LkQAI",
                    "price": true,
                    "validate": true,
                    "includeAttachment": false,
                    "pagesize": 20,
                    "lastRecordId": null,
                    "query": null
                  },
                  "method": "PUT",
                  "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/8011N00000157LkQAI/items"
                },
                "remote": {
                  "params": {
                    "methodName": "putCartsItems",
                    "items": [
                      {
                        "itemId": "8021N000006wtU7QAI"
                      }
                    ],
                    "filters": null,
                    "fields": null,
                    "cartId": "8011N00000157LkQAI",
                    "price": true,
                    "validate": true,
                    "includeAttachment": false,
                    "pagesize": 20,
                    "lastRecordId": null,
                    "query": null
                  }
                },
                "client": {
                  "params": {}
                }
              },
...
[EXAMPLE TRUNCATED FOR BREVITY]