---
schema_version: "1"
id: e296baf8c8fa57aad6ac5fc6ae3e726f5da0aa5399885944617bd540700008d8
title: Digital Commerce Remote Calls
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-t-digital-commerce-remote-calls.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-digital-commerce-remote-calls.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 31b8243fb24b26bfc0b747591a54fb339c990b426d3e47021d661a982595290d
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# Digital Commerce Remote Calls

You can use the code samples in this topic to make remote method calls to the Digital Commerce APIs for both anonymous and logged-in users.

## Sample Remote Calls

Get Offers By Catalog for Anonymous Users:

```nolang
String methodName;

Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

// Setting remote parameters
methodName = 'getOffersByCatalogCode';
input.put('apiName','getOffers');
input.put('catalogCode', 'ECOMM-CAT1');
input.put('pagesize','20');
input.put('offset','0');

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```

For more details about which parameters correspond to the POST body, refer to the API documentation.

Get Offers By Catalog for Logged In Users:

```nolang
String methodName;

Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

// Setting remote parameters
methodName = 'getOffersByCatalogCode';
input.put('apiName','getOffers');
input.put('catalogCode', 'ECOMM-CAT1');
input.put('pagesize','20');
input.put('offset','0');
input.put('context','{"accountId":"accountId1", "contractId":"contractId1"}');
input.put('isloggedin','true');

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```

Get Contains Products for Anonymous Users:

```nolang
String methodName;

Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

// Setting remote parameters
methodName = 'getOffersByCatalogCode';
input.put('apiName','GetContainOffers');
input.put('catalogCode', 'ECOMM-CAT1');
input.put('requestURL', '/v3/catalogs/ECOMM-CAT1/offers?contains=Child1&context={}&pagesize=20&offset=0');
input.put('productCode', 'Child1');input.put('pagesize','20');
input.put('offset','0');

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```

Get Contains Products for Logged In Users:

```nolang
String methodName;

Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

// Setting remote parameters
methodName = 'getOffersByCatalogCode';
input.put('apiName','GetContainOffers');
input.put('catalogCode', 'ECOMM-CAT1');
input.put('requestURL', '/v3/catalogs/ECOMM-CAT1/offers?contains=Child1&pagesize=20&offset=0');
input.put('productCode', 'Child1');input.put('pagesize','20');
input.put('offset','0');
input.put('context','{"accountId":"accountId1", "contractId":"contractId1"}');
input.put('isloggedin','true');

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```

GetOfferDetailsByCatalog for Anonymous Users:

```nolang
String methodName;

Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

// Setting remote parametersmethodName = 'getOfferDetailsByCatalogCode';
input.put('apiName','getOfferDetails');
input.put('catalogCode', 'ECOMM-CAT1');
input.put('requestURL', '/v3/catalogs/ECOMM-CAT1/offers/iPhone8Bundle');

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```

GetOfferDetails ByCatalog for Logged In Users:

```nolang
String methodName;

Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

// Setting remote parameters
methodName = 'getOfferDetailsByCatalogCode';
input.put('apiName','getOfferDetails');
input.put('catalogCode', 'ECOMM-CAT1');
input.put('requestURL', '/v3/catalogs/ECOMM-CAT1/offers/iPhone8Bundle');
input.put('context','{"accountId":"accountId1", "contractId":"contractId1"}');
input.put('isloggedin','true');

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```

Get Basket for Logged In Users:

```nolang
String methodName;

Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

// Setting remote parameters
methodName = 'getBasket';
input.put('apiName','basketOperations');
input.put('catalogCode', 'ECOMM-CAT1');
input.put('requestURL', '/v3/catalogs/ECOMM-CAT1/basket');
input.put('context','{"accountId":"accountId1", "contractId":"contractId1"}');
input.put('isloggedin','true');
input.put('cartContextKey', 'cartContextKey');

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```

## POST API Sample Calls

Configure Offer for Anonymous or Logged In Users:

```nolang
String methodName;

Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

// Setting remote parameters
methodName = 'configureOfferDetail';
input.put('apiName','ConfigureOfferDetail');
input.put('catalogCode', 'ECOMM-CAT1');
input.put('offerCode', 'iPhone8Bundle');
input.put('requestURL', '/v3/catalogs/ECOMM-CAT1/offer/iPhone8Bundle');
input.put('result', '{{offerdetailsStructure}}');

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```

Additional parameters:

```nolang
// Transactional break for ValidateAndPriceAction 
input.put('orderId', '{{transactionKey}}');

// validate and price 
input.put('validate', false);
input.put('price', false);
```

Basket API for Anonymous or Logged In Users:

```nolang
String methodName;

Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

// Setting remote parametersmethodName = 'addWithNoConfig';
input.put('apiName','basketOperations');
input.put('catalogCode', 'ECOMM-CAT1');
input.put('offer', 'Product1');input.put('methodName', 'addWithNoConfig');
input.put('requestURL', '/v3/catalogs/ECOMM-CAT1/basket');

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```

Additional parameters include different method names (note that their first letter is not capitalized unlike in REST POST body params):

- addWithNoConfig

- addAfterConfig

- deleteFromBasket

Additional input map parameters include:

- offerDetails - same as productConfig

- orderId - same as transactionKey

- cartContextKey

- deleteBundleNumber

