---
schema_version: "1"
id: b8c5edecd7a6d776553ac44429f0fcecc4c87f39a95ea60703cddc22c6792cbc
title: "SDK Example: getOfferDetails via API (Fall '19)"
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-apifall19-.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-sdk-examplegetofferdetails-via-apifall19-.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: d6eea05b06a512e83607617f226eea1a5c751d368243e9e09046e965a70cb5e6
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# SDK Example: getOfferDetails via API (Fall '19)

Use the example SDK code in this topic to validate an offer.

```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."
