Using Postman with OrderCloud

The OrderCloud API Console is a pretty awesome tool and an excellent feature to have within the OrderCloud platform. However, I like to utilize Postman when developing against APIs. As I’ve previously demonstrated by utilizing Postman with Sitecore CDP & Personalize and Sitecore Send, in this post I’ll look at using Postman with the OrderCloud API.

Importing the OrderCloud API into Postman

OrderCloud provides an OpenAPI spec and is available at OrderCloud Developer Tools. You can use this definition to import into Postman and create a collection. To import follow these steps:

1. In Postman create a new Workspace -> New Workspace let’s call it OrderCloud API

2. Now copy the OrderCloud OpenApi URL documentation endpoint and click on the Link tab and enter the copied URL and click Continue.

3. Use the default setting and click Import.

4. The OrderCloud API definition is imported and a collection of APIs are created and divided into the various functional areas as described by OrderCloud API definition as described in the API Reference guide.

Using the Collection

Once the collection has been created there are a few things you’ll need to set up:

  • Register for an account on the OrderCloud Portal.
  • Create or have an existing Marketplace.
  • Create or have existing API clients: Seller Client, Buyer Client.
  • Create or have an existing Admin User account and security profile with full access.

All of these details are covered in the OrderCloud Establishing API Access guide.

Note: If you have used the Vercel Commerce template and added the OrderCloud Integration or the headstart-nextjs application then these would have been created during the setup of the integration.

Authentication and Access Tokens

OrderCloud uses OAuth 2.0 for token-based authentication. This means that each API request to OrderCloud requires a valid access token which can be acquired through a variety of OAuth workflows.

Encrypted in the token are the identity of the user as well as the roles that the user has access to. Once validated, the OrderCloud API has enough information from this token to determine which endpoints and data a user can read and/or write.

Tokens are valid for 8hrs and you can renew or create a new token. Generated tokens can then be stored in a variable and reused.

OrderCloud API Exercises

While the APIs are well documented in the Reference guide there is a great OrderCloud Postman Tutorial. These postman exercises will guide you through the steps, data and api requests involved in setting up a fictitious Coffee Shop. This is a really good starting place to learn the various APIs and data structures and how they interact with your OrderCloud data.

To import the exercises into your own local or web postman instance simply click on the simply click on the Run In Postman button located at the top of the exercises to import into with your web or desktop postman instance.

You will also want to import the variables used in the exercises and update them accordingly to your OrderCloud environment instance as you progress through the exercises.

Have Fun!