Use Trim Mode to Decrease Overhead

You use trim mode to reduce the amount of data returned by basket operations, resulting in reduced network traffic and improved performance.

To enable trim mode, set the trimmode configuration setting see CPQ Configuration Settings Reference . You can also pass trimmode as a parameter to the API call. Note that trimmode API parameter overrides the value set for the CacheAPI.TrimMode custom setting.

For example, to specify trimmode as a parameter in the API call:

/services/apexrest/vlocity_cmt/v3/catalogs/Phones/basket?trimmode=true

note: The CacheAPI.trimmode custom setting and the trimmode API parameter are available only in Winter '21 release or later. Using trim mode with the Winter '21 requires creating an interface and implementation; see Using trim mode with the Winter '21 release. It is not necessary to create an interface for version Spring '21 and later.

For additional information and examples about using the Basket APIs, see: Basket Operations.

Calling Example

When you use the response from the Basket API call and pass it as a request body to the Create Cart API, a valid order is created. An example is shown below.

Method:
POST

URL:
/services/apexrest/cacheableapis/v3/carts?context={}&contextKey=key&isLoggedIn=true/false

Request body (example)

"catalogCode": "{{dataPrefix}}{{catalogCode}}",
  "accountId": "0014x000009kMSb",
  "JSONResult": {
    "totals": {
      "EffectiveOneTimeTotal__c": 2400,
      "EffectiveRecurringTotal__c": 240
    },
    "records": [
      {
        "actions": {
          "deleteFromBasketAction": {
            "rest": {
              "params": {
                "basketAction": "deleteFromBasket",
                "lineItemKey": "65cf0791db3860be03efcd9c7bfc439a",
                "bundleContextKey": "65cf0791db3860be03efcd9c7bfc439a"
              },
              "link": "/v3/catalogs/flows_dct_cf/basket/78ec66d85c6e7ae244d0464c66a67b5c?contextKey=99914b932bd37a50b983c5e7c90ae93b",
              "method": "deleteFromBasketAction"
            }
          },
          "updateBasketAction": {
            "rest": {
              "params": {
                "basketAction": "updateBasket",
                "lineItemKey": "65cf0791db3860be03efcd9c7bfc439a",
                "bundleContextKey": "65cf0791db3860be03efcd9c7bfc439a"
              },
              "link": "/v3/catalogs/flows_dct_cf/basket/78ec66d85c6e7ae244d0464c66a67b5c?contextKey=99914b932bd37a50b983c5e7c90ae93b",
              "method": "updateBasketAction"
            }
          }
        },
        "lineItemKey": "65cf0791db3860be03efcd9c7bfc439a",
        "bundleContextKey": "65cf0791db3860be03efcd9c7bfc439a",
        "attributeCategories": {
          "records": [
            {
              "productAttributes": {
                "records": [
                  {
                    "userValues": null,
                    "values": [
                      {
                        "disabled": false,
                        "readonly": false
                      }
                    ],
                    "isNotTranslatable": false,
                    "cloneable": true,
                    "hidden": false,
                    "hasRules": false,
                    "displaySequence": 1,
                    "label": "DateForBuyBack2",
                    "attributeId": "a0X4x000000ND1sEAG",
                    "filterable": true,
                    "disabled": false,
                    "readonly": false,
                    "required": false,
                    "multiselect": false,
                    "cacheable": true,
                    "inputType": "date",
                    "dataType": "date",
                    "code": "DateForBuyBack2"
                  },
                  {
                    "userValues": null,
                    "values": [
                      {
                        "disabled": false,
                        "readonly": false
                      }
                    ],
                    "isNotTranslatable": false,
                    "cloneable": true,
                    "hidden": false,
                    "hasRules": false,
                    "displaySequence": 1,
                    "label": "DateTimeForDelivery2",
                    "attributeId": "a0X4x000000ND1tEAG",
                    "filterable": true,
                    "disabled": false,
                    "readonly": false,
                    "required": false,
                    "multiselect": false,
                    "cacheable": true,
                    "inputType": "datetime",
                    "dataType": "datetime",
                    "code": "DateTimeForDelivery2"
                  }
                ],
                "totalSize": 2
              },
              "id": "a0W4x000000ZmeIEAS",
              "Name": "BASIC",
              "Code__c": "BASIC",
              "displaySequence": 1
            },
            {
              "productAttributes": {
                "records": [
                  {
                    "userValues": true,
                    "values": [
                      {
                        "displaySequence": 2,
                        "defaultSelected": false,
                        "value": "false",
                        "disabled": false,
                        "readonly": false,
                        "label": "false",
                        "name": "c77778d2-b0ac-dd67-57a4-261bb6bb0e73",
                        "id": "c77778d2-b0ac-dd67-57a4-261bb6bb0e73"
                      },
                      {
                        "displaySequence": 1,
                        "defaultSelected": false,
                        "value": "true",
                        "disabled": false,
                        "readonly": false,
                        "label": "true",
                        "name": "92273834-d4b0-c020-ddbb-0503f4586d9b",
                        "id": "92273834-d4b0-c020-ddbb-0503f4586d9b"
                      }
                    ],
                    "isNotTranslatable": false,
                    "cloneable": true,
                    "hidden": false,
                    "hasRules": false,
                    "displaySequence": 1,
                    "label": "IsValueForMoney2",
                    "attributeId": "a0X4x000000ND1uEAG",
                    "filterable": true,
                    "disabled": false,
                    "readonly": false,
                    "required": false,
                    "multiselect": false,
                    "cacheable": true,
                    "inputType": "dropdown",
                    "dataType": "text",
                    "code": "IsValueForMoney2"
                  },
                  {
                    "userValues": null,
                    "values": [
                      {
                        "disabled": false,
                        "readonly": false
                      }
                    ],
                    "isNotTranslatable": false,
                    "cloneable": true,
                    "hidden": false,
                    "hasRules": false,
                    "displaySequence": 1,
                    "label": "Networth2",
                    "attributeId": "a0X4x000000ND1vEAG",
                    "filterable": true,
                    "disabled": false,
                    "readonly": false,
                    "required": false,
                    "multiselect": false,
                    "cacheable": true,
                    "inputType": "number",
                    "dataType": "currency",
                    "code": "Networth2"
                  },
                  {
                    "userValues": null,
                    "values": [
                      {
                        "disabled": false,
                        "readonly": false
                      }
                    ],
                    "isNotTranslatable": false,
                    "cloneable": true,
                    "hidden": false,
                    "hasRules": false,
                    "displaySequence": 1,
                    "label": "LikelhoodOfRecommendation2",
                    "attributeId": "a0X4x000000ND1wEAG",
                    "filterable": true,
                    "disabled": false,
                    "readonly": false,
                    "required": false,
                    "multiselect": false,
                    "cacheable": true,
                    "inputType": "number",
                    "dataType": "percentage",
                    "code": "LikelhoodOfRecommendation2"
                  },
                  {
                    "userValues": null,
                    "values": [
                      {
                        "disabled": false,
                        "readonly": false
                      }
                    ],
                    "isNotTranslatable": false,
                    "cloneable": true,
                    "hidden": false,
                    "hasRules": false,
                    "displaySequence": 1,
                    "label": "Age2",
                    "attributeId": "a0X4x000000ND1xEAG",
                    "filterable": true,
                    "disabled": false,
                    "readonly": false,
                    "required": false,
                    "multiselect": false,
                    "cacheable": true,
                    "inputType": "number",
                    "dataType": "number",
                    "code": "Age2"
                  },
                  {
                    "userValues": false,
                    "values": [
                      {
                        "defaultValue": false,
                        "value": false,
                        "disabled": false,
                        "readonly": false
                      }
                    ],
                    "isNotTranslatable": false,
                    "cloneable": true,
                    "hidden": false,
                    "hasRules": false,
                    "displaySequence": 1,
                    "label": "NeedInsurance2",
                    "attributeId": "a0X4x000000ND1yEAG",
                    "filterable": true,
                    "disabled": false,
                    "readonly": false,
                    "required": false,
                    "multiselect": false,
                    "cacheable": true,
                    "inputType": "checkbox",
                    "dataType": "text",
                    "code": "NeedInsurance2"
                  }
                ],
                "totalSize": 5
              },
              "id": "a0W4x000000ZmeJEAS",
              "Name": "SURVEY",
              "Code__c": "SURVEY",
              "displaySequence": 2
            }
          ],
          "totalSize": 2
        },
        "productCategories": {
          "totalSize": 0
        },
        "pricingLogValue": {
          "LastPricingTime": "2021-01-28T23:56:46.227Z",
          "PriceAsOfDateTime": "2021-01-28T23:56:46.227Z",
          "LogVersion": "3.0",
          "PricingVariableCodeBaseValues": {
            "REC_MNTH_STD_PRC": 15,
            "OT_STD_PRC": 150
          },
          "PricingVariableCodeValues": {
            "DISP_OT_STD_PRC": 150,
            "ROLLUP_OT_STD_PRC_TOTAL": 2250,
            "ROLLUP_REC_MNTH_STD_PRC_TOTAL": 225,
            "REC_MNTH_STD_PRC_DISC_PCT_MAN": 0,
            "OT_STD_PRC_DISC_PCT_MAN": 0,
            "EFFECTIVE_QUANTITY": 1,
            "LINE_QUANTITY": 1,
            "EFF_REC_MNTH_STD_PRC_TOTAL": 240,
            "REC_MNTH_STD_PRC_TOTAL": 240,
            "REC_MNTH_STD_PRC_CALC": 15,
            "REC_MNTH_STD_PRC": 15,
            "EFF_OT_STD_PRC_TOTAL": 2400,
            "OT_STD_PRC_TOTAL": 2400,
            "OT_STD_PRC_CALC": 150,
            "OT_STD_PRC": 150
          },
          "PriceAdjustmentPromoKeys": [],
          "PricingVariableCodeFieldBinding": {
            "navs_230__RecurringManualDiscount__c": "REC_MNTH_STD_PRC_DISC_PCT_MAN",
            "navs_230__OneTimeManualDiscount__c": "OT_STD_PRC_DISC_PCT_MAN",
            "navs_230__EffectiveQuantity__c": "EFFECTIVE_QUANTITY",
            "Quantity": "LINE_QUANTITY",
            "navs_230__EffectiveRecurringTotal__c": "EFF_REC_MNTH_STD_PRC_TOTAL",
            "navs_230__RecurringTotal__c": "REC_MNTH_STD_PRC_TOTAL",
            "navs_230__RecurringCalculatedPrice__c": "REC_MNTH_STD_PRC_CALC",
            "navs_230__RecurringCharge__c": "REC_MNTH_STD_PRC",
            "navs_230__EffectiveOneTimeTotal__c": "EFF_OT_STD_PRC_TOTAL",
            "navs_230__OneTimeTotal__c": "OT_STD_PRC_TOTAL",
            "navs_230__OneTimeCalculatedPrice__c": "OT_STD_PRC_CALC",
            "navs_230__OneTimeCharge__c": "OT_STD_PRC"
          },
          "LogData": {
            "REC_MNTH_STD_PRC_TOTAL": [
              {
                "ChargeTiming": null,
                "LogSequence": 0,
                "DisplayText": "[Recurring Calculated Price (15.00) + Rollup Recurring Total (225.00)] x Quantity (1.00)"
              }
            ],
            "REC_MNTH_STD_PRC_CALC": [
              {
                "ChargeTiming": null,
                "LogSequence": 0,
                "DisplayText": "Recurring Charge (15.00000) - Recurring Manual Discount (0.00%)"
              }
            ],
            "OT_STD_PRC_TOTAL": [
              {
                "ChargeTiming": "One-Time",
                "LogSequence": 0,
                "DisplayText": "[One Time Calculated Price (150.00) + Rollup One Time Total (2250.00)] x Quantity (1.00)"
              }
            ],
            "OT_STD_PRC_CALC": [
              {
                "ChargeTiming": null,
                "LogSequence": 0,
                "DisplayText": "One Time Charge (150.00000) - One Time Manual Discount (0.00%)"
              }
            ],
            "REC_MNTH_STD_PRC": [
              {
                "LogSequence": 0,
                "IsEffective": true,
                "EndDate": null,
                "StartDate": null,
                "AdjustmentType": "None",
                "LoyaltyCode": "PTS",
                "CurrencyCode": "USD",
                "CurrencyType": "Currency",
                "Amount": 15,
                "AdjustmentValue": 0,
                "AdjustmentMethod": null,
                "BaseValue": 15,
                "BaseAdjustment": null,
                "PriceListId": "a3D4x0000009Fq4EAE",
                "OfferId": null,
                "PromotionId": null,
                "PricingElementId": "a3F4x000000YdN1EAK",
                "PricingVariableCode": "REC_MNTH_STD_PRC",
                "DisplayText": "15_RB_flows_p_1",
                "EndValue": 15,
                "ChargeTiming": "Recurring",
                "Frequency": "Monthly",
                "SubType": "Standard",
                "StartValue": 15,
                "PricingElementGlobalKey": "8647d492-8302-a75d-3d3b-160dbd123199",
                "LogType": "PRICE",
                "PriceListEntryId": "a3C4x000000Z01jEAC"
              }
            ],
            "OT_STD_PRC": [
              {
                "LogSequence": 0,
                "IsEffective": true,
                "EndDate": null,
                "StartDate": null,
                "AdjustmentType": "None",
                "LoyaltyCode": "PTS",
                "CurrencyCode": "USD",
                "CurrencyType": "Currency",
                "Amount": 150,
                "AdjustmentValue": 0,
                "AdjustmentMethod": null,
                "BaseValue": 150,
                "BaseAdjustment": null,
                "PriceListId": "a3D4x0000009Fq4EAE",
                "OfferId": null,
                "PromotionId": null,
                "PricingElementId": "a3F4x000000YdN0EAK",
                "PricingVariableCode": "OT_STD_PRC",
                "DisplayText": "150_OTB_flows_p_1",
                "EndValue": 150,
                "ChargeTiming": "One-time",
                "Frequency": null,
                "SubType": "Standard",
                "StartValue": 150,
                "PricingElementGlobalKey": "89603aff-f59c-210e-d76e-e88b0abf4b66",
                "LogType": "PRICE",
                "PriceListEntryId": "a3C4x000000Z01iEAC"
              }
            ]
          }
        },
        "PricebookEntry": {
          "Product2": {
            "navs_230__JSONAttribute__c": null,
            "navs_230__IsConfigurable__c": false,
            "navs_230__GlobalGroupKey__c": "1303db74-24f1-2eb4-f3f5-7f61f410c602",
            "navs_230__Type__c": "None",
            "ProductCode": "flows_p_1",
            "Name": "flows_p_1",
            "Id": "01t4x000000ZFqbAAG",
            "attributes": {
              "url": "/services/data/v50.0/sobjects/Product2/01t4x000000ZFqbAAG",
              "type": "Product2"
            }
          },
          "Pricebook2Id": "01s4x000007JWrxAAG",
          "Product2Id": "01t4x000000ZFqbAAG",
          "Id": "01u4x000002SnHzAAK",
          "attributes": {
            "url": "/services/data/v50.0/sobjects/PricebookEntry/01u4x000002SnHzAAK",
            "type": "PricebookEntry"
          }
        },
        "OrderId": "8014x000000gFK4AAM",
        "navs_230__IsChangesAllowed__c": true,
        "navs_230__AssetReferenceId__c": "607a5789-6e0a-6c60-2738-614f3f5f0945",
        "navs_230__EffectiveRecurringTotal__c": 240,
        "navs_230__EffectiveOneTimeTotal__c": 2400,
        "navs_230__CurrencyPaymentMode__c": "Currency",
        "navs_230__RecurringManualDiscount__c": 0,
        "navs_230__RecurringCalculatedPrice__c": 15,
        "navs_230__RecurringCharge__c": 15,
        "navs_230__OneTimeManualDiscount__c": 0,
        "navs_230__OneTimeCalculatedPrice__c": 150,
        "navs_230__OneTimeCharge__c": 150,
        "ListPrice": 0,
        "navs_230__InCartQuantityMap__c": "{\"01t4x000000ZFruAAG\":1}",
        "navs_230__Product2Id__c": "01t4x000000ZFqbAAG",
        "navs_230__RootItemId__c": "8024x000000kx0kAAA",
        "navs_230__LineNumber__c": "0001",
        "navs_230__ProductHierarchyPath__c": "01t4x000000ZFqbAAG",
        "navs_230__ProvisioningStatus__c": "New",
        "navs_230__Action__c": "Add",
        "navs_230__RecurringTotal__c": 240,
        "navs_230__OneTimeTotal__c": 2400,
        "Quantity": 1,
        "PricebookEntryId": "01u4x000002SnHzAAK",
        "itemType": "lineItem",
        "SellingPeriod": "Present",
        "hasChildren": true,
        "action": "Add",
        "lineNumber": "0001",
        "isVirtualItem": false,
        "name": "flows_p_1",
        "productHierarchyPath": "01t4x000000ZFqbAAG",
        "productChildItemDefinition": {
          "navs_230__ParentProductId__r": {
            "Id": "01t4x000000ZFqbAAG",
            "Name": "flows_p_1",
            "navs_230__GlobalGroupKey__c": "1303db74-24f1-2eb4-f3f5-7f61f410c602",
            "attributes": {
              "url": "/services/data/v50.0/sobjects/Product2/01t4x000000ZFqbAAG",
              "type": "Product2"
            }
          },
          "navs_230__ChildLineNumber__c": "1",
          "navs_230__MinQuantity__c": 0,
          "navs_230__IsVirtualItem__c": false,
          "navs_230__MaximumChildItemQuantity__c": 99999,
          "navs_230__MaxQuantity__c": 99999,
          "navs_230__IsRootProductChildItem__c": true,
          "navs_230__IsOverride__c": false,
          "navs_230__Quantity__c": 1,
          "navs_230__CollapseHierarchy__c": false,
          "Name": "Root PCI",
          "navs_230__MinimumChildItemQuantity__c": 0,
          "navs_230__ParentProductId__c": "01t4x000000ZFqbAAG",
          "navs_230__SeqNumber__c": 1,
          "attributes": {
            "type": "navs_230__ProductChildItem__c"
          }
        },
        "sequenceNumber": 1,
        "groupMaxQuantity": 99999,
        "groupMinQuantity": 0,
        "maxQuantity": 99999,
        "minQuantity": 0,
        "defaultQuantity": 1,
        "productId": "01t4x000000ZFqbAAG",
        "CurrencyCode": "USD",
        "Product2": {
          "navs_230__JSONAttribute__c": null,
          "navs_230__SubType__c": "None",
          "navs_230__Type__c": "None",
          "navs_230__GlobalGroupKey__c": "1303db74-24f1-2eb4-f3f5-7f61f410c602",
          "navs_230__IsConfigurable__c": false,
          "Name": "flows_p_1",
          "Id": "01t4x000000ZFqbAAG",
          "attributes": {
            "url": "/services/data/v50.0/sobjects/Product2/01t4x000000ZFqbAAG",
            "type": "Product2"
          }
        },
        "navs_230__RecurringPrice__c": 240,
        "IsActive": true,
        "Name": "flows_p_1",
        "UnitPrice": 0,
        "ProductCode": "flows_p_1",
        "Product2Id": "01t4x000000ZFqbAAG",
        "Pricebook2Id": "01s4x000007JWrxAAG",
        "Id": "8024x000000kx0kAAA",
        "displaySequence": -1
      }
    ],
    "totalSize": 1
  },
  "errorCode": "INVOKE-200",
  "error": "OK"
}