---
schema_version: "1"
id: b57b19dbbb4b6b4b962bd092af370523a8753724157d6a50808b88d32cd7bfc2
title: "SDK Example: Get List of Promotions or Promotions associated with a Product (Winter '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-productwinter20.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-sdk-list-of-promotions-or-promotions-associated-with-a-productwinter20.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 8c7250b2c6035de9eed1e15c63d57638f1e56b8f06ecb945a49496e50a040880
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# SDK Example: Get List of Promotions or Promotions associated with a Product (Winter '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."
