This repository contains a sample Postman collection that you can leverage to place orders using the Salesforce Commerce on Core APIs.
In order to start with this collection, please follow these steps:
- Download Postman from the official website and install it
- Once installed, open Postman
- Once opened, import the collection and the environment from this repository to your Postman workspace
- Once imported, open the
Salesforce Commerce on Core
environment, and modify all the data which contain placeholders (like<YOUR-CLIENT-ID>
) with your details. Please don't modify the values with{{
and}}
, as these values are calculated values within your Postman environment.. The environment also contains sample values that you can use, or modify, as per your needs. - Once the environment is setup, open the
Salesforce Commerce on Core
collection, and start using it.
This Postman collection authenticates with the Salesforce instance by using the OAuth 2.0 Username-Password Flow for Special Scenarios. Please refer to this documentation to understand how this works. As per the documentation, you need to create a Connected App to be able to use this way of authentication.
If you are using this Postman collection against a sandbox, the url
environment variable is https://test.salesforce.com
, else it is https://login.salesforce.com
. You can also use the url of your instance directly, like https://[your-domain].my.salesforce.com
if you set up a domain in the org.
The clientId
and clientSecret
environment variables are the Consumer Key
and Consumer Secret
values from the created connected app
In order to get them, please do the following steps:
- Go to your instance
- Go to the gear on the top right, and click on
Setup
- In the left sidebar, search for
App Manager
- Open the connected app you created in the beginning of this chapter
- Click on the
copy
button to copy theConsumer Key
and use it as theclientId
environment variable - Click on the
Click to reveal
andcopy
button to copy theConsumer Secret
and use it as theclientSecret
environment variable
As this Postman collection uses the OAuth 2.0 Username-Password Flow for Special Scenarios
, it requires your username, password and security token.
Please use the username you use to authenticate against the org as the username
environment variable, and your password as the password
environment variable.
As said in the previous section, this collection uses the OAuth 2.0 Username-Password Flow for Special Scenarios
. This requires you to generate a security token, and use it as the secretToken
environment variable.
In order to generate it, please do the following steps:
- Go to your instance
- Click on your use avatar on the top right and click on
Settings
- In the left sidebar, click on
Reset My Security Token
- Click on the
Reset My Security Token
button. This will email you with the security token
- Clear Collection Variables
- Auth Salesforce API via Connected App
- Login Admin
- Login Buyer
- Query Webstore Id
- Create Payment Gateway Provider
- Create Payment Gateway
- Query Payment Gateway
- Register Inventory External Service
- Register Inventory Store Integrated Service
- Get Inventory External Service
- Register Shipment External Service
- Register Shipment Store Integrated Service
- Get Shipment External Service
- Register Tax External Service
- Register Tax Store Integrated Service
- Get Tax External Service
- Register Price External Service
- Register Price Store Integrated Service
- Get Price External Service
- Register Payment External Service
- Get Payment External Service
- Get App Context
- Get Session Context
- Get Composite Values
- base64 encode file
- Upload Content
- Retrieve Content Document by ID
- Retrieve Content Document by Title
- Import Product CSV
- Import Sample Products
- Get Products
- Get Product Details
- Get Product Pricing
- Get Multiple Products Pricing
- Get Product Details
- Query Carts by AccountId
- Query Carts by WebStoreId
- Get Active Cart
- Get Cart by ID
- Query Carts
- Delete Active Cart
- Delete Cart by ID
- Create a Cart
- Add Item to Cart
- Add Items to Cart (Batch)
- Get Cart Items
- Delete Cart Item
- Patch Cart Item (not yet supported for B2CE)
- Login Admin
- Get Webstore Id
- Login Buyer (optional, not needed for OOBO)
- Delete Active Cart
- Create a Cart
- Add Items to Cart
- Create Checkout
- Patch Delivery Address
- Create Payment Token
- Authorize Payment
- Cart to Order
- Create Checkout
- Patch Delivery Address
- Get Checkout Status
- Cancel Checkout
- Patch Delivery Method
- Create Payment Token
- Authorize Payment
- Cart to Order
- Login Admin
- π Query Site Id, URL Prefix, Set Site URL
- π Set Collection Variables
- Get Session Context
- Create a Guest Cart
- Get Cart by ID
- Add Item to Cart
- Create Checkout
- Patch Contact Info
- Patch Delivery Address
- Create Payment Token
- Authorize Payment
- Cart to Order
- Get Searchable Fields
- Update Searchable Fields
- Get Search Filters
- Update Search Filters
- Get Search Indexes
- Create Search Index
- Get Search Index
- Get Search Index Logs
- Get Product Search Settings
- Update Product Search Settings
- Get Sorting Rules
- π Get Custom Field Id
- Update Sorting Rules
You can leverage this collection in different ways:
βοΈ By using the Postman Runner, which will run a full folder directly, by executing each endpoint one-by-one, sequentially, and report the unit tests results for each executed endpoint.