Generating your Salesforce Commerce Cloud API Client ID and updating your Open Commerce API configuration for the Dynamic Creative Ad Platform

Step 1 will help you generate an API Client ID.

Step 2 will help update your Open Commerce API (OCAPI) settings.


Step 1 - Generating an API Client ID

To connect your Salesforce Commerce Cloud website to Dynamic Creative you will need to generate an API Client ID.

Account administrators can use Salesforce Account Manager to create API client IDs. To add an API Client and get the API Client ID, perform the following steps:

  1. Log into Account Manager.
  2. Click API Client.

    The API Clients page opens, showing a list of client IDs and, for each ID, a related display name. The display name is a human readable value that identifies the client.

  3. Click Add API Client.
  4. Enter the display name of the client e.g. "Dynamic Creative Ad Platform" in the Display Name field. 
  5. Click Add.

    Account Manager creates a client ID for the display name you provided.

  6. Click Add.

    The API Clients page opens showing a list of Client IDs and, for each ID, a related display name.

  7. Copy your Client ID and enter it in the Dynamic Creative Ad Platform.

From here, you can proceed to updating your Open Client API (OCAPI) settings.

Step 2 - Updating your Open Commerce API (OCAPI) settings

To enable Dynamic Creative to access the required information from your Salesforce Commerce Cloud website you will need to update your Open Commerce API (OCAPI) settings.

Business Managers can use Salesforce Commerce Cloud Business Manager to to create API client IDs. To add an API Client and get the API Client ID, perform the following steps:

  1. Log into the Salesforce Commerce Cloud Business Manager.
  2. Click Administration.
  3. Under Site Development, Click Open Commerce API settings.
  4. From the Select Type selector, select Shop.
  5. From the Select Context selector, select your store.
  6. Depending on whether you have existing OCAPI settings you wish to keep or not, either add an entry to the clients list of your existing OCAPI settings or create new OCAPI settings.
Add an entry to the clients list of your existing OCAPI settings

Your existing OCAPI settings will look something like as follows:

{
  "_v":"16.3",
  "clients":
  [
    {
      ... your existing client entries
    }
  ]
}<br>

Add a comma after the last } before the ] which ends your clients list, and paste the contents shown under New client entry below. Update the client_id fleld (shown as xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) with the value of your API Client ID from Step 1 - Generating an API Client ID from above. 

Create new OCAPI settings

Create new OCAPI settings as follows:

{
  "_v":"16.3",
  "clients":
  [

  ]
}

Between the lines with a [ and a ], paste the contents shown under New client entry below. Update the client_id fleld (shown as xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) with the value of your API Client ID from Step 1 - Generating an API Client ID from above

New client entry

When using this entry, update the client_id fleld (shown as xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) with the value of your API Client ID from  Step 1 - Generating an API Client ID from above

    {
      "client_id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "allowed_origins":[],
      "resources":
      [
        {
          "resource_id":"/categories/*",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":900
        },
        {
          "resource_id":"/product_lists",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)"
        },
        {
          "resource_id":"/product_lists/*",
          "methods":["get","patch"],
          "read_attributes":"(**)",
          "write_attributes":"(**)"
        },
        {
          "resource_id":"/product_lists/*/items",
          "methods":["get","post"],
          "read_attributes":"(**)",
          "write_attributes":"(**)"
        },
        {
          "resource_id":"/product_lists/*/items/*",
          "methods":["patch","delete"],
          "read_attributes":"(**)",
          "write_attributes":"(**)"
        },
        {
          "resource_id":"/product_search",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":900
        },
        {
          "resource_id":"/product_search/availability",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":60
        },
        {
          "resource_id":"/product_search/images",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "config":{
            "search_result.hits.image:view_type":"large",
            "search_result.variation_attributes.values.image:view_type":"medium",
            "search_result.variation_attributes.values.image_swatch:view_type":"swatch"
          },
          "cache_time":900
        },
        {
          "resource_id":"/product_search/prices",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":300
        },
        {
          "resource_id":"/product_search/variations",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":887
        },
        {
          "resource_id":"/products/*",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":900
        },
        {
          "resource_id":"/products/*/images",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":900
        },
        {
          "resource_id":"/products/*/availability",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "config":{
            "product.inventory.ats.max_threshold" : "99",
            "product.inventory.stock_level.max_threshold" : "99"
          },
          "cache_time":60
        },
        {
          "resource_id":"/products/*/prices",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "config":{
            "product.prices.price_book_ids":"usd-sale-prices,usd-list-prices"
          },
          "cache_time":300
        },
        {
          "resource_id":"/products/*/links",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":900
        },
        {
          "resource_id":"/products/*/promotions",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":900
        },
        {
          "resource_id":"/products/*/options",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":900
        },
        {
          "resource_id":"/products/*/links",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":900
        },
        {
          "resource_id":"/products/*/recommendations",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":900
        },
        {
          "resource_id":"/products/*/variations",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":900
        },
        {
          "resource_id":"/promotions",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":900
        },
        {
          "resource_id":"/promotions/*",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":900
        },
        {
          "resource_id":"/site",
          "methods":["get"],
          "read_attributes":"(**)",
          "write_attributes":"(**)",
          "cache_time":900
        }
      ]
    }

Still need help? Contact Us Contact Us