In this step-by-step guide, we will look into the process to create an OrderCloud account and setting up the necessary artifacts.
The very first step is to create an account in the OrderCloud portal. Open portal.ordercloud.io and register yourself with the appropriate details.
Once you are in the portal you should see the dashboard as shown in the below image.
Click on the New Marketplace button to create a new marketplace.
In the Create a new marketplace dialog box, provide the appropriate name for the Marketplace name. I’m using the Pizza of your choice for the purpose of this series.
You can change the region where your marketplace will be created. I keep the default one, Australia-East. You can change it if you want to select a different region.
You should leave the optional Marketplace Identifier field empty and OrderCloud will auto-generate the value for it. If you want you can provide an appropriate value for the Marketplace Identifier value.
Click Create Marketplace button to create the new marketplace. Once the marketplace is created you should see the settings page as shown in the below image.
On the settings page, you can see basic information about your marketplace as well as you can manage contributors, user access, team access, and search tools. For the purpose of this series, we are not going into the details and moving on to creating other required settings.
Now we will create the API clients for the seller and the buyers.
Click the API Console link in the left-hand navigation to open the console.
If you are opening the console the very first time you should see the text saying ‘SELECT A CONTEXT’, in the left top corner.
Click on the red text and select the marketplace you created in the previous steps.
Click API Clients in the left-hand navigation, and click Create New API Client.
On the New API Client screen, provide Seller App in the Application Name field in the General Information section. In the Client Access Configuration section, select Allow All Sellers checkbox, and leave other settings as is.
Click Create New API Client button at the bottom of the page. Once the API client is created, you will be redirected to the API Clients page.
Create one more API Client for buyer application and provide the information as shown in the below image.
Now we need to create the admin user.
The default user you are authenticated to access the OrderCloud portal is the owner account and does not actually exist in the marketplace you created. You need a specific admin user to be used as port context user to interact with OrderCloud APIs.
Click Admin Users, under the Seller section, in the left-hand navigation. On the Admin Users screen click GET /adminusers and change to POST Create a new admin user option.
In the form presented on the page, fill the details as shown in the below image, and click Send button to submit the data.
Now to create the buyer organization, in the left-hand navigation menu select Buyers > Buyers and then in the operation options where it says GET /buyers click to select the POST Create a new buyer option.
Fill in the form fields as shown in the below image and click Send to create a new buyer organization.
You should see the following output and notice that for the DefaultCatalogID, OrderCloud has assigned the value the same as the ID of the buyer organization. In the previous screen, you should notice that we did keep the Default Catalog ID field empty and hence OrderCloud assigned an appropriate value from its end.
Next, select Buyers > Users and choose the “Create a new user” operation. Fill in the form fields as shown in the below image. Notice the new Parameters section which asks for the Buyer ID. You need to fill in the id of the buyer organization you created in the previous step.
Click Send to create the buyer user.
We have two different users, one admin, and one buyer. We will use the admin user to create out product catalogs and manage orders and the buyer user to shop product catalogs and submit orders.
Having two different users, admin and buyer we need to limit access to the APIs offered by OrderCloud by creating and assigning the security profiles. Read more about Security Profiles.
From the left-hand navigation, navigate to Authentication and Authorization > Security Profiles and select Create a new Security Profile link. You should see the following screen.
To revert from the enhance UI to the operations selector, click the lightning bolt icon on the left side of the toolbar.
Toggle to the operations selector and use the following JSON snippet to create the admin profile.
Now we have two different users and two different security profiles. All we have to do is assign the security profile to the appropriate user.
To avoid cumbersome management experiences by assigning the security roles directly to the user level, we assign the admin and buyer profiles to our seller and buyer organizations respectively.
Choose Create or update a security profile assignment while staying in the Authentication and Authorization > Security Profiles section.
To assign the Admin User Profile to the entire seller organization, copy and paste the following in the request body JSON field and click Send.
{
"SecurityProfileID": "ADMIN_PROFILE"
}
Refer to the below image to see how it looks in the console.
Similar to the admin profile, use the following JSON to assign the buyer security profile to the buyer organization.
Great! We have covered a lot in this guide. In the next article, we will learn how to set up the Next.js application and use the OrderCloud APIs to set up the authentication system for the admin portal.