🔥💣🔥 Salesforce B2C Commerce Developer Certification Exam Practice Test Buy

Headless Development Using Commerce API

B2C Commerce: Salesforce Commerce API

Welcome to B2C Commerce: Salesforce Commerce API. In this course, you learn how to use the Salesforce Commerce API to get data from an instance. After completing this course, you'll be able to:

Get to Know Headless Commerce

Complete this Trailhead module to learn:

API Basics

Learn the fundamentals and benefits of developing with APIs by completing this Trailhead module.

Commerce API Overview

This 5 minutes video explains:

📝 Create an API Client for Use with Commerce API

To use the Commerce API, you need to be a B2C Commerce customer or partner (SI or LINK).

  1. Login to Account Manager (AM). You need to be a B2C Commerce customer or partner (SI or LINK0 to have access to AM.
  2. Make sure you have the Sandbox API User role. If not, request your AM account administrator to provide it for you.
  3. Locate the API Client tab
    1. Under Filter by Organization, make sure you select the one for which you are creating the API Client: the customer or the partner organization. It is possible that you belong to multiple organization in AM if you working for customers and they have added you to their AM organization.
    2. Click Add API Client
  1. Create the API Client following the steps in this document.
  2. Remember the password! Save it somewhere safe (LastPass or equivalent). You will need it in future activities. If you forget it, you will have to create a new API Client (nice, eh?).
  3. In the Roles section, make sure you select the specific On Demand Sandbox (ODS) that you have access to. While you are here, you should add any other ODS you want to be able to use the API on.
    • Click the highlighted icon below to search and select the realm and sandbox to enable:API Client for Commerce API
    • Select the On Demand Sandboxes (ODSs) that you want to be able to access with this API ClientSelect Sandbox to enable Commerce API
    • Click Add
  4. In the Allowed Scopes section, enter the following scopes which support future activities in this course (rather to do it now instead of coming back to AM several times to add a single scope):
    1. sfcc.shopper-products
    2. sfcc.shopper-product-search
    3. sfcc.shopper-promotions
    4. sfcc.shopper-customers.register
    5. sfcc.shopper-customers.login
    6. sfcc.shopper-baskets-orders.rw
    7. sfcc.shopper-myaccount.baskets.rw
    8. sfcc.catalogs
    9. sfcc.customerlists.rw

For production, you will need more or less scopes depending on how much your headless application needs to support.

Use the Shopper API in Postman

Import a collection and environment into Postman:

  1. If you don't have Postman installed, download and install it from official website. You can also use the Web Version, but the steps are only for the desktop version.
  2. Start Postman
  3. Download the zip file from the Commerce API Workshop.postman_collection.json gist, which contains two JSON files:
    1. Postman collection for Commerce APIs
    2. Postman environment variables for the collection
  4. Click Import on the main menu and select Commerce API Workshop.postman_collection.json: this will import a collection into Postman:Commerce API Postman Collection
  5. Click on the Manage Environment icon on the upper right corner:Postman manage environment
    • Scroll to the bottom of the dialog and select Import
    • Select the Commerce API Workshop.postman_environment.json
    • This creates a new Commerce API Workshop environment that you can view and edit by clicking the icon "eye"

Edit your environment variables to point to your ODS

Postman uses environment variables to make it easier to enter and reuse API calls in your collection. This collection attempts to use the same variables that the CCDC uses in the API documentation.

Most environment variable values are placeholders, so you must use your own clientID and sandbox to fill them.

Any other values present assume SFRA RefArch site: products, promotions, catalog, customers lists, etc.

  1. On the Commerce API Workshop environment screen (previous step), click Edit
  2. clientId and clientIdPwd: login to AM, and get the clientId and password that you setup during Create an API Client for Use with Commerce API. If you forgot the password (really?), you will have to redo that activity.
  3. Login to your ODS, navigate to Administration > Site Development > Salesforce Commerce API Settings, and populate the following from that screen:
    1. organizationId: f_ecom_<realm>_<instance>
    2. shortCode: unique to your instance
    3. tenant: use the <realm>_<instance> combination. Don't forget to use underscore: “_”.
  4. basketId, customerNo, itemId and all global variables: these are populated by collection calls, no need to enter a value
  5. The rest of the variables are initialized to SFRA values. If you are using SiteGenesis site, modify accordingly.

Download Headless Commerce Course

Content Locked. Get Full access in completing the form below
Enter your e-mail to get a free copy of Commerce API course.
Check your e-mail, you'll receive a copy in a few seconds. If not, take a look to the spam folder.
🔥💣🔥 Salesforce B2C Commerce Developer Certification Exam Practice Test Buy