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:

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

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.

Note

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.

1Method:
2POST
3
4URL:
5/services/apexrest/cacheableapis/v3/carts?context={}&contextKey=key&isLoggedIn=true/false
6
7Request body (example)
8
9"catalogCode": "{{dataPrefix}}{{catalogCode}}",
10  "accountId": "0014x000009kMSb",
11  "JSONResult": {
12    "totals": {
13      "EffectiveOneTimeTotal__c": 2400,
14      "EffectiveRecurringTotal__c": 240
15    },
16    "records": [
17      {
18        "actions": {
19          "deleteFromBasketAction": {
20            "rest": {
21              "params": {
22                "basketAction": "deleteFromBasket",
23                "lineItemKey": "65cf0791db3860be03efcd9c7bfc439a",
24                "bundleContextKey": "65cf0791db3860be03efcd9c7bfc439a"
25              },
26              "link": "/v3/catalogs/flows_dct_cf/basket/78ec66d85c6e7ae244d0464c66a67b5c?contextKey=99914b932bd37a50b983c5e7c90ae93b",
27              "method": "deleteFromBasketAction"
28            }
29          },
30          "updateBasketAction": {
31            "rest": {
32              "params": {
33                "basketAction": "updateBasket",
34                "lineItemKey": "65cf0791db3860be03efcd9c7bfc439a",
35                "bundleContextKey": "65cf0791db3860be03efcd9c7bfc439a"
36              },
37              "link": "/v3/catalogs/flows_dct_cf/basket/78ec66d85c6e7ae244d0464c66a67b5c?contextKey=99914b932bd37a50b983c5e7c90ae93b",
38              "method": "updateBasketAction"
39            }
40          }
41        },
42        "lineItemKey": "65cf0791db3860be03efcd9c7bfc439a",
43        "bundleContextKey": "65cf0791db3860be03efcd9c7bfc439a",
44        "attributeCategories": {
45          "records": [
46            {
47              "productAttributes": {
48                "records": [
49                  {
50                    "userValues": null,
51                    "values": [
52                      {
53                        "disabled": false,
54                        "readonly": false
55                      }
56                    ],
57                    "isNotTranslatable": false,
58                    "cloneable": true,
59                    "hidden": false,
60                    "hasRules": false,
61                    "displaySequence": 1,
62                    "label": "DateForBuyBack2",
63                    "attributeId": "a0X4x000000ND1sEAG",
64                    "filterable": true,
65                    "disabled": false,
66                    "readonly": false,
67                    "required": false,
68                    "multiselect": false,
69                    "cacheable": true,
70                    "inputType": "date",
71                    "dataType": "date",
72                    "code": "DateForBuyBack2"
73                  },
74                  {
75                    "userValues": null,
76                    "values": [
77                      {
78                        "disabled": false,
79                        "readonly": false
80                      }
81                    ],
82                    "isNotTranslatable": false,
83                    "cloneable": true,
84                    "hidden": false,
85                    "hasRules": false,
86                    "displaySequence": 1,
87                    "label": "DateTimeForDelivery2",
88                    "attributeId": "a0X4x000000ND1tEAG",
89                    "filterable": true,
90                    "disabled": false,
91                    "readonly": false,
92                    "required": false,
93                    "multiselect": false,
94                    "cacheable": true,
95                    "inputType": "datetime",
96                    "dataType": "datetime",
97                    "code": "DateTimeForDelivery2"
98                  }
99                ],
100                "totalSize": 2
101              },
102              "id": "a0W4x000000ZmeIEAS",
103              "Name": "BASIC",
104              "Code__c": "BASIC",
105              "displaySequence": 1
106            },
107            {
108              "productAttributes": {
109                "records": [
110                  {
111                    "userValues": true,
112                    "values": [
113                      {
114                        "displaySequence": 2,
115                        "defaultSelected": false,
116                        "value": "false",
117                        "disabled": false,
118                        "readonly": false,
119                        "label": "false",
120                        "name": "c77778d2-b0ac-dd67-57a4-261bb6bb0e73",
121                        "id": "c77778d2-b0ac-dd67-57a4-261bb6bb0e73"
122                      },
123                      {
124                        "displaySequence": 1,
125                        "defaultSelected": false,
126                        "value": "true",
127                        "disabled": false,
128                        "readonly": false,
129                        "label": "true",
130                        "name": "92273834-d4b0-c020-ddbb-0503f4586d9b",
131                        "id": "92273834-d4b0-c020-ddbb-0503f4586d9b"
132                      }
133                    ],
134                    "isNotTranslatable": false,
135                    "cloneable": true,
136                    "hidden": false,
137                    "hasRules": false,
138                    "displaySequence": 1,
139                    "label": "IsValueForMoney2",
140                    "attributeId": "a0X4x000000ND1uEAG",
141                    "filterable": true,
142                    "disabled": false,
143                    "readonly": false,
144                    "required": false,
145                    "multiselect": false,
146                    "cacheable": true,
147                    "inputType": "dropdown",
148                    "dataType": "text",
149                    "code": "IsValueForMoney2"
150                  },
151                  {
152                    "userValues": null,
153                    "values": [
154                      {
155                        "disabled": false,
156                        "readonly": false
157                      }
158                    ],
159                    "isNotTranslatable": false,
160                    "cloneable": true,
161                    "hidden": false,
162                    "hasRules": false,
163                    "displaySequence": 1,
164                    "label": "Networth2",
165                    "attributeId": "a0X4x000000ND1vEAG",
166                    "filterable": true,
167                    "disabled": false,
168                    "readonly": false,
169                    "required": false,
170                    "multiselect": false,
171                    "cacheable": true,
172                    "inputType": "number",
173                    "dataType": "currency",
174                    "code": "Networth2"
175                  },
176                  {
177                    "userValues": null,
178                    "values": [
179                      {
180                        "disabled": false,
181                        "readonly": false
182                      }
183                    ],
184                    "isNotTranslatable": false,
185                    "cloneable": true,
186                    "hidden": false,
187                    "hasRules": false,
188                    "displaySequence": 1,
189                    "label": "LikelhoodOfRecommendation2",
190                    "attributeId": "a0X4x000000ND1wEAG",
191                    "filterable": true,
192                    "disabled": false,
193                    "readonly": false,
194                    "required": false,
195                    "multiselect": false,
196                    "cacheable": true,
197                    "inputType": "number",
198                    "dataType": "percentage",
199                    "code": "LikelhoodOfRecommendation2"
200                  },
201                  {
202                    "userValues": null,
203                    "values": [
204                      {
205                        "disabled": false,
206                        "readonly": false
207                      }
208                    ],
209                    "isNotTranslatable": false,
210                    "cloneable": true,
211                    "hidden": false,
212                    "hasRules": false,
213                    "displaySequence": 1,
214                    "label": "Age2",
215                    "attributeId": "a0X4x000000ND1xEAG",
216                    "filterable": true,
217                    "disabled": false,
218                    "readonly": false,
219                    "required": false,
220                    "multiselect": false,
221                    "cacheable": true,
222                    "inputType": "number",
223                    "dataType": "number",
224                    "code": "Age2"
225                  },
226                  {
227                    "userValues": false,
228                    "values": [
229                      {
230                        "defaultValue": false,
231                        "value": false,
232                        "disabled": false,
233                        "readonly": false
234                      }
235                    ],
236                    "isNotTranslatable": false,
237                    "cloneable": true,
238                    "hidden": false,
239                    "hasRules": false,
240                    "displaySequence": 1,
241                    "label": "NeedInsurance2",
242                    "attributeId": "a0X4x000000ND1yEAG",
243                    "filterable": true,
244                    "disabled": false,
245                    "readonly": false,
246                    "required": false,
247                    "multiselect": false,
248                    "cacheable": true,
249                    "inputType": "checkbox",
250                    "dataType": "text",
251                    "code": "NeedInsurance2"
252                  }
253                ],
254                "totalSize": 5
255              },
256              "id": "a0W4x000000ZmeJEAS",
257              "Name": "SURVEY",
258              "Code__c": "SURVEY",
259              "displaySequence": 2
260            }
261          ],
262          "totalSize": 2
263        },
264        "productCategories": {
265          "totalSize": 0
266        },
267        "pricingLogValue": {
268          "LastPricingTime": "2021-01-28T23:56:46.227Z",
269          "PriceAsOfDateTime": "2021-01-28T23:56:46.227Z",
270          "LogVersion": "3.0",
271          "PricingVariableCodeBaseValues": {
272            "REC_MNTH_STD_PRC": 15,
273            "OT_STD_PRC": 150
274          },
275          "PricingVariableCodeValues": {
276            "DISP_OT_STD_PRC": 150,
277            "ROLLUP_OT_STD_PRC_TOTAL": 2250,
278            "ROLLUP_REC_MNTH_STD_PRC_TOTAL": 225,
279            "REC_MNTH_STD_PRC_DISC_PCT_MAN": 0,
280            "OT_STD_PRC_DISC_PCT_MAN": 0,
281            "EFFECTIVE_QUANTITY": 1,
282            "LINE_QUANTITY": 1,
283            "EFF_REC_MNTH_STD_PRC_TOTAL": 240,
284            "REC_MNTH_STD_PRC_TOTAL": 240,
285            "REC_MNTH_STD_PRC_CALC": 15,
286            "REC_MNTH_STD_PRC": 15,
287            "EFF_OT_STD_PRC_TOTAL": 2400,
288            "OT_STD_PRC_TOTAL": 2400,
289            "OT_STD_PRC_CALC": 150,
290            "OT_STD_PRC": 150
291          },
292          "PriceAdjustmentPromoKeys": [],
293          "PricingVariableCodeFieldBinding": {
294            "navs_230__RecurringManualDiscount__c": "REC_MNTH_STD_PRC_DISC_PCT_MAN",
295            "navs_230__OneTimeManualDiscount__c": "OT_STD_PRC_DISC_PCT_MAN",
296            "navs_230__EffectiveQuantity__c": "EFFECTIVE_QUANTITY",
297            "Quantity": "LINE_QUANTITY",
298            "navs_230__EffectiveRecurringTotal__c": "EFF_REC_MNTH_STD_PRC_TOTAL",
299            "navs_230__RecurringTotal__c": "REC_MNTH_STD_PRC_TOTAL",
300            "navs_230__RecurringCalculatedPrice__c": "REC_MNTH_STD_PRC_CALC",
301            "navs_230__RecurringCharge__c": "REC_MNTH_STD_PRC",
302            "navs_230__EffectiveOneTimeTotal__c": "EFF_OT_STD_PRC_TOTAL",
303            "navs_230__OneTimeTotal__c": "OT_STD_PRC_TOTAL",
304            "navs_230__OneTimeCalculatedPrice__c": "OT_STD_PRC_CALC",
305            "navs_230__OneTimeCharge__c": "OT_STD_PRC"
306          },
307          "LogData": {
308            "REC_MNTH_STD_PRC_TOTAL": [
309              {
310                "ChargeTiming": null,
311                "LogSequence": 0,
312                "DisplayText": "[Recurring Calculated Price (15.00) + Rollup Recurring Total (225.00)] x Quantity (1.00)"
313              }
314            ],
315            "REC_MNTH_STD_PRC_CALC": [
316              {
317                "ChargeTiming": null,
318                "LogSequence": 0,
319                "DisplayText": "Recurring Charge (15.00000) - Recurring Manual Discount (0.00%)"
320              }
321            ],
322            "OT_STD_PRC_TOTAL": [
323              {
324                "ChargeTiming": "One-Time",
325                "LogSequence": 0,
326                "DisplayText": "[One Time Calculated Price (150.00) + Rollup One Time Total (2250.00)] x Quantity (1.00)"
327              }
328            ],
329            "OT_STD_PRC_CALC": [
330              {
331                "ChargeTiming": null,
332                "LogSequence": 0,
333                "DisplayText": "One Time Charge (150.00000) - One Time Manual Discount (0.00%)"
334              }
335            ],
336            "REC_MNTH_STD_PRC": [
337              {
338                "LogSequence": 0,
339                "IsEffective": true,
340                "EndDate": null,
341                "StartDate": null,
342                "AdjustmentType": "None",
343                "LoyaltyCode": "PTS",
344                "CurrencyCode": "USD",
345                "CurrencyType": "Currency",
346                "Amount": 15,
347                "AdjustmentValue": 0,
348                "AdjustmentMethod": null,
349                "BaseValue": 15,
350                "BaseAdjustment": null,
351                "PriceListId": "a3D4x0000009Fq4EAE",
352                "OfferId": null,
353                "PromotionId": null,
354                "PricingElementId": "a3F4x000000YdN1EAK",
355                "PricingVariableCode": "REC_MNTH_STD_PRC",
356                "DisplayText": "15_RB_flows_p_1",
357                "EndValue": 15,
358                "ChargeTiming": "Recurring",
359                "Frequency": "Monthly",
360                "SubType": "Standard",
361                "StartValue": 15,
362                "PricingElementGlobalKey": "8647d492-8302-a75d-3d3b-160dbd123199",
363                "LogType": "PRICE",
364                "PriceListEntryId": "a3C4x000000Z01jEAC"
365              }
366            ],
367            "OT_STD_PRC": [
368              {
369                "LogSequence": 0,
370                "IsEffective": true,
371                "EndDate": null,
372                "StartDate": null,
373                "AdjustmentType": "None",
374                "LoyaltyCode": "PTS",
375                "CurrencyCode": "USD",
376                "CurrencyType": "Currency",
377                "Amount": 150,
378                "AdjustmentValue": 0,
379                "AdjustmentMethod": null,
380                "BaseValue": 150,
381                "BaseAdjustment": null,
382                "PriceListId": "a3D4x0000009Fq4EAE",
383                "OfferId": null,
384                "PromotionId": null,
385                "PricingElementId": "a3F4x000000YdN0EAK",
386                "PricingVariableCode": "OT_STD_PRC",
387                "DisplayText": "150_OTB_flows_p_1",
388                "EndValue": 150,
389                "ChargeTiming": "One-time",
390                "Frequency": null,
391                "SubType": "Standard",
392                "StartValue": 150,
393                "PricingElementGlobalKey": "89603aff-f59c-210e-d76e-e88b0abf4b66",
394                "LogType": "PRICE",
395                "PriceListEntryId": "a3C4x000000Z01iEAC"
396              }
397            ]
398          }
399        },
400        "PricebookEntry": {
401          "Product2": {
402            "navs_230__JSONAttribute__c": null,
403            "navs_230__IsConfigurable__c": false,
404            "navs_230__GlobalGroupKey__c": "1303db74-24f1-2eb4-f3f5-7f61f410c602",
405            "navs_230__Type__c": "None",
406            "ProductCode": "flows_p_1",
407            "Name": "flows_p_1",
408            "Id": "01t4x000000ZFqbAAG",
409            "attributes": {
410              "url": "/services/data/v50.0/sobjects/Product2/01t4x000000ZFqbAAG",
411              "type": "Product2"
412            }
413          },
414          "Pricebook2Id": "01s4x000007JWrxAAG",
415          "Product2Id": "01t4x000000ZFqbAAG",
416          "Id": "01u4x000002SnHzAAK",
417          "attributes": {
418            "url": "/services/data/v50.0/sobjects/PricebookEntry/01u4x000002SnHzAAK",
419            "type": "PricebookEntry"
420          }
421        },
422        "OrderId": "8014x000000gFK4AAM",
423        "navs_230__IsChangesAllowed__c": true,
424        "navs_230__AssetReferenceId__c": "607a5789-6e0a-6c60-2738-614f3f5f0945",
425        "navs_230__EffectiveRecurringTotal__c": 240,
426        "navs_230__EffectiveOneTimeTotal__c": 2400,
427        "navs_230__CurrencyPaymentMode__c": "Currency",
428        "navs_230__RecurringManualDiscount__c": 0,
429        "navs_230__RecurringCalculatedPrice__c": 15,
430        "navs_230__RecurringCharge__c": 15,
431        "navs_230__OneTimeManualDiscount__c": 0,
432        "navs_230__OneTimeCalculatedPrice__c": 150,
433        "navs_230__OneTimeCharge__c": 150,
434        "ListPrice": 0,
435        "navs_230__InCartQuantityMap__c": "{\"01t4x000000ZFruAAG\":1}",
436        "navs_230__Product2Id__c": "01t4x000000ZFqbAAG",
437        "navs_230__RootItemId__c": "8024x000000kx0kAAA",
438        "navs_230__LineNumber__c": "0001",
439        "navs_230__ProductHierarchyPath__c": "01t4x000000ZFqbAAG",
440        "navs_230__ProvisioningStatus__c": "New",
441        "navs_230__Action__c": "Add",
442        "navs_230__RecurringTotal__c": 240,
443        "navs_230__OneTimeTotal__c": 2400,
444        "Quantity": 1,
445        "PricebookEntryId": "01u4x000002SnHzAAK",
446        "itemType": "lineItem",
447        "SellingPeriod": "Present",
448        "hasChildren": true,
449        "action": "Add",
450        "lineNumber": "0001",
451        "isVirtualItem": false,
452        "name": "flows_p_1",
453        "productHierarchyPath": "01t4x000000ZFqbAAG",
454        "productChildItemDefinition": {
455          "navs_230__ParentProductId__r": {
456            "Id": "01t4x000000ZFqbAAG",
457            "Name": "flows_p_1",
458            "navs_230__GlobalGroupKey__c": "1303db74-24f1-2eb4-f3f5-7f61f410c602",
459            "attributes": {
460              "url": "/services/data/v50.0/sobjects/Product2/01t4x000000ZFqbAAG",
461              "type": "Product2"
462            }
463          },
464          "navs_230__ChildLineNumber__c": "1",
465          "navs_230__MinQuantity__c": 0,
466          "navs_230__IsVirtualItem__c": false,
467          "navs_230__MaximumChildItemQuantity__c": 99999,
468          "navs_230__MaxQuantity__c": 99999,
469          "navs_230__IsRootProductChildItem__c": true,
470          "navs_230__IsOverride__c": false,
471          "navs_230__Quantity__c": 1,
472          "navs_230__CollapseHierarchy__c": false,
473          "Name": "Root PCI",
474          "navs_230__MinimumChildItemQuantity__c": 0,
475          "navs_230__ParentProductId__c": "01t4x000000ZFqbAAG",
476          "navs_230__SeqNumber__c": 1,
477          "attributes": {
478            "type": "navs_230__ProductChildItem__c"
479          }
480        },
481        "sequenceNumber": 1,
482        "groupMaxQuantity": 99999,
483        "groupMinQuantity": 0,
484        "maxQuantity": 99999,
485        "minQuantity": 0,
486        "defaultQuantity": 1,
487        "productId": "01t4x000000ZFqbAAG",
488        "CurrencyCode": "USD",
489        "Product2": {
490          "navs_230__JSONAttribute__c": null,
491          "navs_230__SubType__c": "None",
492          "navs_230__Type__c": "None",
493          "navs_230__GlobalGroupKey__c": "1303db74-24f1-2eb4-f3f5-7f61f410c602",
494          "navs_230__IsConfigurable__c": false,
495          "Name": "flows_p_1",
496          "Id": "01t4x000000ZFqbAAG",
497          "attributes": {
498            "url": "/services/data/v50.0/sobjects/Product2/01t4x000000ZFqbAAG",
499            "type": "Product2"
500          }
501        },
502        "navs_230__RecurringPrice__c": 240,
503        "IsActive": true,
504        "Name": "flows_p_1",
505        "UnitPrice": 0,
506        "ProductCode": "flows_p_1",
507        "Product2Id": "01t4x000000ZFqbAAG",
508        "Pricebook2Id": "01s4x000007JWrxAAG",
509        "Id": "8024x000000kx0kAAA",
510        "displaySequence": -1
511      }
512    ],
513    "totalSize": 1
514  },
515  "errorCode": "INVOKE-200",
516  "error": "OK"
517}