Sitecore OrderCloud Documentation

docs

Portal login

Accessing the API Console

From the Portal dashboard you can get to the API console by selecting a recent tab or clicking on "NEW TAB" within the widget. Once the console loads, you will notice a list of API resources on your left, along with a prompt for you to "SELECT A CONTEXT".

What is an API Console Context?

Every interaction with the OrderCloud API requires a user context. Each contributing Portal user has their own unique context that is defined by their relationship and level of access to the marketplace. The API Console also allows Portal users with impersonation access to select a more specific core user context - meaning they are able to interact with the OrderCloud API as if they were a user within the marketplace.

Since we haven't created any core users at this point, we will be using your Portal user context which should be that of an owner.

Select Your First Context

Click "SELECT A CONTEXT". This will present a list of your available marketplaces. Choose the marketplace that we created in the last article. At this point, the context selector should close and you will automatically be authenticated using the FullAccess API Role provided to you as the owner.

Explore Your Region and Environment

Directly below the context selector, you will notice an expandable panel containing information about which region your context selection is utilizing, as well as information regarding the current context [user] who is making requests via the Portal interface. If you have simply clicked on a Marketplace, you will be making requests as your personal Portal user. If you have selected a specific user from the context selector, you will notice this interface clarifies that you are making requests as the selected user.

Validate Your Context

Navigate down to Me and My Stuff > Me API resource on the lefthand navigation. Select it and you should see the toolbar at the top change to "Get the currently authenticated user". Click the "SEND" button and look at the data that comes back. It should look something like this:

{
	"Buyer": null,
	"Supplier": null,
	"Seller": {
		"ID": "xxxxxxxxxxxxxxxxxx"
	},
	"ID": "348D36CF-C5FB-45A3-A50D-04962AA26702",
	"Username": "24E98C61-3D28-45B4-8A98-9D91DB449E4C",
	"Password": null,
	"FirstName": "Default User",
	"LastName": "Default User",
	"Email": null,
	"Phone": null,
	"TermsAccepted": "2021-02-08T20:51:14.947+00:00",
	"Active": true,
	"xp": null,
	"AvailableRoles": [],
	"DateCreated": "2021-02-08T20:51:14.947+00:00",
	"PasswordLastSetDate": "2021-02-08T20:51:14.947+00:00"
}

This is what we call a "Default User" - it is essentially an admin user that will have the same level of data access as your Portal user. Don't be alarmed if AvailableRoles is empty - as the owner of the organization it is implied that you have FullAccess.

Portal User Context and Default Users

The default user you are authenticated as right now does not actually exist in the system, your marketplace is brand new and essentially empty. If you scroll up on the left-hand resources menu to click on Seller > Admin Users which opens the "Get a list of admin users" request. Click "SEND" and you will see an empty list response like this:

{
	"Meta": {
		"Page": 1,
		"PageSize": 20,
		"TotalCount": 0,
		"TotalPages": 0,
		"ItemRange": [
			1,
			0
		]
	},
	"Items": []
}

In other words, you are not actually interacting with the OrderCloud API as you would in a normal implementation. In order to remedy this, we must first create some core users and establish a definition of how they can interact with your marketplace.


Still have questions?
Ask in our Community Channel

Content Powered By
Sitecore Logo

© Copyright 2024, Sitecore OrderCloud®. All rights reserved.

Contact Us
Privacy Policy
Sitecore