Get List of Products

Return the list of products that match the specified criteria.

  • Query with the text the customer enters

  • Attributes

  • Product hierarchy

  • The last record ID from the previous search result, if available

  • The page size of the number of products to return; the default is 20

    In Vlocity CMT V15, if the page size is set to 20, the API does not return images.

    Note

  • Product IDs

1GET /v2/cpq/carts/{cart_ID}/products?query={query}&attributes={attribute_code:value}&lastRecordId={record_ID}&pagesize={n}&includeAttachment={true|false}&category={category}&filters={filters}&includeIneligible={true|false}

Use includeAttachment to indicate whether product attachments are returned.

The value specified for attribute_code must be the Code of the Attribute, not the Name or ID.

The attributes filter for picklist type attributes takes into account all possible values, not just the selected value. If you want to filter based on specific Attribute Values, then assign the Attribute Value Type as Multi Picklist.

Use the includeIneligible=true parameter if you are using context rules to control product visibility in the product list. You can use the category field to see if a product is qualified or disqualified

To specify a product name using a locale other than the user’s locale, set the localeCode parameter to the desired locale and the query parameter to the name of the product. For example:

1GET /services/apexrest/vlocity_cmt/v2/cpq/carts/8011N000002BL2P/products?localeCode=fr&query=échantillon

Get Products replaces the OmniCPQServiceWrapper getProducts method.

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.

  • If a Simple Offer Specification is associated with a Simple Product Specification, the API returns the Min, Max, and Default cardinality from the Simple Product Specification.
  • This applies only to the response. When adding items to the cart (postCartsItems), the system enforces the stricter cardinality defined in the Simple Offer Specification, even if the response shows different values.

Note

Remote Method 

1getCartsProducts

REST Handler 

1APIProductsCartsCpqV2

Apex Remote Service 

1CpqAppHandler

Apex Remote Input Map 

1{
2  methodName:getCartsProducts,
3  cartId:801360000008eNU,
4  query:iphone,
5  attributes: ATT_DEVICESIZE:32GB_64GB,ATT_DEVICECOLOR:RED,
6  maxProdListHierarchy: 1,
7  lastProductId:,
8  pagesize: 10,
9  includeAttachment: true,
10  fields: Product2.vlocity_cmt__CustomField__c
11}
12cartId = order.Id, opportunity.Id, quote.Id

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/services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/products

Example Request 

1GET
2/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8H/products?pagesize=5

Example Response 

1{
2  "totalSize": 5,
3  "messages": [],
4  "actions": {
5    "nextproducts": {
6      "rest": {
7        "params": {},
8        "method": "GET",
9        "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/products?lastRecordId=01u41000001QPtsAAG&pagesize=5&includeAttachment=false"
10      },
11      "remote": {
12        "params": {
13          "includeAttachment": false,
14          "pagesize": 5,
15          "lastRecordId": "01u41000001QPtsAAG",
16          "cartId": "80141000000Cg8HAAS",
17          "methodName": "getCartsProducts"
18        }
19      },
20      "client": {
21        "params": {}
22      }
23    }
24  },
25  "records": [
26    {
27      "messages": [],
28      "actions": {
29        "addtocart": {
30          "rest": {
31            "params": {
32              "price": true,
33              "validate": true,
34              "includeAttachment": false,
35              "pagesize": 5,
36              "lastRecordId": null,
37              "query": null,
38              "items": [
39                {
40                  "quantity": 1,
41                  "itemId": "01u41000001QPs0AAG"
42                }
43              ]
44            },
45            "method": "POST",
46            "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/items"
47          },
48          "remote": {
49            "params": {
50              "price": true,
51              "validate": true,
52              "includeAttachment": false,
53              "pagesize": 5,
54              "lastRecordId": null,
55              "query": null,
56              "items": [
57                {
58                  "quantity": 1,
59                  "itemId": "01u41000001QPs0AAG"
60                }
61              ],
62              "cartId": "80141000000Cg8HAAS",
63              "methodName": "postCartsItems"
64            }
65          },
66          "client": {
67            "params": {}
68          }
69        }
70      },
71      "displaySequence": -1,
72      "Id": {
73        "label": "Price Book Entry ID",
74        "value": "01u41000001QPs0AAG"
75      },
76      "Pricebook2Id": {
77        "label": "Price Book ID",
78        "value": "01s41000005dPYQAA2"
79      },
80      "Product2Id": {
81        "label": "Product ID",
82        "value": "01t41000000sYZQAA2"
83      },
84      "UnitPrice": {
85        "label": "List Price",
86        "value": 1
87      },
88      "Name": {
89        "label": "Product Name",
90        "value": "Root 1"
91      },
92      "IsActive": {
93        "label": "Active",
94        "value": true
95      },
96      "Product2": {
97        "attributes": {
98          "type": "Product2",
99          "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYZQAA2"
100        },
101        "Id": "01t41000000sYZQAA2",
102        "Name": "Root 1",
103        "vlocity_cmt__IsConfigurable__c": false,
104        "vlocity_cmt__Type__c": "None",
105        "vlocity_cmt__SubType__c": "None",
106        "RecordTypeId": "012410000006OWUAA2"
107      },
108      "productId": "01t41000000sYZQAA2",
109      "defaultQuantity": 1,
110      "minQuantity": 0,
111      "maxQuantity": 99999,
112      "groupMinQuantity": 0,
113      "groupMaxQuantity": 99999,
114      "sequenceNumber": 1,
115      "productChildItemId": "a2541000000G09wAAC",
116      "productChildItemDefinition": {
117        "attributes": {
118          "type": "vlocity_cmt__ProductChildItem__c",
119          "url": "/services/data/v38.0/sobjects/vlocity_cmt__ProductChildItem__c/a2541000000G09wAAC"
120        },
121        "Id": "a2541000000G09wAAC",
122        "Name": "Root PCI",
123        "vlocity_cmt__IsVirtualItem__c": false,
124        "vlocity_cmt__Quantity__c": 1,
125        "vlocity_cmt__MaxQuantity__c": 99999,
126        "vlocity_cmt__MinQuantity__c": 0,
127        "vlocity_cmt__MaximumChildItemQuantity__c": 99999,
128        "vlocity_cmt__MinimumChildItemQuantity__c": 0,
129        "vlocity_cmt__IsOverride__c": false,
130        "vlocity_cmt__ParentProductId__c": "01t41000000sYZQAA2",
131        "vlocity_cmt__ChildLineNumber__c": "1",
132        "vlocity_cmt__SeqNumber__c": 1,
133        "vlocity_cmt__CollapseHierarchy__c": false,
134        "vlocity_cmt__IsRootProductChildItem__c": true,
135        "vlocity_cmt__ParentProductId__r": {
136          "attributes": {
137            "type": "Product2",
138            "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYZQAA2"
139          },
140          "Id": "01t41000000sYZQAA2",
141          "Name": "Root 1"
142        }
143      },
144      "productHierarchyPath": "01t41000000sYZQAA2",
145      "name": "Root 1",
146      "isVirtualItem": false,
147      "attributeValues": {},
148      "itemType": "childProduct"
149    },
150    {
151      "messages": [],
152      "actions": {
153        "addtocart": {
154          "rest": {
155            "params": {
156              "price": true,
157              "validate": true,
158              "includeAttachment": false,
159              "pagesize": 5,
160              "lastRecordId": null,
161              "query": null,
162              "items": [
163                {
164                  "quantity": 1,
165                  "itemId": "01u41000001QPs5AAG"
166                }
167              ]
168            },
169            "method": "POST",
170            "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/items"
171          },
172          "remote": {
173            "params": {
174              "price": true,
175              "validate": true,
176              "includeAttachment": false,
177              "pagesize": 5,
178              "lastRecordId": null,
179              "query": null,
180              "items": [
181                {
182                  "quantity": 1,
183                  "itemId": "01u41000001QPs5AAG"
184                }
185              ],
186              "cartId": "80141000000Cg8HAAS",
187              "methodName": "postCartsItems"
188            }
189          },
190          "client": {
191            "params": {}
192          }
193        }
194      },
195      "displaySequence": -1,
196      "Id": {
197        "label": "Price Book Entry ID",
198        "value": "01u41000001QPs5AAG"
199      },
200      "Pricebook2Id": {
201        "label": "Price Book ID",
202        "value": "01s41000005dPYQAA2"
203      },
204      "Product2Id": {
205        "label": "Product ID",
206        "value": "01t41000000sYZVAA2"
207      },
208      "UnitPrice": {
209        "label": "List Price",
210        "value": 2
211      },
212      "Name": {
213        "label": "Product Name",
214        "value": "Parent 1"
215      },
216      "IsActive": {
217        "label": "Active",
218        "value": true
219      },
220      "Product2": {
221        "attributes": {
222          "type": "Product2",
223          "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYZVAA2"
224        },
225        "Id": "01t41000000sYZVAA2",
226        "Name": "Parent 1",
227        "vlocity_cmt__IsConfigurable__c": false,
228        "vlocity_cmt__Type__c": "None",
229        "vlocity_cmt__SubType__c": "None",
230        "RecordTypeId": "012410000006OWUAA2"
231      },
232      "productId": "01t41000000sYZVAA2",
233      "defaultQuantity": 1,
234      "minQuantity": 0,
235      "maxQuantity": 99999,
236      "groupMinQuantity": 0,
237      "groupMaxQuantity": 99999,
238      "sequenceNumber": 1,
239      "productChildItemId": "a2541000000G0A1AAK",
240      "productChildItemDefinition": {
241        "attributes": {
242          "type": "vlocity_cmt__ProductChildItem__c",
243          "url": "/services/data/v38.0/sobjects/vlocity_cmt__ProductChildItem__c/a2541000000G0A1AAK"
244        },
245        "Id": "a2541000000G0A1AAK",
246        "Name": "Root PCI",
247        "vlocity_cmt__IsVirtualItem__c": false,
248        "vlocity_cmt__Quantity__c": 1,
249        "vlocity_cmt__MaxQuantity__c": 99999,
250        "vlocity_cmt__MinQuantity__c": 0,
251        "vlocity_cmt__MaximumChildItemQuantity__c": 99999,
252        "vlocity_cmt__MinimumChildItemQuantity__c": 0,
253        "vlocity_cmt__IsOverride__c": false,
254        "vlocity_cmt__ParentProductId__c": "01t41000000sYZVAA2",
255        "vlocity_cmt__ChildLineNumber__c": "1",
256        "vlocity_cmt__SeqNumber__c": 1,
257        "vlocity_cmt__CollapseHierarchy__c": false,
258        "vlocity_cmt__IsRootProductChildItem__c": true,
259        "vlocity_cmt__ParentProductId__r": {
260          "attributes": {
261            "type": "Product2",
262            "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYZVAA2"
263          },
264          "Id": "01t41000000sYZVAA2",
265          "Name": "Parent 1"
266        }
267      },
268      "productHierarchyPath": "01t41000000sYZVAA2",
269      "name": "Parent 1",
270      "isVirtualItem": false,
271      "attributeValues": {},
272      "itemType": "childProduct"
273    },
274    {
275      "messages": [],
276      "actions": {
277        "addtocart": {
278          "rest": {
279            "params": {
280              "price": true,
281              "validate": true,
282              "includeAttachment": false,
283              "pagesize": 5,
284              "lastRecordId": null,
285              "query": null,
286              "items": [
287                {
288                  "quantity": 1,
289                  "itemId": "01u41000001QPtmAAG"
290                }
291              ]
292            },
293            "method": "POST",
294            "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/items"
295          },
296          "remote": {
297            "params": {
298              "price": true,
299              "validate": true,
300              "includeAttachment": false,
301              "pagesize": 5,
302              "lastRecordId": null,
303              "query": null,
304              "items": [
305                {
306                  "quantity": 1,
307                  "itemId": "01u41000001QPtmAAG"
308                }
309              ],
310              "cartId": "80141000000Cg8HAAS",
311              "methodName": "postCartsItems"
312            }
313          },
314          "client": {
315            "params": {}
316          }
317        }
318      },
319      "displaySequence": -1,
320      "Id": {
321        "label": "Price Book Entry ID",
322        "value": "01u41000001QPtmAAG"
323      },
324      "Pricebook2Id": {
325        "label": "Price Book ID",
326        "value": "01s41000005dPYQAA2"
327      },
328      "Product2Id": {
329        "label": "Product ID",
330        "value": "01t41000000sYaIAAU"
331      },
332      "UnitPrice": {
333        "label": "List Price",
334        "value": 1
335      },
336      "Name": {
337        "label": "Product Name",
338        "value": "Child 1"
339      },
340      "IsActive": {
341        "label": "Active",
342        "value": true
343      },
344      "Product2": {
345        "attributes": {
346          "type": "Product2",
347          "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaIAAU"
348        },
349        "Id": "01t41000000sYaIAAU",
350        "Name": "Child 1",
351        "vlocity_cmt__IsConfigurable__c": false,
352        "vlocity_cmt__Type__c": "None",
353        "vlocity_cmt__SubType__c": "None",
354        "RecordTypeId": "012410000006OWUAA2"
355      },
356      "productId": "01t41000000sYaIAAU",
357      "defaultQuantity": 1,
358      "minQuantity": 0,
359      "maxQuantity": 99999,
360      "groupMinQuantity": 0,
361      "groupMaxQuantity": 99999,
362      "sequenceNumber": 1,
363      "productChildItemId": "a2541000000G0A6AAK",
364      "productChildItemDefinition": {
365        "attributes": {
366          "type": "vlocity_cmt__ProductChildItem__c",
367          "url": "/services/data/v38.0/sobjects/vlocity_cmt__ProductChildItem__c/a2541000000G0A6AAK"
368        },
369        "Id": "a2541000000G0A6AAK",
370        "Name": "Root PCI",
371        "vlocity_cmt__IsVirtualItem__c": false,
372        "vlocity_cmt__Quantity__c": 1,
373        "vlocity_cmt__MaxQuantity__c": 99999,
374        "vlocity_cmt__MinQuantity__c": 0,
375        "vlocity_cmt__MaximumChildItemQuantity__c": 99999,
376        "vlocity_cmt__MinimumChildItemQuantity__c": 0,
377        "vlocity_cmt__IsOverride__c": false,
378        "vlocity_cmt__ParentProductId__c": "01t41000000sYaIAAU",
379        "vlocity_cmt__ChildLineNumber__c": "1",
380        "vlocity_cmt__SeqNumber__c": 1,
381        "vlocity_cmt__CollapseHierarchy__c": false,
382        "vlocity_cmt__IsRootProductChildItem__c": true,
383        "vlocity_cmt__ParentProductId__r": {
384          "attributes": {
385            "type": "Product2",
386            "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaIAAU"
387          },
388          "Id": "01t41000000sYaIAAU",
389          "Name": "Child 1"
390        }
391      },
392      "productHierarchyPath": "01t41000000sYaIAAU",
393      "name": "Child 1",
394      "isVirtualItem": false,
395      "attributeValues": {},
396      "itemType": "childProduct"
397    },
398    {
399      "messages": [],
400      "actions": {
401        "addtocart": {
402          "rest": {
403            "params": {
404              "price": true,
405              "validate": true,
406              "includeAttachment": false,
407              "pagesize": 5,
408              "lastRecordId": null,
409              "query": null,
410              "items": [
411                {
412                  "quantity": 1,
413                  "itemId": "01u41000001QPtrAAG"
414                }
415              ]
416            },
417            "method": "POST",
418            "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/items"
419          },
420          "remote": {
421            "params": {
422              "price": true,
423              "validate": true,
424              "includeAttachment": false,
425              "pagesize": 5,
426              "lastRecordId": null,
427              "query": null,
428              "items": [
429                {
430                  "quantity": 1,
431                  "itemId": "01u41000001QPtrAAG"
432                }
433              ],
434              "cartId": "80141000000Cg8HAAS",
435              "methodName": "postCartsItems"
436            }
437          },
438          "client": {
439            "params": {}
440          }
441        }
442      },
443      "displaySequence": -1,
444      "Id": {
445        "label": "Price Book Entry ID",
446        "value": "01u41000001QPtrAAG"
447      },
448      "Pricebook2Id": {
449        "label": "Price Book ID",
450        "value": "01s41000005dPYQAA2"
451      },
452      "Product2Id": {
453        "label": "Product ID",
454        "value": "01t41000000sYaNAAU"
455      },
456      "UnitPrice": {
457        "label": "List Price",
458        "value": 1
459      },
460      "Name": {
461        "label": "Product Name",
462        "value": "GC 1"
463      },
464      "IsActive": {
465        "label": "Active",
466        "value": true
467      },
468      "Product2": {
469        "attributes": {
470          "type": "Product2",
471          "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaNAAU"
472        },
473        "Id": "01t41000000sYaNAAU",
474        "Name": "GC 1",
475        "vlocity_cmt__IsConfigurable__c": false,
476        "vlocity_cmt__Type__c": "None",
477        "vlocity_cmt__SubType__c": "None",
478        "RecordTypeId": "012410000006OWUAA2"
479      },
480      "productId": "01t41000000sYaNAAU",
481      "defaultQuantity": 1,
482      "minQuantity": 0,
483      "maxQuantity": 99999,
484      "groupMinQuantity": 0,
485      "groupMaxQuantity": 99999,
486      "sequenceNumber": 1,
487      "productChildItemId": "a2541000000G0ABAA0",
488      "productChildItemDefinition": {
489        "attributes": {
490          "type": "vlocity_cmt__ProductChildItem__c",
491          "url": "/services/data/v38.0/sobjects/vlocity_cmt__ProductChildItem__c/a2541000000G0ABAA0"
492        },
493        "Id": "a2541000000G0ABAA0",
494        "Name": "Root PCI",
495        "vlocity_cmt__IsVirtualItem__c": false,
496        "vlocity_cmt__Quantity__c": 1,
497        "vlocity_cmt__MaxQuantity__c": 99999,
498        "vlocity_cmt__MinQuantity__c": 0,
499        "vlocity_cmt__MaximumChildItemQuantity__c": 99999,
500        "vlocity_cmt__MinimumChildItemQuantity__c": 0,
501        "vlocity_cmt__IsOverride__c": false,
502        "vlocity_cmt__ParentProductId__c": "01t41000000sYaNAAU",
503        "vlocity_cmt__ChildLineNumber__c": "1",
504        "vlocity_cmt__SeqNumber__c": 1,
505        "vlocity_cmt__CollapseHierarchy__c": false,
506        "vlocity_cmt__IsRootProductChildItem__c": true,
507        "vlocity_cmt__ParentProductId__r": {
508          "attributes": {
509            "type": "Product2",
510            "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaNAAU"
511          },
512          "Id": "01t41000000sYaNAAU",
513          "Name": "GC 1"
514        }
515      },
516      "productHierarchyPath": "01t41000000sYaNAAU",
517      "name": "GC 1",
518      "isVirtualItem": false,
519      "attributeValues": {},
520      "itemType": "childProduct"
521    },
522    {
523      "messages": [],
524      "actions": {
525        "addtocart": {
526          "rest": {
527            "params": {
528              "price": true,
529              "validate": true,
530              "includeAttachment": false,
531              "pagesize": 5,
532              "lastRecordId": null,
533              "query": null,
534              "items": [
535                {
536                  "quantity": 1,
537                  "itemId": "01u41000001QPtsAAG"
538                }
539              ]
540            },
541            "method": "POST",
542            "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/items"
543          },
544          "remote": {
545            "params": {
546              "price": true,
547              "validate": true,
548              "includeAttachment": false,
549              "pagesize": 5,
550              "lastRecordId": null,
551              "query": null,
552              "items": [
553                {
554                  "quantity": 1,
555                  "itemId": "01u41000001QPtsAAG"
556                }
557              ],
558              "cartId": "80141000000Cg8HAAS",
559              "methodName": "postCartsItems"
560            }
561          },
562          "client": {
563            "params": {}
564          }
565        }
566      },
567      "displaySequence": -1,
568      "Id": {
569        "label": "Price Book Entry ID",
570        "value": "01u41000001QPtsAAG"
571      },
572      "Pricebook2Id": {
573        "label": "Price Book ID",
574        "value": "01s41000005dPYQAA2"
575      },
576      "Product2Id": {
577        "label": "Product ID",
578        "value": "01t41000000sYaSAAU"
579      },
580      "UnitPrice": {
581        "label": "List Price",
582        "value": 1
583      },
584      "Name": {
585        "label": "Product Name",
586        "value": "GC 2"
587      },
588      "IsActive": {
589        "label": "Active",
590        "value": true
591      },
592      "Product2": {
593        "attributes": {
594          "type": "Product2",
595          "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaSAAU"
596        },
597        "Id": "01t41000000sYaSAAU",
598        "Name": "GC 2",
599        "vlocity_cmt__IsConfigurable__c": false,
600        "vlocity_cmt__Type__c": "None",
601        "vlocity_cmt__SubType__c": "None",
602        "RecordTypeId": "012410000006OWUAA2"
603      },
604      "productId": "01t41000000sYaSAAU",
605      "defaultQuantity": 1,
606      "minQuantity": 0,
607      "maxQuantity": 99999,
608      "groupMinQuantity": 0,
609      "groupMaxQuantity": 99999,
610      "sequenceNumber": 1,
611      "productChildItemId": "a2541000000G0AGAA0",
612      "productChildItemDefinition": {
613        "attributes": {
614          "type": "vlocity_cmt__ProductChildItem__c",
615          "url": "/services/data/v38.0/sobjects/vlocity_cmt__ProductChildItem__c/a2541000000G0AGAA0"
616        },
617        "Id": "a2541000000G0AGAA0",
618        "Name": "Root PCI",
619        "vlocity_cmt__IsVirtualItem__c": false,
620        "vlocity_cmt__Quantity__c": 1,
621        "vlocity_cmt__MaxQuantity__c": 99999,
622        "vlocity_cmt__MinQuantity__c": 0,
623        "vlocity_cmt__MaximumChildItemQuantity__c": 99999,
624        "vlocity_cmt__MinimumChildItemQuantity__c": 0,
625        "vlocity_cmt__IsOverride__c": false,
626        "vlocity_cmt__ParentProductId__c": "01t41000000sYaSAAU",
627        "vlocity_cmt__ChildLineNumber__c": "1",
628        "vlocity_cmt__SeqNumber__c": 1,
629        "vlocity_cmt__CollapseHierarchy__c": false,
630        "vlocity_cmt__IsRootProductChildItem__c": true,
631        "vlocity_cmt__ParentProductId__r": {
632          "attributes": {
633            "type": "Product2",
634            "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaSAAU"
635          },
636          "Id": "01t41000000sYaSAAU",
637          "Name": "GC 2"
638        }
639      },
640      "productHierarchyPath": "01t41000000sYaSAAU",
641      "name": "GC 2",
642      "isVirtualItem": false,
643      "attributeValues": {},
644      "itemType": "childProduct"
645    }
646  ]
647}