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!

Creating a Postman Collection for Sitecore Send (Moosend)

When working with various REST APIs it’s nice to be able to manage your sample and test requests in a single location. In a previous post, I introduced the Sitecore CDP REST APIs and shared my Postman collection. In this post, I will show you how to create a collection for Sitecore Send (Moosend). The good news Moosend provides an API Blueprint specification available here. However, you are not able to import this document directly into Postman. In this post, I will show you how you can convert this Blueprint spec so it can be imported into postman and automatically generate a collection of requests for testing and development with Moosend.

Continue reading

Introduction to Sitecore CDP REST APIs and my Postman Collection

In this post, I will introduce the Sitecore CDP REST APIs and the postman collection I created for working with the APIs. I’m a huge fan of postman it’s an essential developer tool when it comes to working with a REST API.

Sitecore CDP does not currently provide a standard document like OpenAPI (swagger) for describing the APIs, which can be used to generate a postman collection. Therefore I’ve started a collection based on the Sitecore documentation and examples they’ve provided. The Sitecore docs are an excellent resource for developers, to help you understand the various APIs and attributes. I highly recommend checking these out as they are constantly evolving since the acquisition of Boxever.

My postman collection is available on GitHub as a json file. You can import it into Postman and use it when working with your own Sitecore CDP sandbox. I hope you find it useful, please share any feedback.

Continue reading