Getting started

Requirements

The Cloud Blue Connect Javascript SDK depends on the following 3rd party packages:

Installation

The current stable release of the Connect Javascript SDK is 19.2.0.

To install the Connect Javascript SDK at the command prompt enter:

$ npm install @cloudblueconnect/connect-javascript-sdk --save

Usage

The connect-javascript-sdk allow you to consume the Connect public API directly or using specialized methods to achieve tasks related to a specific workflow.

High-level Usage

const { ConnectClient, Fulfillment } = require('@cloudblueconnect/connect-javascript-sdk');
const client = new ConnectClient('<api_endpoint>', '<api_key>');
const fulfillment = new Fulfillment(client);

const response = await fulfillment.approveRequestWithTemplate('<request_id>', '<template_id>');

Low-level Usage

You can access the API endpoints directly through the ConnectClient.

The ConnectClient groups operations by the resource they access.

Create an instance of the ConnectClient class:

const { ConnectClient } = require('@cloudblueconnect/connect-javascript-sdk');

const client = new ConnectClient('<api_endpoint>', '<api_key>');

For example to invoke the search action for the Product resource:

client.products.search()
    .then(products => { console.log(products) });

Or if you prefer the async/await syntax:

const products = await client.products.search();
console.log(products);