How to generate your Salesforce Commerce Cloud API key

Created by Mikkel Rosener, Modified on Mon, 13 May at 3:51 PM by Mikkel Rosener

First, go to the Account Manager page (https://account.demandware.com/dw/account/Home), generate dw_client_id (Client Id) and dw_api_pass (Api Password).



Please provide the API client name and password, and select your organization.


Add the necessary roles for your API client and allowed scopes.


You can find a list of scopes here:
https://developer.salesforce.com/docs/commerce/commerce-api/guide/auth-z-scope-catalog


Select "client_secret_post" for the Token Endpoint Auth Method field.


For the Redirect URIs field, specify your Redirect URI.


For a detailed guide on creating an API Сlient in Demandware, you can find it at the following link.


The API Сlient ID and password created during setup will be used as parameters "demandware_client_id" and "demandware_api_password" when adding a store on Reaktion.


Then, add permissions, so that our API could retrieve data from the store. Go to your Admin panel: Administration > Open Commerce API Setting > Select type: Shop & Data > Select context: Global



Then, specify client application-specific configurations:

For Type Shop:

Global permissions

  
  {
    "_v":"22.6",
    "clients":[
       {
          "client_id":"YOUR_CLIENT_ID",
          "allowed_origins": [

          ],
          "resources":[
             {
                "resource_id":"/products/*/prices",
                "methods":["get"],
                "read_attributes":"(**)",
                "write_attributes":"(**)",
                "config":{
                   "product.prices.price_book_ids":"PRICE_BOOK_ID_1,PRICE_BOOK_ID_2,...,PRICE_BOOK_ID_N"
                }
             },
             {
                "resource_id":"/**",
                "methods":[
                   "put",
                   "get",
                   "post",
                   "patch"
                ],
                "read_attributes":"(**)",
                "write_attributes":"(**)"
             }
          ]
       }
    ]
  }
  


Or per resource permissions

  
  {
  "_v": "22.6",
  "clients": [
    {
      "client_id": "YOUR_CLIENT_ID",
      "allowed_origins": [],
      "resources": [
        {
          "resource_id": "/products/*/prices",
          "methods": [ "get" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)",
          "cache_time": 0,
          "config": {
             "_comment": "Add a comma-separated list of the price book ids currently active in the organization",
             "product.prices.price_book_ids": "REPLACE_ME_WITH_PRICE_BOOK_IDS"
          }
        },
        {
          "resource_id": "/baskets",
          "methods": [ "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*",
          "methods": [ "get", "patch", "delete" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/billing_address",
          "methods": [ "put" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/coupons",
          "methods": [ "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/coupons/*",
          "methods": [ "delete" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/customer",
          "methods": [ "put" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/gift_certificate_items",
          "methods": [ "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/items",
          "methods": [ "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/items/*",
          "methods": [ "patch", "delete" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/notes",
          "methods": [ "post", "get" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/payment_instruments",
          "methods": [ "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/payment_instruments/*",
          "methods": [ "patch", "delete" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/payment_methods",
          "methods": [ "get" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/shipments",
          "methods": [ "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/shipments/*",
          "methods": [ "patch" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/shipments/*/shipping_address",
          "methods": [ "put" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/shipments/*/shipping_method",
          "methods": [ "put" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*/shipments/*/shipping_methods",
          "methods": [ "get" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/baskets/*",
          "methods": [ "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/customers",
          "methods": [ "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/customers/auth",
          "methods": [ "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/customers/password_reset",
          "methods": [ "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/customers/*",
          "methods": [ "get", "patch" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/customers/*/addresses",
          "methods": [ "get", "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/customers/*/addresses/*",
          "methods": [ "get", "patch", "delete" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/customers/*/baskets",
          "methods": [ "get" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/customers/*/orders",
          "methods": [ "get" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/customers/*/password",
          "methods": [ "put" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/customers/*/payment_instruments",
          "methods": [ "get", "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/customers/*/payment_instruments/*",
          "methods": [ "get", "delete" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/orders",
          "methods": [ "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/orders/*",
          "methods": [ "get", "patch" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/orders/*/notes",
          "methods": [ "get", "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/orders/*/payment_methods",
          "methods": [ "get" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/orders/*/payment_instruments",
          "methods": [ "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/order_search",
          "methods": [ "post" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/products/*",
          "methods": [ "get" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/products/*/availability",
          "methods": [ "get" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)",
          "cache_time": 0
        },
        {
          "resource_id": "/site",
          "methods": [ "get" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/categories/*",
          "methods": [ "get" ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        }
      ]
    }
  ]
}
For Type Data

Global permissions


{
  "_v":"22.6",
  "clients":[
     {
        "client_id":"YOUR_CLIENT_ID",
        "resources":[
           {
              "resource_id":"/**",
              "methods":[
                 "put",
                 "get",
                 "post",
                 "patch"
              ],
              "read_attributes":"(**)",
              "write_attributes":"(**)"
           }
        ]
     }
  ]
}


Or per resource permissions

      
      {
  "_v": "22.6",
  "clients": [
    {
      "client_id": "YOUR_CLIENT_ID",
      "resources": [
        {
          "resource_id": "/sites",
          "methods": [
            "get"
          ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/sites/**",
          "methods": [
            "get"
          ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/catalog_search",
          "methods": [
            "post"
          ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/product_search",
          "methods": [
            "post"
          ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/products/*",
          "methods": [
            "get",
            "patch"
          ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/products/*/variant_search",
          "methods": [
            "post"
          ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/products/*/variations",
          "methods": [
            "get"
          ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/products/*/variation_attributes",
          "methods": [
            "get"
          ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/customer_lists/**",
          "methods": [
            "get",
            "post"
          ],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/inventory_lists/*",
          "methods": ["patch"],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
          "resource_id": "/inventory_lists/*/product_inventory_records/*",
          "methods": ["patch", "put", "get"],
          "read_attributes": "(**)",
          "write_attributes": "(**)"
        },
        {
           "resource_id":"/system_object_definitions/**",
           "methods":["get", "put" , "patch", "post", "delete"],
           "read_attributes":"(**)",
           "write_attributes":"(**)"
        }
      ]
    }
  ]
}
      
    

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article