# 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

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

- Product IDs

```nolang
GET /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:

```nolang
GET /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.

:::note
- 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.
:::

## Remote Method

```nolang
getCartsProducts
```

## REST Handler

```nolang
APIProductsCartsCpqV2
```

## Apex Remote Service

```nolang
CpqAppHandler
```

## Apex Remote Input Map

```nolang
{
  methodName:getCartsProducts,
  cartId:801360000008eNU,
  query:iphone,
  attributes: ATT_DEVICESIZE:32GB_64GB,ATT_DEVICECOLOR:RED,
  maxProdListHierarchy: 1,
  lastProductId:,
  pagesize: 10,
  includeAttachment: true,
  fields: Product2.vlocity_cmt__CustomField__c
}
cartId = 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](https://developer.salesforce.com/docs/industries/cme/references/cpq?meta=Summary).

## Resource Information

| Response Format | JSON                                                             |
| --------------- | ---------------------------------------------------------------- |
| Resource URL    | `/services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/products` |

## Example Request

```nolang
GET
/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8H/products?pagesize=5
```

## Example Response

```nolang
{
  "totalSize": 5,
  "messages": [],
  "actions": {
    "nextproducts": {
      "rest": {
        "params": {},
        "method": "GET",
        "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/products?lastRecordId=01u41000001QPtsAAG&pagesize=5&includeAttachment=false"
      },
      "remote": {
        "params": {
          "includeAttachment": false,
          "pagesize": 5,
          "lastRecordId": "01u41000001QPtsAAG",
          "cartId": "80141000000Cg8HAAS",
          "methodName": "getCartsProducts"
        }
      },
      "client": {
        "params": {}
      }
    }
  },
  "records": [
    {
      "messages": [],
      "actions": {
        "addtocart": {
          "rest": {
            "params": {
              "price": true,
              "validate": true,
              "includeAttachment": false,
              "pagesize": 5,
              "lastRecordId": null,
              "query": null,
              "items": [
                {
                  "quantity": 1,
                  "itemId": "01u41000001QPs0AAG"
                }
              ]
            },
            "method": "POST",
            "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/items"
          },
          "remote": {
            "params": {
              "price": true,
              "validate": true,
              "includeAttachment": false,
              "pagesize": 5,
              "lastRecordId": null,
              "query": null,
              "items": [
                {
                  "quantity": 1,
                  "itemId": "01u41000001QPs0AAG"
                }
              ],
              "cartId": "80141000000Cg8HAAS",
              "methodName": "postCartsItems"
            }
          },
          "client": {
            "params": {}
          }
        }
      },
      "displaySequence": -1,
      "Id": {
        "label": "Price Book Entry ID",
        "value": "01u41000001QPs0AAG"
      },
      "Pricebook2Id": {
        "label": "Price Book ID",
        "value": "01s41000005dPYQAA2"
      },
      "Product2Id": {
        "label": "Product ID",
        "value": "01t41000000sYZQAA2"
      },
      "UnitPrice": {
        "label": "List Price",
        "value": 1
      },
      "Name": {
        "label": "Product Name",
        "value": "Root 1"
      },
      "IsActive": {
        "label": "Active",
        "value": true
      },
      "Product2": {
        "attributes": {
          "type": "Product2",
          "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYZQAA2"
        },
        "Id": "01t41000000sYZQAA2",
        "Name": "Root 1",
        "vlocity_cmt__IsConfigurable__c": false,
        "vlocity_cmt__Type__c": "None",
        "vlocity_cmt__SubType__c": "None",
        "RecordTypeId": "012410000006OWUAA2"
      },
      "productId": "01t41000000sYZQAA2",
      "defaultQuantity": 1,
      "minQuantity": 0,
      "maxQuantity": 99999,
      "groupMinQuantity": 0,
      "groupMaxQuantity": 99999,
      "sequenceNumber": 1,
      "productChildItemId": "a2541000000G09wAAC",
      "productChildItemDefinition": {
        "attributes": {
          "type": "vlocity_cmt__ProductChildItem__c",
          "url": "/services/data/v38.0/sobjects/vlocity_cmt__ProductChildItem__c/a2541000000G09wAAC"
        },
        "Id": "a2541000000G09wAAC",
        "Name": "Root PCI",
        "vlocity_cmt__IsVirtualItem__c": false,
        "vlocity_cmt__Quantity__c": 1,
        "vlocity_cmt__MaxQuantity__c": 99999,
        "vlocity_cmt__MinQuantity__c": 0,
        "vlocity_cmt__MaximumChildItemQuantity__c": 99999,
        "vlocity_cmt__MinimumChildItemQuantity__c": 0,
        "vlocity_cmt__IsOverride__c": false,
        "vlocity_cmt__ParentProductId__c": "01t41000000sYZQAA2",
        "vlocity_cmt__ChildLineNumber__c": "1",
        "vlocity_cmt__SeqNumber__c": 1,
        "vlocity_cmt__CollapseHierarchy__c": false,
        "vlocity_cmt__IsRootProductChildItem__c": true,
        "vlocity_cmt__ParentProductId__r": {
          "attributes": {
            "type": "Product2",
            "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYZQAA2"
          },
          "Id": "01t41000000sYZQAA2",
          "Name": "Root 1"
        }
      },
      "productHierarchyPath": "01t41000000sYZQAA2",
      "name": "Root 1",
      "isVirtualItem": false,
      "attributeValues": {},
      "itemType": "childProduct"
    },
    {
      "messages": [],
      "actions": {
        "addtocart": {
          "rest": {
            "params": {
              "price": true,
              "validate": true,
              "includeAttachment": false,
              "pagesize": 5,
              "lastRecordId": null,
              "query": null,
              "items": [
                {
                  "quantity": 1,
                  "itemId": "01u41000001QPs5AAG"
                }
              ]
            },
            "method": "POST",
            "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/items"
          },
          "remote": {
            "params": {
              "price": true,
              "validate": true,
              "includeAttachment": false,
              "pagesize": 5,
              "lastRecordId": null,
              "query": null,
              "items": [
                {
                  "quantity": 1,
                  "itemId": "01u41000001QPs5AAG"
                }
              ],
              "cartId": "80141000000Cg8HAAS",
              "methodName": "postCartsItems"
            }
          },
          "client": {
            "params": {}
          }
        }
      },
      "displaySequence": -1,
      "Id": {
        "label": "Price Book Entry ID",
        "value": "01u41000001QPs5AAG"
      },
      "Pricebook2Id": {
        "label": "Price Book ID",
        "value": "01s41000005dPYQAA2"
      },
      "Product2Id": {
        "label": "Product ID",
        "value": "01t41000000sYZVAA2"
      },
      "UnitPrice": {
        "label": "List Price",
        "value": 2
      },
      "Name": {
        "label": "Product Name",
        "value": "Parent 1"
      },
      "IsActive": {
        "label": "Active",
        "value": true
      },
      "Product2": {
        "attributes": {
          "type": "Product2",
          "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYZVAA2"
        },
        "Id": "01t41000000sYZVAA2",
        "Name": "Parent 1",
        "vlocity_cmt__IsConfigurable__c": false,
        "vlocity_cmt__Type__c": "None",
        "vlocity_cmt__SubType__c": "None",
        "RecordTypeId": "012410000006OWUAA2"
      },
      "productId": "01t41000000sYZVAA2",
      "defaultQuantity": 1,
      "minQuantity": 0,
      "maxQuantity": 99999,
      "groupMinQuantity": 0,
      "groupMaxQuantity": 99999,
      "sequenceNumber": 1,
      "productChildItemId": "a2541000000G0A1AAK",
      "productChildItemDefinition": {
        "attributes": {
          "type": "vlocity_cmt__ProductChildItem__c",
          "url": "/services/data/v38.0/sobjects/vlocity_cmt__ProductChildItem__c/a2541000000G0A1AAK"
        },
        "Id": "a2541000000G0A1AAK",
        "Name": "Root PCI",
        "vlocity_cmt__IsVirtualItem__c": false,
        "vlocity_cmt__Quantity__c": 1,
        "vlocity_cmt__MaxQuantity__c": 99999,
        "vlocity_cmt__MinQuantity__c": 0,
        "vlocity_cmt__MaximumChildItemQuantity__c": 99999,
        "vlocity_cmt__MinimumChildItemQuantity__c": 0,
        "vlocity_cmt__IsOverride__c": false,
        "vlocity_cmt__ParentProductId__c": "01t41000000sYZVAA2",
        "vlocity_cmt__ChildLineNumber__c": "1",
        "vlocity_cmt__SeqNumber__c": 1,
        "vlocity_cmt__CollapseHierarchy__c": false,
        "vlocity_cmt__IsRootProductChildItem__c": true,
        "vlocity_cmt__ParentProductId__r": {
          "attributes": {
            "type": "Product2",
            "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYZVAA2"
          },
          "Id": "01t41000000sYZVAA2",
          "Name": "Parent 1"
        }
      },
      "productHierarchyPath": "01t41000000sYZVAA2",
      "name": "Parent 1",
      "isVirtualItem": false,
      "attributeValues": {},
      "itemType": "childProduct"
    },
    {
      "messages": [],
      "actions": {
        "addtocart": {
          "rest": {
            "params": {
              "price": true,
              "validate": true,
              "includeAttachment": false,
              "pagesize": 5,
              "lastRecordId": null,
              "query": null,
              "items": [
                {
                  "quantity": 1,
                  "itemId": "01u41000001QPtmAAG"
                }
              ]
            },
            "method": "POST",
            "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/items"
          },
          "remote": {
            "params": {
              "price": true,
              "validate": true,
              "includeAttachment": false,
              "pagesize": 5,
              "lastRecordId": null,
              "query": null,
              "items": [
                {
                  "quantity": 1,
                  "itemId": "01u41000001QPtmAAG"
                }
              ],
              "cartId": "80141000000Cg8HAAS",
              "methodName": "postCartsItems"
            }
          },
          "client": {
            "params": {}
          }
        }
      },
      "displaySequence": -1,
      "Id": {
        "label": "Price Book Entry ID",
        "value": "01u41000001QPtmAAG"
      },
      "Pricebook2Id": {
        "label": "Price Book ID",
        "value": "01s41000005dPYQAA2"
      },
      "Product2Id": {
        "label": "Product ID",
        "value": "01t41000000sYaIAAU"
      },
      "UnitPrice": {
        "label": "List Price",
        "value": 1
      },
      "Name": {
        "label": "Product Name",
        "value": "Child 1"
      },
      "IsActive": {
        "label": "Active",
        "value": true
      },
      "Product2": {
        "attributes": {
          "type": "Product2",
          "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaIAAU"
        },
        "Id": "01t41000000sYaIAAU",
        "Name": "Child 1",
        "vlocity_cmt__IsConfigurable__c": false,
        "vlocity_cmt__Type__c": "None",
        "vlocity_cmt__SubType__c": "None",
        "RecordTypeId": "012410000006OWUAA2"
      },
      "productId": "01t41000000sYaIAAU",
      "defaultQuantity": 1,
      "minQuantity": 0,
      "maxQuantity": 99999,
      "groupMinQuantity": 0,
      "groupMaxQuantity": 99999,
      "sequenceNumber": 1,
      "productChildItemId": "a2541000000G0A6AAK",
      "productChildItemDefinition": {
        "attributes": {
          "type": "vlocity_cmt__ProductChildItem__c",
          "url": "/services/data/v38.0/sobjects/vlocity_cmt__ProductChildItem__c/a2541000000G0A6AAK"
        },
        "Id": "a2541000000G0A6AAK",
        "Name": "Root PCI",
        "vlocity_cmt__IsVirtualItem__c": false,
        "vlocity_cmt__Quantity__c": 1,
        "vlocity_cmt__MaxQuantity__c": 99999,
        "vlocity_cmt__MinQuantity__c": 0,
        "vlocity_cmt__MaximumChildItemQuantity__c": 99999,
        "vlocity_cmt__MinimumChildItemQuantity__c": 0,
        "vlocity_cmt__IsOverride__c": false,
        "vlocity_cmt__ParentProductId__c": "01t41000000sYaIAAU",
        "vlocity_cmt__ChildLineNumber__c": "1",
        "vlocity_cmt__SeqNumber__c": 1,
        "vlocity_cmt__CollapseHierarchy__c": false,
        "vlocity_cmt__IsRootProductChildItem__c": true,
        "vlocity_cmt__ParentProductId__r": {
          "attributes": {
            "type": "Product2",
            "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaIAAU"
          },
          "Id": "01t41000000sYaIAAU",
          "Name": "Child 1"
        }
      },
      "productHierarchyPath": "01t41000000sYaIAAU",
      "name": "Child 1",
      "isVirtualItem": false,
      "attributeValues": {},
      "itemType": "childProduct"
    },
    {
      "messages": [],
      "actions": {
        "addtocart": {
          "rest": {
            "params": {
              "price": true,
              "validate": true,
              "includeAttachment": false,
              "pagesize": 5,
              "lastRecordId": null,
              "query": null,
              "items": [
                {
                  "quantity": 1,
                  "itemId": "01u41000001QPtrAAG"
                }
              ]
            },
            "method": "POST",
            "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/items"
          },
          "remote": {
            "params": {
              "price": true,
              "validate": true,
              "includeAttachment": false,
              "pagesize": 5,
              "lastRecordId": null,
              "query": null,
              "items": [
                {
                  "quantity": 1,
                  "itemId": "01u41000001QPtrAAG"
                }
              ],
              "cartId": "80141000000Cg8HAAS",
              "methodName": "postCartsItems"
            }
          },
          "client": {
            "params": {}
          }
        }
      },
      "displaySequence": -1,
      "Id": {
        "label": "Price Book Entry ID",
        "value": "01u41000001QPtrAAG"
      },
      "Pricebook2Id": {
        "label": "Price Book ID",
        "value": "01s41000005dPYQAA2"
      },
      "Product2Id": {
        "label": "Product ID",
        "value": "01t41000000sYaNAAU"
      },
      "UnitPrice": {
        "label": "List Price",
        "value": 1
      },
      "Name": {
        "label": "Product Name",
        "value": "GC 1"
      },
      "IsActive": {
        "label": "Active",
        "value": true
      },
      "Product2": {
        "attributes": {
          "type": "Product2",
          "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaNAAU"
        },
        "Id": "01t41000000sYaNAAU",
        "Name": "GC 1",
        "vlocity_cmt__IsConfigurable__c": false,
        "vlocity_cmt__Type__c": "None",
        "vlocity_cmt__SubType__c": "None",
        "RecordTypeId": "012410000006OWUAA2"
      },
      "productId": "01t41000000sYaNAAU",
      "defaultQuantity": 1,
      "minQuantity": 0,
      "maxQuantity": 99999,
      "groupMinQuantity": 0,
      "groupMaxQuantity": 99999,
      "sequenceNumber": 1,
      "productChildItemId": "a2541000000G0ABAA0",
      "productChildItemDefinition": {
        "attributes": {
          "type": "vlocity_cmt__ProductChildItem__c",
          "url": "/services/data/v38.0/sobjects/vlocity_cmt__ProductChildItem__c/a2541000000G0ABAA0"
        },
        "Id": "a2541000000G0ABAA0",
        "Name": "Root PCI",
        "vlocity_cmt__IsVirtualItem__c": false,
        "vlocity_cmt__Quantity__c": 1,
        "vlocity_cmt__MaxQuantity__c": 99999,
        "vlocity_cmt__MinQuantity__c": 0,
        "vlocity_cmt__MaximumChildItemQuantity__c": 99999,
        "vlocity_cmt__MinimumChildItemQuantity__c": 0,
        "vlocity_cmt__IsOverride__c": false,
        "vlocity_cmt__ParentProductId__c": "01t41000000sYaNAAU",
        "vlocity_cmt__ChildLineNumber__c": "1",
        "vlocity_cmt__SeqNumber__c": 1,
        "vlocity_cmt__CollapseHierarchy__c": false,
        "vlocity_cmt__IsRootProductChildItem__c": true,
        "vlocity_cmt__ParentProductId__r": {
          "attributes": {
            "type": "Product2",
            "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaNAAU"
          },
          "Id": "01t41000000sYaNAAU",
          "Name": "GC 1"
        }
      },
      "productHierarchyPath": "01t41000000sYaNAAU",
      "name": "GC 1",
      "isVirtualItem": false,
      "attributeValues": {},
      "itemType": "childProduct"
    },
    {
      "messages": [],
      "actions": {
        "addtocart": {
          "rest": {
            "params": {
              "price": true,
              "validate": true,
              "includeAttachment": false,
              "pagesize": 5,
              "lastRecordId": null,
              "query": null,
              "items": [
                {
                  "quantity": 1,
                  "itemId": "01u41000001QPtsAAG"
                }
              ]
            },
            "method": "POST",
            "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/items"
          },
          "remote": {
            "params": {
              "price": true,
              "validate": true,
              "includeAttachment": false,
              "pagesize": 5,
              "lastRecordId": null,
              "query": null,
              "items": [
                {
                  "quantity": 1,
                  "itemId": "01u41000001QPtsAAG"
                }
              ],
              "cartId": "80141000000Cg8HAAS",
              "methodName": "postCartsItems"
            }
          },
          "client": {
            "params": {}
          }
        }
      },
      "displaySequence": -1,
      "Id": {
        "label": "Price Book Entry ID",
        "value": "01u41000001QPtsAAG"
      },
      "Pricebook2Id": {
        "label": "Price Book ID",
        "value": "01s41000005dPYQAA2"
      },
      "Product2Id": {
        "label": "Product ID",
        "value": "01t41000000sYaSAAU"
      },
      "UnitPrice": {
        "label": "List Price",
        "value": 1
      },
      "Name": {
        "label": "Product Name",
        "value": "GC 2"
      },
      "IsActive": {
        "label": "Active",
        "value": true
      },
      "Product2": {
        "attributes": {
          "type": "Product2",
          "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaSAAU"
        },
        "Id": "01t41000000sYaSAAU",
        "Name": "GC 2",
        "vlocity_cmt__IsConfigurable__c": false,
        "vlocity_cmt__Type__c": "None",
        "vlocity_cmt__SubType__c": "None",
        "RecordTypeId": "012410000006OWUAA2"
      },
      "productId": "01t41000000sYaSAAU",
      "defaultQuantity": 1,
      "minQuantity": 0,
      "maxQuantity": 99999,
      "groupMinQuantity": 0,
      "groupMaxQuantity": 99999,
      "sequenceNumber": 1,
      "productChildItemId": "a2541000000G0AGAA0",
      "productChildItemDefinition": {
        "attributes": {
          "type": "vlocity_cmt__ProductChildItem__c",
          "url": "/services/data/v38.0/sobjects/vlocity_cmt__ProductChildItem__c/a2541000000G0AGAA0"
        },
        "Id": "a2541000000G0AGAA0",
        "Name": "Root PCI",
        "vlocity_cmt__IsVirtualItem__c": false,
        "vlocity_cmt__Quantity__c": 1,
        "vlocity_cmt__MaxQuantity__c": 99999,
        "vlocity_cmt__MinQuantity__c": 0,
        "vlocity_cmt__MaximumChildItemQuantity__c": 99999,
        "vlocity_cmt__MinimumChildItemQuantity__c": 0,
        "vlocity_cmt__IsOverride__c": false,
        "vlocity_cmt__ParentProductId__c": "01t41000000sYaSAAU",
        "vlocity_cmt__ChildLineNumber__c": "1",
        "vlocity_cmt__SeqNumber__c": 1,
        "vlocity_cmt__CollapseHierarchy__c": false,
        "vlocity_cmt__IsRootProductChildItem__c": true,
        "vlocity_cmt__ParentProductId__r": {
          "attributes": {
            "type": "Product2",
            "url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaSAAU"
          },
          "Id": "01t41000000sYaSAAU",
          "Name": "GC 2"
        }
      },
      "productHierarchyPath": "01t41000000sYaSAAU",
      "name": "GC 2",
      "isVirtualItem": false,
      "attributeValues": {},
      "itemType": "childProduct"
    }
  ]
}
```
