Before You Begin
You must have the following software installed on your local machine as well as Kibo access details.- Node.js: a platform for creating scalable network applications that includes the npm package manager.
- A Dev Center Account with a provisioned sandbox.
- An Application Key (also called the Client ID) and Secret.
- A Kibo tenant.
Get Started
This tutorial demonstrates installing the TypeScript SDK, authenticating with Kibo credentials, and making an API call. The example is of a console application that retrieves the number of customer accounts for a Kibo eCommerce site. Use these concepts to build a fully-fledged application of your own.Create an Application
First, create an application in the Dev Center with the appropriate behaviors:- Log in to Dev Center.
- Create a new application.
- Add the
Customer Readbehavior to the application. This step is necessary to give your application the necessary permissions to read customer accounts. If you design additional functionality for your application, such as updating an order, then add the appropriate behaviors to avoid a permissions error. - Install the application to a sandbox.
- Enable the application in Admin. If you decide to add additional behaviors to your application after this step, you must reinstall the application to your sandbox and re-enable the application in Admin to apply the new behaviors.
- Locate your Application Key, Shared Secret, Tenant ID, and Site ID. Obtain the Application Key and Shared Secret from the application details page in the Dev Center. Obtain the Tenant ID and Site ID by viewing your site and looking at the URL, which has the format
t{_TenantID}_‑s{_SiteID}_.sandbox.mozu.com.- You can also use the Get Tenant API call to return the Site ID and a Master Catalog ID if needed. The Master Catalog ID is not required for the particular API call used in this tutorial.
Install the TypeScript SDK
Follow the below steps to install the TypeScript SDK:- Create a new directory on your local machine.
- Open a command prompt in the new directory.
- Run
npm initto create apackage.jsonfile in your directory. When prompted, provide a name for your npm package and accept the default values for the remaining prompts, making sure that the entry point for your application isindex.js. When you build a fully-fledged application, you can customize these responses instead of accepting the default values like you do for this tutorial. - Run
npm install @kibocommerce/rest-sdkto install the TypeScript SDK. - Run
npm install typescript ts-node @kibocommerce/rest-sdk.
Create an API Client
You should now create an API client and decide whether to use hardcoded configuration values or environment variables.-
If you want to use environment variables, create a
.envfile at the root of your project and enter your credentials and any other required values such as Catalog IDs. -
Import the Kibo Configuration and Customer Account API packages, as well as
.envconfigurations if you are using environment variables. -
Create a Configuration object using either hardcoded values or environment variables.
-
Hardcoded Values:
-
Environment Variables:
-
Hardcoded Values:
- Create a Customer Account API client using your configurations to retrieve customer accounts.
Other API Clients
API clients are separated by domain, similar to the organization in the Kibo API documentation. Find and import these from theclients folder with the following command:
'@kibocommerce/rest-sdk/clients/Inventory' and import with the following code:

