Get Products by ID

Retrieve a list of products and attributes for the specified price book entry ID.

GET /v2/cpq/carts/{cart_ID}/products?{ID}&includeAttachment=[true|false]

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

getCartsProductsById

REST Handler

APIProductsCartsCpqV2

Apex Remote Service

CpqAppHandler

Apex Remote Input Map

{
  methodName:getCartsProductsById,
  cartId:801360000008eNU,
  id: 991360000008eNU,
  includeAttachment: true,
  fields: Product2.vlocity_cmt__CustomField__c
}

Package

Communication (vlocity_cmt)

API Parameters and Response Format

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

Example Request

GET
/v2/cpq/carts/{cart_ID}/products?id=01t36000000pfcKAAQ,01t36000000pfcKAAQ&includeAttachment=true

Example Response

note: This example result has been truncated.

{
   "totalSize" => 1,
   "messages" => [],
   "records" => [{
      "messages" => [],
      "actions" => {
         "addtocart" => {
            "rest" => {
               "params" => {
                  "items" => [{
                     "itemId" => "01u6A00000135XPQAY"
                  }],
                  "cartId" => "8016A000000bwDJQAY",
                  "price" => true,
                  "validate" => true,
                  "includeAttachment" => true,
                  "pagesize" => 20,
                  "lastRecordId" => nil,
                  "query" => nil
               },
               "method" => "POST",
               "link" =>
               "/services/apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/items"
            },
            "remote" => {
               "params" => {
                  "methodName" => "postCartsItems",
                  "items" => [{
                     "itemId" => "01u6A00000135XPQAY"
                  }],
                  "cartId" => "8016A000000bwDJQAY",
                  "price" => true,
                  "validate" => true,
                  "includeAttachment" => true,
                  "pagesize" => 20,
                  "lastRecordId" => nil,
                  "query" => nil
               }
            },
            "client" => {
               "params" => {}
            }
         },
         "getproductbyid" => {
            "rest" => {
               "params" => {},
               "method" => "GET",
               "link" =>
               "/services/apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/products?cartId=8016A000000bwDJQAY&id=01u6A00000135XPQAY"
            },
            "remote" => {
               "params" => {
               "methodName" => "getCartsProductsById",
               "id" => "01u6A00000135XPQAY",
               "cartId" => "8016A000000bwDJQAY"
            }
         },
         "client" => {
            "params" => {
               "cartId" => "8016A000000bwDJQAY",
               "id" => "01u6A00000135XPQAY",
               "methodName" => "getCartsProductsById"
            }
         }
      }
   },
   "displaySequence" => -1,
   "Id" => {
      "label" => "Price Book Entry ID", "value" => "01u6A00000135XPQAY"
   },
   "Pricebook2Id" => {
      "label" => "Price Book ID", "value" => "01s6A0000037JCtQAM"
   },
   "Product2Id" => {
      "label" => "Product ID", "value" => "01t6A000000fczvQAA"
   },
   "ProductCode" => {
      "label" => "Product Code", "value" => "IRKP1"
   },
   "UnitPrice" => {
      "label" => "List Price", "value" => nil
   },
   "Name" => {
      "label" => "Product Name", "value" => "IRKP1"
   },
   "vlocity_cmt__RecurringPrice__c" => {
      "label" => "Recurring Price", "value" => nil
   },
   "IsActive" => {
      "label" => "Active", "value" => true
   },
   "Product2" => {
      "attributes" => {
         "type" => "Product2",
         "url" => "/services/data/v40.0/sobjects/Product2/01t6A000000fczvQAA"
      },
      "Id" => "01t6A000000fczvQAA",
      "Name" => "IRKP1",
      "vlocity_cmt__IsConfigurable__c" => false,
      "vlocity_cmt__Type__c" => "None",
      "vlocity_cmt__SubType__c" => "None",
      "RecordTypeId" => "0126A000000gwBfQAI"
   },
   "productId" => "01t6A000000fczvQAA",
   "defaultQuantity" => 1.0,
   "minQuantity" => 0.0,
   "maxQuantity" => 99999.0,
   "groupMinQuantity" => 0,
   "groupMaxQuantity" => 99999,
   "sequenceNumber" => 1.0,
   "productChildItemId" => "a2a6A000000wm6IQAQ",
   "productChildItemDefinition" => {
      "attributes" => {
         "type" => "vlocity_cmt__ProductChildItem__c",
         "url" =>
         "/services/data/v40.0/sobjects/vlocity_cmt__ProductChildItem__c/a2a6A000000wm6IQAQ"
      },
      "vlocity_cmt__MinQuantity__c" => 0,
      "vlocity_cmt__SeqNumber__c" => 1.0,
      "Name" => "Root PCI",
      "Id" => "a2a6A000000wm6IQAQ",
      "vlocity_cmt__Quantity__c" => 1,
      "vlocity_cmt__MaximumChildItemQuantity__c" => 99999,
      "vlocity_cmt__ParentProductId__r" => {
         "attributes" => {
            "type" => "Product2",
            "url" =>
            "/services/data/v40.0/sobjects/Product2/01t6A000000fczvQAA"
         },
         "Name" => "IRKP1",
         "Id" => "01t6A000000fczvQAA",
         "RecordTypeId" => "0126A000000gwBfQAI"
      },
      "vlocity_cmt__MaxQuantity__c" => 99999,
      "vlocity_cmt__MinimumChildItemQuantity__c" => 0,
      "vlocity_cmt__CollapseHierarchy__c" => false,
      "vlocity_cmt__IsOverride__c" => false,
      "vlocity_cmt__IsVirtualItem__c" => false,
      "vlocity_cmt__ChildLineNumber__c" => "1",
      "vlocity_cmt__IsRootProductChildItem__c" => true,
      "vlocity_cmt__ParentProductId__c" => "01t6A000000fczvQAA"
   },
   "productHierarchyPath" => "01t6A000000fczvQAA",
   "name" => "IRKP1",
   "isVirtualItem" => false,
   "attributeValues" => {},
   "hasChildren" => true,
   "itemType" => "childProduct",
   "category" => "Qualified",
   "productCategories" => {
      "totalSize" => 0, "messages" => []
   },
   "childProducts" => {
      "totalSize" => 0,
      "messages" => [],
      "records" => [{
         "messages" => [],
         "displaySequence" => -1,
         "Id" => {
            "label" => "Price Book Entry ID", "value" => "01u6A00000135XUQAY"
         },
         "Pricebook2Id" => {
            "label" => "Price Book ID", "value" => "01s6A0000037JCtQAM"
         },
         "Product2Id" => {
            "label" => "Product ID", "value" => "01t6A000000fd00QAA"
         },
         "ProductCode" => {
            "label" => "Product Code", "value" => "IRKADDON"
         },
         "UnitPrice" => {
            "label" => "List Price", "value" => nil
         },
         "Name" => {
            "label" => "Product Name", "value" => "IRKADDON"
         },
         "vlocity_cmt__RecurringPrice__c" => {
            "label" => "Recurring Price", "value" => nil
         },
         "IsActive" => {
            "label" => "Active", "value" => true
         },
         "Product2" => {
            "attributes" => {
               "type" => "Product2",
               "url" =>
               "/services/data/v40.0/sobjects/Product2/01t6A000000fd00QAA"
            },
            "Id" => "01t6A000000fd00QAA",
            "Name" => "IRKADDON",
            "vlocity_cmt__IsConfigurable__c" => false,
            "vlocity_cmt__Type__c" => "None",
            "vlocity_cmt__SubType__c" => "None",
            "RecordTypeId" => "0126A000000gwBfQAI"
         },
         "productId" => "01t6A000000fd00QAA",
         "defaultQuantity" => 0.0,
         "minQuantity" => 0.0,
         "maxQuantity" => 1.0,
         "groupMinQuantity" => 0,
         "groupMaxQuantity" => 99999,
         "sequenceNumber" => 1.0,
         "productChildItemId" => "a2a6A000000wm6cQAA",
         "productChildItemDefinition" => {
            "attributes" =>
            :
         "vlocity_cmt__RecurringPrice__c" => {
            "label" => "Recurring Price", "value" => nil
         },
         "IsActive" => {
            "label" => "Active", "value" => true
         },
         "Product2" => {
            "attributes" => {
               "type" => "Product2",
               "url" =>
               "/services/data/v40.0/sobjects/Product2/01t6A000000fd00QAA"
            },
            "Id" => "01t6A000000fd00QAA",
            "Name" => "IRKADDON",
            "vlocity_cmt__IsConfigurable__c" => false,
            "vlocity_cmt__Type__c" => "None",
            "vlocity_cmt__SubType__c" => "None",
            "RecordTypeId" => "0126A000000gwBfQAI"
         },
         "productId" => "01t6A000000fd00QAA",
         "defaultQuantity" => 0.0,
         "minQuantity" => 0.0,
         "maxQuantity" => 1.0,
         "groupMinQuantity" => 0,
         "groupMaxQuantity" => 99999,
         "sequenceNumber" => 1.0,
         "productChildItemId" => "a2a6A000000wm6cQAA",
         "productChildItemDefinition" => {
            "attributes" => {
               "type" => "vlocity_cmt__ProductChildItem__c",:
               "vlocity_cmt__RecurringPrice__c" => {
                  "label" => "Recurring Price", "value" => nil
               },
               "IsActive" => {
                  "label" => "Active", "value" => true
               },
               "Product2" => {
                  "attributes" => {
                     "type" => "Product2",
                     "url" =>
                     "/services/data/v40.0/sobjects/Product2/01t6A000000fd00QAA"
                  },
                  "Id" => "01t6A000000fd00QAA",
                  "Name" => "IRKADDON",
                  "vlocity_cmt__IsConfigurable__c" => false,
                  "vlocity_cmt__Type__c" => "None",
                  "vlocity_cmt__SubType__c" => "None",
                  "RecordTypeId" => "0126A000000gwBfQAI"
               },
               "productId" => "01t6A000000fd00QAA",
               "defaultQuantity" => 0.0,
               "minQuantity" => 0.0,
               "maxQuantity" => 1.0,
               "groupMinQuantity" => 0,
               "groupMaxQuantity" => 99999,
               "sequenceNumber" => 1.0,
               "productChildItemId" => "a2a6A000000wm6cQAA",
               "productChildItemDefinition" => {
                  "attributes" => {
                     "type" => "vlocity_cmt__ProductChildItem__c",
                     "url" =>
                     "/services/data/v40.0/sobjects/vlocity_cmt__ProductChildItem__c/a2a6A000000wm6cQAA"
                  },
               "vlocity_cmt__ChildProductId__c" => "01t6A000000fd00QAA",
               "vlocity_cmt__MinQuantity__c" => 0,
               "vlocity_cmt__SeqNumber__c" => 1.0,
               "Name" => "a2a6A000000wm6c",
               "Id" => "a2a6A000000wm6cQAA",
               "vlocity_cmt__Quantity__c" => 0,
               "vlocity_cmt__MaximumChildItemQuantity__c" => 99999,
               "vlocity_cmt__ParentProductId__r" => {
                  "attributes" => {
                     "type" => "Product2",
                     "url" =>
                     "/services/data/v40.0/sobjects/Product2/01t6A000000fczvQAA"
                  },
                  "Name" => "IRKP1",
                  "Id" => "01t6A000000fczvQAA",
                  "RecordTypeId" => "0126A000000gwBfQAI"
               },
               "vlocity_cmt__MaxQuantity__c" => 1,
               "vlocity_cmt__ChildProductId__r" => {
                  "attributes" => {
                     "type" => "Product2",
                     "url" =>
                     "/services/data/v40.0/sobjects/Product2/01t6A000000fd00QAA"
                  },
                  "Id" => "01t6A000000fd00QAA",
                  "RecordTypeId" => "0126A000000gwBfQAI"
                  },
                  "vlocity_cmt__MinimumChildItemQuantity__c" => 0,
                  "vlocity_cmt__CollapseHierarchy__c" => false,
                  "vlocity_cmt__IsOverride__c" => false,
                  "vlocity_cmt__IsVirtualItem__c" => false,
                  "vlocity_cmt__ChildLineNumber__c" => "1",
                  "vlocity_cmt__IsRootProductChildItem__c" => false,
                  "vlocity_cmt__ParentProductId__c" => "01t6A000000fczvQAA"
               },
               "productHierarchyPath" => "01t6A000000fczvQAA<01t6A000000fd00QAA",
               "isVirtualItem" => false,
               "attributeValues" => {},
               "hasChildren" => true,
               "itemType" => "childProduct",
               "productCategories" => {
                  "totalSize" => 0, "messages" => []
               },