← Back to EcomCentral
DEMANDWARE / SFCC LEGACY OCAPI

Demandware / SFCC Setup Guide

Connect your Salesforce B2C Commerce Cloud instance to EcomCentral using the legacy Open Commerce API (OCAPI) with Account Manager client-credentials authentication.

OCAPI vs. SCAPI — Which API Is This?

ℹ️ EcomCentral uses the legacy OCAPI (Open Commerce API), not the modern SCAPI (Shopper APIs). OCAPI is the long-standing REST interface built into every Salesforce B2C Commerce sandbox and production site. It is often called "Demandware API" because it predates the Salesforce acquisition.
PropertyOCAPI (this integration)SCAPI (not used)
Full nameOpen Commerce APIShopper APIs / Commerce APIs
Base URL pattern/s/{site}/dw/shop/{version}/s/{site}/dw/shop/{version} or ECOM CDN
AuthAccount Manager client-credentials Bearer tokenPKCE / Shopper login tokens
Order writeYes (limited)No (read-optimised)
Inventory writeNo — use OCI / Inventory ListsNo
Tracking pushNo — use Business ManagerNo

Prerequisites

ℹ️ OCAPI uses client-credentials OAuth2 via Account Manager — no browser login required. The access token expires (typically 30 min). EcomCentral sends the token you provide; it does not refresh it automatically. Rotate the credential in EcomCentral whenever the token expires.

Getting Your API Credentials

  1. Log in to Account Manager and go to API Client
  2. Click Add API Client — set a name and assign it to your organization
  3. Under Access, select Client Credentials grant type and save the Client ID and Client Secret
  4. In Business Manager, go to Administration → Site Development → Open Commerce API Settings
  5. Under Shop API, add a permission entry for your client_id granting access to /orders/** and /products/**
  6. Obtain an access token by posting to Account Manager's token endpoint:
    POST https://account.demandware.com/dw/oauth2/access_token?client_id={id}&client_secret={secret}&grant_type=client_credentials
  7. In EcomCentral, add a new Demandware connection and fill in all five credential fields below
  8. Click ⚡ Test — should return your site ID, host, and API version

Credentials Reference

KeyRequiredDescriptionExample
host Required Instance hostname — the full subdomain of your B2C Commerce instance abc-001.dx.commercecloud.salesforce.com
site Required Site ID from Business Manager (Administration → Sites → Manage Sites) RefArch
client_id Required Account Manager API client ID used for identifying the caller and for authentication aaaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
access_token Required OAuth2 Bearer token obtained via client-credentials grant from Account Manager. Short-lived (typically 30 min). eyJ0eXAiOiJKV1Qi…
version Optional OCAPI version string. Defaults to v23_2 if omitted. Use the version supported by your instance. v23_2
✅ Alternative key names accepted: instance for host; site_id for site; clientId for client_id; token for access_token.

API Endpoints Used

OperationMethodShop API Path
Test connectionGET/s/{site}/dw/shop/{ver}/site
List ordersPOST/s/{site}/dw/shop/{ver}/order_searchmatch_all_query, sorted creation_date desc
Order detailGET/s/{site}/dw/shop/{ver}/orders/{order_no}
List productsGET/s/{site}/dw/shop/{ver}/product_search?q=&refine_1=cgid=root&expand=prices,availability
Product detail + availabilityGET/s/{site}/dw/shop/{ver}/products/{product_id}?expand=availability
ℹ️ All requests include both Authorization: Bearer {access_token} and x-dw-client-id: {client_id} headers, plus ?client_id={client_id} on the URL as required by OCAPI client-application identification rules.

⚠️ Limitations — Unsupported Operations

Tracking push (add_tracking) is not supported. The OCAPI Shop API order resource has no tracking number field. Fulfillment and shipment management must be done directly in Salesforce Commerce Cloud Business Manager or via a custom integration with a fulfilment provider.
Stock update (update_stock) is not supported. Inventory in SFCC B2C Commerce is managed by Inventory Lists within Business Manager or via the newer OCI (Omnichannel Inventory) API, which is separate from OCAPI. EcomCentral uses OCAPI read endpoints only; inventory writes require OCI or a B2C Commerce import job.

Why can't OCAPI update inventory or tracking?

OCAPI is a shopper-facing API: it exposes product availability and order placement for storefront use. It was not designed for back-office write operations. Salesforce intentionally separates inventory management (Inventory Lists / OCI) and fulfillment (Business Manager / OMS) from the commerce-facing Shop API to enforce data integrity and audit controls.

Supported Features

FeatureSupportedNotes
View orders (paginated)Order number, date, status, total, currency via order_search
View order detailCustomer info, billing address, shipping address + method, shipment status, product items with qty and price
View products (paginated)Product ID, name, price, ATS (available to sell) via product_search with expand=prices,availability
View product detail (availability)Inventory ATS, stock_level, orderable flag; first product image; category; prices per currency
Test connectionReturns host, site ID, API version from the /site endpoint
Add tracking / push shipmentNot supported by OCAPI. Use Business Manager or an OMS integration.
Update stock quantityNot supported by OCAPI. Use Inventory Lists / OCI API in Business Manager.

Troubleshooting

✕ 401 Unauthorized

The access_token has expired (typically 30-minute lifetime) or the client_id is incorrect. Request a fresh token from Account Manager using the client-credentials grant and update the credential in EcomCentral via Rotate Keys.

✕ OCAPI fault: "ResourceNotFoundException" on orders

The OCAPI Shop API permission for /orders/** has not been granted to your client_id in Business Manager. Navigate to Administration → Site Development → Open Commerce API Settings → Shop and add the client_id entry with the required resources.

✕ Test connection fails with "API not configured"

One or more required fields (host, client_id, access_token) are empty. Verify all five credential fields are populated in your EcomCentral connection.

✕ Product search returns empty hits

The Shop API product search uses refine_1=cgid=root to enumerate from the catalog root. If your site has a different root category ID, you may need to adjust the refinement. Also ensure the storefront catalog is published and the API client has product read access.