---
schema_version: "1"
id: e4b10c4b124cdfb9866ff8b9ce89d69c10b86b4e5cc1fb11f439042b5c26ec61
title: "SDK Example: getOfferDetails via API (Fall '20)"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-t-sdk-examplegetofferdetails-via-apifall20-.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-sdk-examplegetofferdetails-via-apifall20-.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 3d7ef1562125518a4daea910e673ad5a01bfe99cc7e89d6badbf955afc2065f5
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# SDK Example: getOfferDetails via API (Fall '20)

Use the example SDK code in this topic to obtain offer details via the API.

```nolang
// Instantiate the input object for getOfferDetails to specify parameters
const input = digitalCommerce.createGetOfferInput();
input.catalogCode = "Phones"; // use your Catalog Code
input.offerCode = "iPhoneXS"; // use your Offer Code
input.cacheable = false; // Optional Flag to indicate if the sdk call should be cached. Default is false.
input.reload = false; // Optional Boolean flag to discard cache and call the api again. Default is false.
input.isLoggedIn = true; // use to fetch offers based on given accountId - optional
input.context = '{"accountId":"ACCOUNT ID"}'; // use to fetch offers based on given context params - optional
input.customFields = ["customAttribute__c"]; // optional field which returns your custom attributes or any given keys

// Invoke GetOfferDetails API via method getOfferDetails()
digitalCommerce
  .getOffer(input)
  .then(response => {
    Logger.info("vlocity get offer anonymous user rest call" + response);
  })
  .catch(error => {
    Logger.info("get offer anonymous user rest call failed" + error);
  });

```

Possible error conditions:

- "GetOfferInput::getAPIPath() must have catalogCode."

- "GetOfferInput::getAPIPath() must have offerCode."
