Set up the Headless Commerce API as a connected app.
- Create a private key and certificate. Follow the instructions in Create a Private Key and Self-Signed Digital Certificate in the Salesforce DX Developer Guide.
- In Salesforce, from Setup, in the Quick Find box, enter OAuth Custom Scopes, and then select OAuth Custom Scopes.
- Click New Custom Scope.
- For each of the Omnichannel Inventory scopes, enter the Name and Description, and then save
it.
Name Description sfcc_inventory_impex_graphs Export location graphs. sfcc_inventory_impex_inventory_rw Import inventory records. sfcc_inventory_impex_inventory Export inventory records. sfcc_inventory_availability Get inventory availability data. sfcc_inventory_availability_rw Update inventory availability data. sfcc_inventory_reservations Get inventory reservation information. sfcc_inventory_reservations_rw Update inventory reservations. - In the Quick Find box, enter App Manager, and then select App Manager.
- Click New Connected App.
- Enter a Connected App Name and a Contact Email.
- To display the API settings, select Enable OAuth Settings.
- Select Enable for Device Flow. Keep the auto-populated Callback URL value.
- Select Use Digital Signatures. Click Choose File, then browse to and select the server.crt certificate file that you created in the first step.
- Select and add the desired OAuth Scopes.
- Select Require Secret for Web Server Flow.
- Select Require Secret for Refresh Token Flow.
- Save the app.
- Click Continue and wait for the app to appear. It can take up to 10 minutes.
- Click Manage.
- Click Edit Policies.
- Set the OAuth Policies and Session Policies as desired.
- Save the policies.
- Scroll to the OAuth Custom Scopes section, and then click Manage OAuth Custom Scopes.
- Select all of the inventory scopes that you added, and then save the scopes.
- In the Quick Find menu, click App Manager.
- From your app’s dropdown menu, select View.
- Scroll to the Initial Access Token for Dynamic Client Registration section, and then click Generate.
- Create a JWT and request an access token. Follow the instructions in OAuth 2.0 JWT Bearer Flow for Server-to-Server Integration in Salesforce Help.
- In the Quick Find box, enter Omnichannel Inventory, and then select Omnichannel Inventory.
- Record the Tenant Group ID and the Base URL for Inventory API Calls.
Note When making calls to the headless Commerce API, use the tenant group ID as the organization ID.