This blog will walkthrough step by step to setup OrderCloud Headstart Solution on your development machine.

You may want to first see Part 1 with Azurite or through Azure resources

Headstart project and instructions are here

In this blog we are setting the Sitecore Ordercloud Headstart middleware

Step 1- Create a Sitecore OrderCloud Marketplace

See this blog to setup the OrderCloud Marketplace

Create a new maketplace e.g.- OrderCloudHeadstart in Us-West region

IMP– At the time this blog was written looks like only Us-West region is supported when a seed request is sent. This may change in future but connect to OrderCloud team is you want this to be in region other than Us-West

Note the newly created Marketplace ID – in my case it is – OrderCloudHeadstart

If you havent provided the Marketplace ID whilst creating the OrederCloud will create once for you. You can find the same in the Marketplace.

Navigate to API Console and Get the Admin User, as you see there are no Admin users. You may also check other endpoints.

Step 2 – Setup Middleware

Clone headstart repository – https://github.com/ordercloud-api/headstart.git

Open Headstart.sln in src/Middleware. I am using Visual Studio 2019.

Open Headstart.API project proerties

Create a new Debug Profile for Headstart.Api project. Set this as Start project.

Run the Headstart.Api project and should listen to localhost 5000 and 5001 port

Step 3- Prepare Seed Request

Open postman and create a new Post request to – https://localhost:5001/seed

Use the below request body –

{
  "PortalUsername": "username@company.com",
  "PortalPassword": "XXXXXXXXXXXXXXXXXX",
  "InitialAdminUsername": "demoadminuser",
  "InitialAdminPassword": "XXXXXXXXXXXXXX",
  "MiddlewareBaseUrl": "not-needed-for-local-build",
  "MarketplaceID": "OrderCloudHeadstart",
  "OrderCloudSeedSettings": {
    "Environment": "sandbox",
    "WebhookHashKey": "OCHASHKEY"
  },
  "StorageAccountSettings": {
    "ConnectionString": "place-your-storage-account-connectionstring"
  },
 "Region": "US-West"
}

PortalUsername – enter the portal username you used to create a marketplace

PortalPassword – enter the portal password you used to create a marketplace

InitialAdminUsername – this request will create a admin user. Enter the admin username you wish to create

InitialAdminPassword – enter the admin password you want to set

MiddlewareBaseUrl – this is not required for local build

MarketplaceID – Enter the Marketplace ID you created in Step 1

OrderCloudSettings.Environment – enter this to be sandbox in this case. For the other environments you might want to user different values for Staging and Production

OrderCloudSettings. WebhookHashKey – Set the webhook haskey to secure your webhook request.

StorageAccountSettings – Creatge a storage account in Azure and enter the connectionstring here.

Postman request should look like this –

Step 4 – Populate Ordercloud Markeplace with the seed request

Ensure the Headstart Api is running and listening to 5001 port as mentioned in Step 2

Send the seed request

You can see the same in application that is listening to 5001 port the request was sent to-

If you have set the request correctly you should receive the success response-

IMP – Note the below response and the request that was sent specifically Admin Username and Password as this will be required later when configuring the UI application

{
    "Comments": "Success! Your environment is now seeded. The following clientIDs & secrets should be used to finalize the configuration of your application. The initial admin username and password can be used to sign into your admin application",
    "MarketplaceName": "OrderCloud Headstart Marketplace",
    "MarketplaceID": "OrderCloudHeadStart",
    "OrderCloudEnvironment": "Sandbox",
    "ApiClients": {
        "Middleware": {
            "ClientID": "XXXXXXXXXXXXXXXXXXXXXXXX",
            "ClientSecret": "XXXXXXXXXXXXXXXXXXXXXX"
        },
        "Seller": {
            "ClientID": "XXXXXXXXXXXXXXXXXXXXX"
        },
        "Buyer": {
            "ClientID": "XXXXXXXXXXXXXXXXXXXXXXXXXX"
        }
    }
}

Comments – seed response comments

MarketplaceName – gets the Marketplace name that was configured in Step 1

MarketplaceID – UniqueId that was sent as part of request and the data seeded in this Marketplace

OrderCloudEnvironment – Environment where the request was sent

ApiClients.Middleware.ClientID – Note down Middleware ClientID

ApiClients.Middleware. ClientSecret – Note down Middleware ClientSecret

ApiClients.Seller.ClientID – Note down the Seller ClientID

ApiClients.Buyer.ClientID – Note down the Buyer ClientID

Step 5- Check the Marketplace for the data been puplated

In Step 1- we saw there was not admin user created. After the seed request you can see the Admin User is created with the name mentioned in request.

Admin User

InitialAdminUser with the username provided in request is created

Also the MiddlewareIntegrationsUser is created

Buyer User

Buyer User is created-

Api Clients

Api clients created and the same was sent as response. This is used so each client have a different Id’s that helps any application to connect.

Thats it in this blog. See Part-2 to Setup the Sitecore OrderCloud Headstart- Coming soon

Hope you are enjoying setting your Ordercloud Headstart project.