--- title: 'Index Salesforce Commerce Cloud: Pull approach' slug: sal3s118 canonical_url: https://docs.coveo.com/en/sal3s118/ collection: coveo-for-commerce source_format: adoc --- # Index Salesforce Commerce Cloud: Pull approach This article explains how to pull data from a Salesforce Commerce Cloud instance (previously known as Demandware) to a [Coveo organization](https://docs.coveo.com/en/185/). The indexed data is then used in a Coveo-powered search interface implemented in your [storefront](https://docs.coveo.com/en/p33g0410/). ## Prerequisites Make sure that you have: * Data in your Salesforce Commerce Cloud instance. * Access to the [B2C Account Manager](https://account.demandware.com/) (also known as the Demandware login page). To get access, you have to contact an account administrator within your organization. * A [SLAS client created](https://developer.salesforce.com/docs/commerce/commerce-api/guide/authorization-for-shopper-apis.html#create-a-slas-client). ## Index a Salesforce Commerce Cloud . Log in to the SLAS Admin UI by using your [own short code](https://developer.salesforce.com/docs/commerce/commerce-api/guide/commerce-api-configuration-values.html#short-code). ```bash https://.api.commercecloud.salesforce.com/shopper/auth-admin/v1/ui/ ``` . Once logged in, you can see the `Client ID` and `Secret` fields. Copy the values of these fields and store them somewhere locally. . To create a token for indexing data, make a POST request to the [`getAccessToken`](https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-login?meta=getAccessToken) endpoint of the Shopper Login API. You can do it by using the [Postman](https://www.postman.com/) application. .. Use the `Client ID` and `Secret` values from the previous steps as `Login` and `Password` respectively. .. Specify `Basic Auth` as the Authentication Type. .. Substitute your [shortCode](https://developer.salesforce.com/docs/commerce/commerce-api/guide/commerce-api-configuration-values.html#short-code) and [organizationId](https://developer.salesforce.com/docs/commerce/commerce-api/guide/commerce-api-configuration-values.html#organization-id) ```bash https://{shortCode}.api.commercecloud.salesforce.com/shopper/auth/v1/organizations/{organizationId}/oauth2/token ``` You'll receive an SLAS token in a response. > **Important** > > The SLAS token is valid only for 30 minutes. > Once it expires, you have to create a new one. . Access the [**Sources**](https://platform.cloud.coveo.com/admin/#/orgid/content/sources/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/content/sources/)) page of the [Coveo Administration Console](https://docs.coveo.com/en/183/) and add a [REST API cloud source](https://docs.coveo.com/en/1896/). > **Important** > > To fully benefit from all commerce-related capabilities, the REST API source must be Stream API-enabled. > This allows the source to leverage [Coveo Personalization-as-you-go](https://docs.coveo.com/en/m5kd0347/) capabilities, as well as event enrichment through the [Event Protocol](https://docs.coveo.com/en/o9je0592/). > > Contact your Coveo representative to enable the Stream API for your REST API source. . On the **Configuration** tab, expand the **Content to include** section and paste the following JSON. ```json { "Services": [ { "Paging": { "PageSize": 200, "offset": 0, "OffsetType": "item", "Parameters": { "Limit": "limit", "Offset": "offset" } }, "Url": "https://{shortCode}.api.commercecloud.salesforce.com/", <1> "Endpoints": [ { "Headers": { "Authorization": "Bearer @ApiKey" <2> }, "Path": "/search/shopper-search/v1/organizations/{organizationId}/product-search", <3> "QueryParameters": { "q": "storefront-catalog-m-en", "limit": "200", <4> "siteId": "RefArch" <5> }, "Method": "GET", "ItemType": "products", "ItemPath": "hits", "Uri": "https://zzte-053.sandbox.us02.dx.commercecloud.salesforce.com/s/RefArch/%[productName]/%[productId].html", <6> "ClickableUri": "https://zzte-053.sandbox.us02.dx.commercecloud.salesforce.com/s/RefArch/%[productName]/%[productId].html", "Title": "%[productName] %[productId]", "ModifiedDate": "%[modified_time]", "Body": "%[productName] %[price] %[currency]", "Metadata": { "ec_name": "%[productName]", "ec_price": "%[price]", "ec_productid": "%[productId]", "ec_colors": "%[variationAttributes[?(@.id=='color')].values[:].name]" }, "SubQueries": [ { "Method": "GET", "Path": "/product/shopper-products/v1/organizations/f_ecom_zzte-053/products/%[coveo_parent.ec_productid]", "Headers": { "Authorization": "Bearer @ApiKey" }, "QueryParameters": { "siteId": "RefArch" }, "metadata": { "ec_brand": "%[brand]", "ec_description": "%[longDescription]", "ec_shortdesc": "%[shortDescription]", "ec_category_code": "%[primaryCategoryId]" } } ], "SubItems": [ { "ItemPath": "variationAttributes", "ItemType": "variations", "image": "%[coveo_parent.raw.image.link]", "Uri": "https://%[coveo_parent.raw.productId]/%[id]/%[name]", "ClickableUri": "https://%[coveo_parent.raw.productName]/%[id]", "Title": "%[coveo_parent.raw.productName] %[id]", "ModifiedDate": "%[modified_time]", "Body": "%[coveo_parent.raw.productName] %[coveo_parent.raw.price] %[coveo_parent.raw.currency] %[name]" } ] } ] } ] } ``` <1> Use your [short code](https://developer.salesforce.com/docs/commerce/commerce-api/guide/commerce-api-configuration-values.html#short-code). <2> Specify the SLAS token from the previous step. <3> Use your [organizationId](https://developer.salesforce.com/docs/commerce/commerce-api/guide/commerce-api-configuration-values.html#organization-id). <4> The maximum number of products to retrieve. This is a limit set by the Salesforce Shoppers APIs. <5> Substitute your [siteId](https://developer.salesforce.com/docs/commerce/commerce-api/guide/commerce-api-configuration-values.html#site-id). <6> Use your [Business Manager URL](https://developer.salesforce.com/docs/commerce/commerce-api/guide/commerce-api-configuration-values.html#organization-id) and [siteId](https://developer.salesforce.com/docs/commerce/commerce-api/guide/commerce-api-configuration-values.html#site-id) in this and the next fields. . Click **Add source**. Once the source is built or rebuilt, you can [review its content in the Content Browser](https://docs.coveo.com/en/2053/). ## Add the Coveo search to your storefront Depending on what type of architecture you use, you can add the Coveo search to your storefront by following one of the following articles: * [Use Coveo Search in the Salesforce Composable Storefront (PWA Kit)](https://docs.coveo.com/en/sal3s119/) * [Use Coveo Search in Salesforce B2C Storefront Reference Architecture (SFRA)](https://docs.coveo.com/en/sal3s200/)