allBlogsList

Sitecore OrderCloud Seeding Done Fast

Introduction

By now, you are aware of Sitecore’s SaaS based eCommerce offering - OrderCloud. Sitecore OrderCloud is an API-first headless eCommerce Platform. Being SaaS based, organizations can purely focus on utilizing it without the headache of maintenance. OrderCloud maintains a very detailed documentation that has all the details you may want. Today's blog will focus on setting up your very own first OrderCloud sandbox marketplace (organization). It will be the first of the blog series covering the Sitecore OrderCloud platform.

Seeding Accelerator

To get started, you need to sign up for OrderCloud’s free-to-use portal.

Before creating products, pricing, and other eCommerce data, a few steps are required to set things up.  This process is quite involved and tiring especially if you are setting it up repetitively for multiple clients.

To take the most advantage of OrderCloud's features, you'll need to create the following for every setup:

  • Marketplace
  • Admin User
    • Buyer
  • Buyer User
  • Security Profiles and Assignments
  • Supplier
    • Supplier User
    • Supplier Security Profile
  • Catalog and Assignment
  • API Clients
  • Integration Event

You can find the terminologies explained here. Now, imagine going through each and every step for 10 different clients! To make things easier, I have created an accelerator that can take care of these steps quickly and easily.

Download or clone this GitHub repo to start.

Setup

Setting up the cloned solution is pretty easy. As each marketplace can have a different naming convention, all the static data comes from a single file (appsettings.json). All you'll have to do is update it and then you're good to go. Here's a snippet from the file:

"SettingsConstants": {
      //SELLER ADMIN USER
      "SellerClientName": "Admin Client",
      "SellerUserId": "SeededAdminSellerUser",
      "SellerUsername": "default_admin_user",
      "SellerUserEmail": "sellerseed@example.com",
      "SellerUserFirstName": "Admin",
      "SellerUserLastName": "User",

      //BUYER
      "BuyerClientName": "Buyer Client",
      "BuyerId": "DefaultBuyer",
      "BuyerName": "Default Buyer",
      "BuyerUserId": "SeededBuyerUser",
      "BuyerUsername": "default_buyer_user",
      "BuyerUserEmail": "buyerseed@example.com",
      "BuyerUserFirstName": "Buyer",
      "BuyerUserLastName": "Seed",

Postman

It is not required to use Postman only. You can use any client that you are comfortable with to make API calls. In my case, I will use Postman.

In the repo, you will find two files under “/Files/Postman” that house the collection and environment for seeding.

Import these to your postman client:

OCSeeding1

These collections should already be populated with the correct endpoints and payload. Verify these before making the call.

Here is the sample payload for the “seed” command:

{
    "PortalUsername":"",
    "PortalPassword":"",
    "MiddlewareBaseUrl":"https://mymiddlewaresite.net/",
    "OrderCloudSettings":{
        "Environment":"sandbox",
        "WebhookHashKey":"oc2023"
    },
    "MarketplaceID":"",
    "MarketplaceName":"OC Test Marketplace",
    "EnableAnonymousShopping": 

Update “PortalUsername” and “PortalPassword” with your OrderCloud account credentials.

Note: It is important that WebhookHashKey in the above payload and appsettings.json file match.

If you have already created a marketplace in the portal, please update “MarketplaceID” and “MarketplaceName” with the existing marketplace that you want to seed.

Response

Go ahead and make the call. If everything was succeeded, you should see a response similar to the following that lists your organization name, ID, and API client details.

OCSeeding2

And that is all! Your OrderCloud Marketplace is now seeded. In future blog series, we will talk about catalogs, products, and other data setups.

Learn more about Gift Cards in Sitecore OrderCloud in our next blog.

References