Got questions? Leave your message here or Schedule a quick call with our manager now

How to connect Demandware to API2Cart?

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 Api2Cart.

Then, add permissions for API2Cart API, 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":"(**)"
        }
      ]
    }
  ]
}
      
    

Posted in: Getting Started