A javascript sdk for NiXT data platform. This can be used in node.
Table of Contents
- Requires node.js >= 12.x
Install nixt-sdk with:
npm install nixt-sdk
Next, require the module and instantiate a nixt client by calling Nixt.init(client_id, secret_key)
setup the client with basic auth credentials client_id
and secret_key
.
import Nixt from "nixt-sdk";
Nixt.init(client_id, secret_key)
In the case you need to connect to nixt test environment you can call testbed(boolean)
:
Nixt.testbed(process?.env?.TARGET?.toUpperCase() !== "PRODUCTION")
You can connect to NiXT with private connection via GCP VCP Peering* you can call privateLink(boolean)
Note: Required setup VCP Peering
Nixt.privateLink(true | false)
You can set Level of debug log by calling Nixt.debug(debug_level)
Nixt.debug(NixtDebug.ALL)
Debug Level | Description |
---|---|
NixtDebug.NONE | No log (default) |
NixtDebug.HTTP | Only http log |
NixtDebug.ERROR | Only error log |
NixtDebug.ALL | All logs |
The following service methods are available to instantiated clients. The examples assume you have already initial a nixt client with valid credentials.
Nixt.latest( deviceIds, params )
Request:
Parameter | Description | Sample value |
---|---|---|
deviceIds | Array of deviceIds | ["deviceId"] |
params | Array of tag | ["ENETO","PACTO"] |
Response:
Parameter | Description | Sample value |
---|---|---|
deviceIds | Array of deviceIds | ["deviceId"] |
params | Array of tag | ["ENETO","PACTO"] |