Get Products by ID

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

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

1getCartsProductsById

REST Handler 

1APIProductsCartsCpqV2

Apex Remote Service 

1CpqAppHandler

Apex Remote Input Map 

1{
2  methodName:getCartsProductsById,
3  cartId:801360000008eNU,
4  id: 991360000008eNU,
5  includeAttachment: true,
6  fields: Product2.vlocity_cmt__CustomField__c
7}

Package 

Communication (vlocity_cmt)

API Parameters and Response Format 

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

Example Request 

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

Example Response 

This example result has been truncated.

Note

1{
2   "totalSize" => 1,
3   "messages" => [],
4   "records" => [{
5      "messages" => [],
6      "actions" => {
7         "addtocart" => {
8            "rest" => {
9               "params" => {
10                  "items" => [{
11                     "itemId" => "01u6A00000135XPQAY"
12                  }],
13                  "cartId" => "8016A000000bwDJQAY",
14                  "price" => true,
15                  "validate" => true,
16                  "includeAttachment" => true,
17                  "pagesize" => 20,
18                  "lastRecordId" => nil,
19                  "query" => nil
20               },
21               "method" => "POST",
22               "link" =>
23               "/services/apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/items"
24            },
25            "remote" => {
26               "params" => {
27                  "methodName" => "postCartsItems",
28                  "items" => [{
29                     "itemId" => "01u6A00000135XPQAY"
30                  }],
31                  "cartId" => "8016A000000bwDJQAY",
32                  "price" => true,
33                  "validate" => true,
34                  "includeAttachment" => true,
35                  "pagesize" => 20,
36                  "lastRecordId" => nil,
37                  "query" => nil
38               }
39            },
40            "client" => {
41               "params" => {}
42            }
43         },
44         "getproductbyid" => {
45            "rest" => {
46               "params" => {},
47               "method" => "GET",
48               "link" =>
49               "/services/apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/products?cartId=8016A000000bwDJQAY&id=01u6A00000135XPQAY"
50            },
51            "remote" => {
52               "params" => {
53               "methodName" => "getCartsProductsById",
54               "id" => "01u6A00000135XPQAY",
55               "cartId" => "8016A000000bwDJQAY"
56            }
57         },
58         "client" => {
59            "params" => {
60               "cartId" => "8016A000000bwDJQAY",
61               "id" => "01u6A00000135XPQAY",
62               "methodName" => "getCartsProductsById"
63            }
64         }
65      }
66   },
67   "displaySequence" => -1,
68   "Id" => {
69      "label" => "Price Book Entry ID", "value" => "01u6A00000135XPQAY"
70   },
71   "Pricebook2Id" => {
72      "label" => "Price Book ID", "value" => "01s6A0000037JCtQAM"
73   },
74   "Product2Id" => {
75      "label" => "Product ID", "value" => "01t6A000000fczvQAA"
76   },
77   "ProductCode" => {
78      "label" => "Product Code", "value" => "IRKP1"
79   },
80   "UnitPrice" => {
81      "label" => "List Price", "value" => nil
82   },
83   "Name" => {
84      "label" => "Product Name", "value" => "IRKP1"
85   },
86   "vlocity_cmt__RecurringPrice__c" => {
87      "label" => "Recurring Price", "value" => nil
88   },
89   "IsActive" => {
90      "label" => "Active", "value" => true
91   },
92   "Product2" => {
93      "attributes" => {
94         "type" => "Product2",
95         "url" => "/services/data/v40.0/sobjects/Product2/01t6A000000fczvQAA"
96      },
97      "Id" => "01t6A000000fczvQAA",
98      "Name" => "IRKP1",
99      "vlocity_cmt__IsConfigurable__c" => false,
100      "vlocity_cmt__Type__c" => "None",
101      "vlocity_cmt__SubType__c" => "None",
102      "RecordTypeId" => "0126A000000gwBfQAI"
103   },
104   "productId" => "01t6A000000fczvQAA",
105   "defaultQuantity" => 1.0,
106   "minQuantity" => 0.0,
107   "maxQuantity" => 99999.0,
108   "groupMinQuantity" => 0,
109   "groupMaxQuantity" => 99999,
110   "sequenceNumber" => 1.0,
111   "productChildItemId" => "a2a6A000000wm6IQAQ",
112   "productChildItemDefinition" => {
113      "attributes" => {
114         "type" => "vlocity_cmt__ProductChildItem__c",
115         "url" =>
116         "/services/data/v40.0/sobjects/vlocity_cmt__ProductChildItem__c/a2a6A000000wm6IQAQ"
117      },
118      "vlocity_cmt__MinQuantity__c" => 0,
119      "vlocity_cmt__SeqNumber__c" => 1.0,
120      "Name" => "Root PCI",
121      "Id" => "a2a6A000000wm6IQAQ",
122      "vlocity_cmt__Quantity__c" => 1,
123      "vlocity_cmt__MaximumChildItemQuantity__c" => 99999,
124      "vlocity_cmt__ParentProductId__r" => {
125         "attributes" => {
126            "type" => "Product2",
127            "url" =>
128            "/services/data/v40.0/sobjects/Product2/01t6A000000fczvQAA"
129         },
130         "Name" => "IRKP1",
131         "Id" => "01t6A000000fczvQAA",
132         "RecordTypeId" => "0126A000000gwBfQAI"
133      },
134      "vlocity_cmt__MaxQuantity__c" => 99999,
135      "vlocity_cmt__MinimumChildItemQuantity__c" => 0,
136      "vlocity_cmt__CollapseHierarchy__c" => false,
137      "vlocity_cmt__IsOverride__c" => false,
138      "vlocity_cmt__IsVirtualItem__c" => false,
139      "vlocity_cmt__ChildLineNumber__c" => "1",
140      "vlocity_cmt__IsRootProductChildItem__c" => true,
141      "vlocity_cmt__ParentProductId__c" => "01t6A000000fczvQAA"
142   },
143   "productHierarchyPath" => "01t6A000000fczvQAA",
144   "name" => "IRKP1",
145   "isVirtualItem" => false,
146   "attributeValues" => {},
147   "hasChildren" => true,
148   "itemType" => "childProduct",
149   "category" => "Qualified",
150   "productCategories" => {
151      "totalSize" => 0, "messages" => []
152   },
153   "childProducts" => {
154      "totalSize" => 0,
155      "messages" => [],
156      "records" => [{
157         "messages" => [],
158         "displaySequence" => -1,
159         "Id" => {
160            "label" => "Price Book Entry ID", "value" => "01u6A00000135XUQAY"
161         },
162         "Pricebook2Id" => {
163            "label" => "Price Book ID", "value" => "01s6A0000037JCtQAM"
164         },
165         "Product2Id" => {
166            "label" => "Product ID", "value" => "01t6A000000fd00QAA"
167         },
168         "ProductCode" => {
169            "label" => "Product Code", "value" => "IRKADDON"
170         },
171         "UnitPrice" => {
172            "label" => "List Price", "value" => nil
173         },
174         "Name" => {
175            "label" => "Product Name", "value" => "IRKADDON"
176         },
177         "vlocity_cmt__RecurringPrice__c" => {
178            "label" => "Recurring Price", "value" => nil
179         },
180         "IsActive" => {
181            "label" => "Active", "value" => true
182         },
183         "Product2" => {
184            "attributes" => {
185               "type" => "Product2",
186               "url" =>
187               "/services/data/v40.0/sobjects/Product2/01t6A000000fd00QAA"
188            },
189            "Id" => "01t6A000000fd00QAA",
190            "Name" => "IRKADDON",
191            "vlocity_cmt__IsConfigurable__c" => false,
192            "vlocity_cmt__Type__c" => "None",
193            "vlocity_cmt__SubType__c" => "None",
194            "RecordTypeId" => "0126A000000gwBfQAI"
195         },
196         "productId" => "01t6A000000fd00QAA",
197         "defaultQuantity" => 0.0,
198         "minQuantity" => 0.0,
199         "maxQuantity" => 1.0,
200         "groupMinQuantity" => 0,
201         "groupMaxQuantity" => 99999,
202         "sequenceNumber" => 1.0,
203         "productChildItemId" => "a2a6A000000wm6cQAA",
204         "productChildItemDefinition" => {
205            "attributes" =>
206            :
207         "vlocity_cmt__RecurringPrice__c" => {
208            "label" => "Recurring Price", "value" => nil
209         },
210         "IsActive" => {
211            "label" => "Active", "value" => true
212         },
213         "Product2" => {
214            "attributes" => {
215               "type" => "Product2",
216               "url" =>
217               "/services/data/v40.0/sobjects/Product2/01t6A000000fd00QAA"
218            },
219            "Id" => "01t6A000000fd00QAA",
220            "Name" => "IRKADDON",
221            "vlocity_cmt__IsConfigurable__c" => false,
222            "vlocity_cmt__Type__c" => "None",
223            "vlocity_cmt__SubType__c" => "None",
224            "RecordTypeId" => "0126A000000gwBfQAI"
225         },
226         "productId" => "01t6A000000fd00QAA",
227         "defaultQuantity" => 0.0,
228         "minQuantity" => 0.0,
229         "maxQuantity" => 1.0,
230         "groupMinQuantity" => 0,
231         "groupMaxQuantity" => 99999,
232         "sequenceNumber" => 1.0,
233         "productChildItemId" => "a2a6A000000wm6cQAA",
234         "productChildItemDefinition" => {
235            "attributes" => {
236               "type" => "vlocity_cmt__ProductChildItem__c",:
237               "vlocity_cmt__RecurringPrice__c" => {
238                  "label" => "Recurring Price", "value" => nil
239               },
240               "IsActive" => {
241                  "label" => "Active", "value" => true
242               },
243               "Product2" => {
244                  "attributes" => {
245                     "type" => "Product2",
246                     "url" =>
247                     "/services/data/v40.0/sobjects/Product2/01t6A000000fd00QAA"
248                  },
249                  "Id" => "01t6A000000fd00QAA",
250                  "Name" => "IRKADDON",
251                  "vlocity_cmt__IsConfigurable__c" => false,
252                  "vlocity_cmt__Type__c" => "None",
253                  "vlocity_cmt__SubType__c" => "None",
254                  "RecordTypeId" => "0126A000000gwBfQAI"
255               },
256               "productId" => "01t6A000000fd00QAA",
257               "defaultQuantity" => 0.0,
258               "minQuantity" => 0.0,
259               "maxQuantity" => 1.0,
260               "groupMinQuantity" => 0,
261               "groupMaxQuantity" => 99999,
262               "sequenceNumber" => 1.0,
263               "productChildItemId" => "a2a6A000000wm6cQAA",
264               "productChildItemDefinition" => {
265                  "attributes" => {
266                     "type" => "vlocity_cmt__ProductChildItem__c",
267                     "url" =>
268                     "/services/data/v40.0/sobjects/vlocity_cmt__ProductChildItem__c/a2a6A000000wm6cQAA"
269                  },
270               "vlocity_cmt__ChildProductId__c" => "01t6A000000fd00QAA",
271               "vlocity_cmt__MinQuantity__c" => 0,
272               "vlocity_cmt__SeqNumber__c" => 1.0,
273               "Name" => "a2a6A000000wm6c",
274               "Id" => "a2a6A000000wm6cQAA",
275               "vlocity_cmt__Quantity__c" => 0,
276               "vlocity_cmt__MaximumChildItemQuantity__c" => 99999,
277               "vlocity_cmt__ParentProductId__r" => {
278                  "attributes" => {
279                     "type" => "Product2",
280                     "url" =>
281                     "/services/data/v40.0/sobjects/Product2/01t6A000000fczvQAA"
282                  },
283                  "Name" => "IRKP1",
284                  "Id" => "01t6A000000fczvQAA",
285                  "RecordTypeId" => "0126A000000gwBfQAI"
286               },
287               "vlocity_cmt__MaxQuantity__c" => 1,
288               "vlocity_cmt__ChildProductId__r" => {
289                  "attributes" => {
290                     "type" => "Product2",
291                     "url" =>
292                     "/services/data/v40.0/sobjects/Product2/01t6A000000fd00QAA"
293                  },
294                  "Id" => "01t6A000000fd00QAA",
295                  "RecordTypeId" => "0126A000000gwBfQAI"
296                  },
297                  "vlocity_cmt__MinimumChildItemQuantity__c" => 0,
298                  "vlocity_cmt__CollapseHierarchy__c" => false,
299                  "vlocity_cmt__IsOverride__c" => false,
300                  "vlocity_cmt__IsVirtualItem__c" => false,
301                  "vlocity_cmt__ChildLineNumber__c" => "1",
302                  "vlocity_cmt__IsRootProductChildItem__c" => false,
303                  "vlocity_cmt__ParentProductId__c" => "01t6A000000fczvQAA"
304               },
305               "productHierarchyPath" => "01t6A000000fczvQAA<01t6A000000fd00QAA",
306               "isVirtualItem" => false,
307               "attributeValues" => {},
308               "hasChildren" => true,
309               "itemType" => "childProduct",
310               "productCategories" => {
311                  "totalSize" => 0, "messages" => []
312               },