---
schema_version: "1"
id: 81489320c603f89c40941eda4f23e0517811fe5a5513896a549f588c478359b9
title: "SDK Example: Get List of Promotions or Promotions associated with a Product (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-list-of-promotions-or-promotions-associated-with-a-productfall20.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-sdk-list-of-promotions-or-promotions-associated-with-a-productfall20.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 0034c17f99eea38004dc01123e8445d7337b3a61c9bc23da0e49fee6f4a69408
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# SDK Example: Get List of Promotions or Promotions associated with a Product (Fall '20)

Use the example SDK code in this topic to retrieve all promotions or promotions that are associated with a product.

```nolang
// Instantiate the input object for getOffers to specify parameters.
const input = digitalCommerce.createGetOffersInput();
input.catalogCode = "Phones"; // use your Catalog Code
input.offerCode = "iPhoneX"; //  If offerCode value is passed return all associated promotions for that product.If offerCode not passed return all promotions associated to products. - optional

// Invoke GetOffersByCatalog API via method getPromotions()
digitalCommerce
  .getPromotions(input)
  .then(result => {
    Logger.info("vlocity get promotions anonymous user rest call" + result);
  })
  .catch(error => {
    Logger.info("get promotions anonymous user rest call failed" + error);
  });

```

Possible error conditions:

"GetCatalogOffersInput::getAPIPath() must have catalogCode."

"GetCatalogOffersInput::getAnonymousRestUrl() must have anonymousSiteUrl."

"GetCatalogOffersContainsInput::getAPIPath() should not have both sortBy and contains.

"GetCatalogOffersContainsInput::getAnonymousRestUrl() should not have both sortBy and contains."