Refer to Basket APIs documentation for more details on what they correspond to in POST body params.

```nolang
// validate and price 
input.put('validate', false);
input.put('price', false);
```

Basket API: Asset to Basket for Logged In Users:

```nolang
String methodName;

Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

// Setting remote parameters
methodName = 'assetToBasket';
input.put('apiName','basketOperations');
input.put('catalogCode', 'ECOMM-CAT1');
input.put('requestURL', '/v3/catalogs/ECOMM-CAT1/basket');
input.put('methodName', 'assetToBasket');
input.put('context','{"accountId":"accountId1", "contractId":"contractId1", "rootAssetIds":["rootItemId1", "rootItemId2"]}');
input.put('isloggedin','true');
input.put('rootAssetIds', 'rootItemId1,rootItemId2');
input.put('requestDateTime', '2020-01-08T12:00:00.000z');
input.put('requestURL', '/v3/catalogs/ECOMM-CAT1/basket');

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```

Additional Parameters:

```nolang
// validate and price 
input.put('validate', false);
input.put('price', false);
```

Basket API: Delete From Basket for Anonymous or Logged in Users:

```nolang
String methodName;

Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

// Setting remote parameters
methodName = 'deleteFromBasket';
input.put('apiName','basketOperations');
input.put('methodName','deleteFromBasket');
input.put('catalogCode', 'ECOMM-CAT1');
input.put('requestURL', '/v3/catalogs/ECOMM-CAT1/basket');
input.put('cartContextKey', 'cartContextKey');

//Use the cart context
keyinput.put('bundleContextKey', 'bundleContextKey');

//Use the key of the bundle under which the line to be deleted
input.put('lineItemKey', 'lineItemKey');

//Use the key of the line to be deleted
input.put('context','{"accountId":"accountId1", "contractId":"contractId1"}');
input.put('isloggedin','true');

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```

Additional parameters:

```nolang
// validate and price 
input.put('validate', false);
input.put('price', false);

```

Basket API: Update Basket for Anonymous or Logged In Users:

```nolang
String methodName;

Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

// Setting remote parameters
methodName = 'updateBasket';input.put('apiName','basketOperations');
input.put('methodName','updateBasket');
input.put('catalogCode', 'ECOMM-CAT1');
input.put('requestURL', '/v3/catalogs/ECOMM-CAT1/basket');
input.put('cartContextKey', 'cartContextKey');

//Use the cart context keyinput.put('bundleContextKey', 'bundleContextKey');

//Use the key of the bundle under which the line to be deleted
input.put('lineItemKey', 'lineItemKey');

//Use the key of the line to be updatedinput.put('Quantity', 5);

//Quantity to be updated
input.put('context','{"accountId":"accountId1", "contractId":"contractId1"}');
input.put('isloggedin','true');

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```

Additional parameters:

```nolang
// validate and price
input.put('validate', false);
input.put('price', false);

// to update attribute 
input.put('attributeCategories', 'attributecategorystring'); //attribute category to be updated
```

Basket API : Add Multiple Items to a Basket:

```nolang
String methodName;
Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

methodName = 'addWithNoConfig';
input.put('apiName','basketOperations');
input.put('catalogCode', 'ECOMM-CAT1');
input.put('productConfig', [list of product configs]); //this is the list of product configs or single product config to add
input.put('offer', [list of offers to add]); //list of offer codes to add or single offer code to add
input.put('methodName', 'addAfterConfig');
input.put('requestURL', '/v3/catalogs/ECOMM-CAT1/basket');

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```

Create Cart for Logged In Users:

```nolang
String methodName;

Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

// Setting remote parameters
methodName = 'createEcomCart';
input.put('apiName','createEcomCart');
input.put('methodName','createEcomCart');
input.put('catalogCode', 'ECOMM-CAT1');
input.put('requestURL', '/v3/carts');
input.put('cartContextKey', 'cartContextKey');//Use the cart context key
input.put('context','{"accountId":"accountId1", "contractId":"contractId1"}');
input.put('isloggedin','true');

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);

```

Additional Parameters

```nolang
// validate and price
input.put('validate', false);
input.put('price', false);

//Old format:
 input.put('catalogCode', 'Mobiles');
input.put('accountId', '001f200001eSlhe');
input.put('JSONResult', '{{AddTobasketResponse}}');
```

Basket API : Add Child Items to a Basket:

```nolang
String methodName;

Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

// Setting remote parameters
methodName = 'addWithNoConfig';
input.put('apiName','basketOperations');
input.put('catalogCode', 'catalog_Apr18');
input.put('offer', '300MbpsRouter-129356540');
input.put('methodName', 'addWithNoConfig');
input.put('cartContextKey', '1aa8bcbb632946e295cbe98b2fffa91b');
input.put('parentHierarchyPath', '01tDH000000MYRPYA4');
input.put('bundleContextKey', 'a9347c07-9793-4e78-8371-9ac4e50e96df');
input.put('parentLineItemKey', 'a9347c07-9793-4e78-8371-9ac4e50e96df');
input.put('requestURL', '/v3/catalogs/catalog_Apr18/basket');

//remote action invocation
vlocity_cmt.CpqAppHandler appHandler = new vlocity_cmt.CpqAppHandler();
appHandler.invokeMethod(methodName, input, output, options);
```
