Skip to content

Node Getting Started

Requirements

The kelvin SDK needs to support the following versions:

  • NodeJS: 8.0+

Installation

Install the Kelvin Node SDK library inside your project

npm install @kelvininc/node-client-sdk --save

Getting Started

Import Kelvin inside your project

const Kv = require('@kelvininc/node-client-sdk');

// or, if you are using es module
import { KelvinSDK } from '@kelvininc/node-client-sdk';
After that, it's important to initialize the SDK with the correct information to make available our API methods.

KelvinSDK.initialize({
    baseUrl: '<base-url-of-you-company>',
    authConfig: {
        clientId: '<client-id>',
        realm: '<realm>',
        url: '<authentication-url>'
    }
});

Usage

Follow some examples of services usage.

Login Process

import { AuthService } from '@kelvininc/node-client-sdk';

AuthService.login({
    username: '<username or email>',
    password: '<password>'
}).subscribe(({ accessToken, refreshToken }) => doSomething());

Get a list of Assets

import { AssetService } from '@kelvininc/node-client-sdk';

AssetService.listAsset({
    pageSize: 20
}).subscribe(assetList => doSomething(assetList));