Scaling an IoT deployment? Join our webinar on May 28th where we dive into real-world scaling pain points and how to overcome them.

Blues Developers
What’s New
Resources
Blog
Technical articles for developers
Newsletter
The monthly Blues developer newsletter
Terminal
Connect to a Notecard in your browser
Developer Certification
Get certified on wireless connectivity with Blues
Webinars
Listing of Blues technical webinars
Blues.comNotehub.io
Shop
Docs
Button IconHelp
Notehub StatusVisit our Forum
Button IconSign In
Sign In
Sign In
Docs Home
What’s New
Resources
Blog
Technical articles for developers
Newsletter
The monthly Blues developer newsletter
Terminal
Connect to a Notecard in your browser
Developer Certification
Get certified on wireless connectivity with Blues
Webinars
Listing of Blues technical webinars
Blues.comNotehub.io
Shop
Docs
Tools & SDKs
Notecard CLI
Firmware Libraries
Libraries Overview
Arduino Library
Python Library
Zephyr Library
Notehub SDKs
SDKs Overview
Notehub JS Library
InstallationUsageAuthorization APIBilling Account APIDevice APIEvent APIMonitor APIProject APIRoute API
Notehub Py Library
homechevron_rightDocschevron_rightTools & SDKschevron_rightNotehub Sdkschevron_rightNotehub JS Library Installation and Usage

Notehub JS Library Overview

The Notehub JS library is an npm library built specifically for use in JavaScript-based applications.

It is designed to get you connected to the Notehub API quickly, and allow you to access all the API routes relevant to interacting with Notehub in a JavaScript-friendly way.

Installation

You can install the Notehub JS library in any JavaScript-based application using the steps below.

In the root of the project where you wish to use Notehub JS, run the following command from the terminal.

Using npm:

$
npm install @blues-inc/notehub-js

Using yarn:

$
yarn add @blues-inc/notehub-js

Once the package is installed, you can import the library using import or require:

Using import:

import * as NotehubJs from "@blues-inc/notehub-js";

const defaultClient = NotehubJs.ApiClient.instance;
note

Using import to access the library in a TypeScript project currently will cause an error because there is not yet a @types file for it. To make the error disappear, declare the module in a file with a .d.ts extension.

>
declare module '@blues-inc/notehub-js';

Using require:

const NotehubJs = require("@blues-inc/notehub-js");

const defaultClient = NotehubJs.ApiClient.instance;

Usage

Below is documentation and code examples for all the Notehub API methods.

Notehub JS Authorization

There is one main type of authorization the Notehub API uses for nearly all requests:

API Key

The api_key referenced in the following code examples is an API key (also known locally as an X-Session-Token).

The API key is an authentication token that can be obtained in two ways:

Manually cURL the token from the command line

Using the command line, a user can request a new token from the Notehub API /auth/login endpoint using a Notehub username and password in the body of the request.

Use NotehubJs.AuthorizationApi login

Using the Notehub JS library, a user can programmatically call the Notehub API's /auth/login endpoint via the NotehubJs.AuthorizationApi's login() method while supplying a Notehub username and password in the loginRequest object.

Usage Limits

Be aware that the Notehub API has usage limits, and after you exceed the request threshold you may receive 429 response codes from your requests. For more information see Notehub API Usage Limits.

note

All URIs are relative to https://api.notefile.net

Async/Await Syntax

If you'd like to use async/await syntax in any of the documented code examples below, add the async keyword to the outer function/mthod with the following implementation.

// add the async keyword to your outer function/method

// sample code above stays the same

try {
  data = await apiInstance.getRoutes(projectUID);
  console.log(
    "API called successfully. Returned data: " + JSON.stringify(data)
  );
} catch (error) {
  console.error(error);
}

Real World Use Cases of Notehub JS Library

As this library gains adoptions, we'll continue to provide new links to repos where this library being used in real world projects.

Indoor Floor Level Tracker Project

If you'd like to see examples of this library being used in real-world applications, check out this indoor floor-level tracker project in the Blues App Accelerator repo on GitHub.

The files that deserve special attention are:

  • ServiceLocatorServer.ts - this file makes the variety of services composing the backend logic of the application discoverable to each other. For DRY-er code, the Notehub JS library's instances were created and passed to the various services that would require them to fetch and update data via the Notehub API. An instance of the Notehub JS client is created via const notehubJsClient = NotehubJs.ApiClient.instance, and passed to the getDataProvider() and getAttributeStore() services that will need to interact with the Notehub API to perform their duties.
  • NotehubDataProvider.ts - this file is responsible for fetching data from the Notehub API for the application to display. It calls the project API's getProjectFleetDevices() and getProjectEvents() methods, and the fleet API's getFleetEnvironmentVariables() method as well.
  • NotehubAttributeStore.ts - this file sends updates to the Notehub API from the application like updated device name or updated environment variables. It calls two of the environment variable API's methods: putDeviceEnvironmentVariables() and putFleetEnvironmentVariables().

Authorization API

MethodHTTP Request
loginPOST /auth/login

This is the only Notehub API call that does not require some form of authentication token, and it is used to generate the token which can then be used for almost all subsequent API requests.

login

Gets a session token from the API from a username and password.

Example

import * as NotehubJs from "@blues-inc/notehub-js";

let apiInstance = new NotehubJs.AuthorizationApi();
let loginRequest = {"username":"name@example.com","password":"test-password"}; // LoginRequest | 
apiInstance.login(loginRequest).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
loginRequestLoginRequest

LoginRequest Properties

NameTypeDescriptionNotes
usernameString
passwordString

Authorization

No authorization required

Billing Account API

MethodHTTP Request
getBillingAccountsGET /v1/billing-accounts

getBillingAccounts

Get Billing Accounts accessible by the api_key

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.BillingAccountApi();
apiInstance.getBillingAccounts().then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

This endpoint does not need any parameter.

Return type

Successful 200 getBillingAccounts response

Authorization

api_key

Device API

MethodHTTP Request
deleteDeviceEnvironmentVariableDELETE /v1/projects/{projectUID}/devices/{deviceUID}/environment_variables/{key}
deleteProjectDeviceDELETE /v1/projects/{projectUID}/devices/{deviceUID}
disableDevicePOST /v1/projects/{projectUID}/devices/{deviceUID}/disable
disableDeviceConnectivityAssurancePOST /v1/projects/{projectUID}/devices/{deviceUID}/disable-connectivity-assurance
enableDevicePOST /v1/projects/{projectUID}/devices/{deviceUID}/enable
enableDeviceConnectivityAssurancePOST /v1/projects/{projectUID}/devices/{deviceUID}/enable-connectivity-assurance
getDeviceGET /v1/projects/{projectUID}/devices/{deviceUID}
getDeviceEnvironmentVariablesGET /v1/projects/{projectUID}/devices/{deviceUID}/environment_variables
getDeviceEnvironmentVariablesByPinGET /v1/products/{productUID}/devices/{deviceUID}/environment_variables_with_pin
getDeviceHealthLogGET /v1/projects/{projectUID}/devices/{deviceUID}/health-log
getDeviceLatestGET /v1/projects/{projectUID}/devices/{deviceUID}/latest
getDevicePublicKeyGET /v1/projects/{projectUID}/devices/{deviceUID}/public-key
getDeviceSessionsGET /v1/projects/{projectUID}/devices/{deviceUID}/sessions
getProjectDevicePublicKeysGET /v1/projects/{projectUID}/devices/public-keys
getProjectDevicesGET /v1/projects/{projectUID}/devices
getProjectFleetDevicesGET /v1/projects/{projectUID}/fleets/{fleetUID}/devices
handleNoteAddPOST /v1/projects/{projectUID}/devices/{deviceUID}/notes/{notefileID}
handleNoteChangesGET /v1/projects/{projectUID}/devices/{deviceUID}/notes/{notefileID}/changes
handleNoteCreateAddPOST /v1/projects/{projectUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}
handleNoteDeleteDELETE /v1/projects/{projectUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}
handleNoteGetGET /v1/projects/{projectUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}
handleNoteSignalPOST /v1/projects/{projectUID}/devices/{deviceUID}/signal
handleNoteUpdatePUT /v1/projects/{projectUID}/devices/{deviceUID}/notes/{notefileID}/{noteID}
handleNotefileChangesGET /v1/projects/{projectUID}/devices/{deviceUID}/files/changes
handleNotefileChangesPendingGET /v1/projects/{projectUID}/devices/{deviceUID}/files/changes/pending
handleNotefileDeleteDELETE /v1/projects/{projectUID}/devices/{deviceUID}/files
postProvisionProjectDevicePOST /v1/projects/{projectUID}/devices/{deviceUID}/provision
putDeviceEnvironmentVariablesPUT /v1/projects/{projectUID}/devices/{deviceUID}/environment_variables
putDeviceEnvironmentVariablesByPinPUT /v1/products/{productUID}/devices/{deviceUID}/environment_variables_with_pin

deleteDeviceEnvironmentVariable

Delete environment variable of a device

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let key = "key_example"; // String | The environment variable key to delete.
apiInstance.deleteDeviceEnvironmentVariable(projectUID, deviceUID, key).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
keyStringThe environment variable key to delete.

Return type

Successful 200 deleteDeviceEnvironmentVariable response

Authorization

api_key

deleteProjectDevice

Delete Device

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let purge = false; // Boolean |
apiInstance.deleteProjectDevice(projectUID, deviceUID, purge).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
purgeBoolean[default to false]

Return type

Successful 200 deleteProjectDevice response

Authorization

api_key

disableDevice

Disable Device

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.disableDevice(projectUID, deviceUID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString

Return type

null (empty response body)

Authorization

api_key

disableDeviceConnectivityAssurance

Disable Connectivity Assurance

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.disableDeviceConnectivityAssurance(projectUID, deviceUID).then(() => {
  console.log("API called successfully.");
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString

Return type

null (empty response body)

Authorization

api_key

enableDevice

Enable Device

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.enableDevice(projectUID, deviceUID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString

Return type

null (empty response body)

Authorization

api_key

enableDeviceConnectivityAssurance

Enable Connectivity Assurance

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.enableDeviceConnectivityAssurance(projectUID, deviceUID).then(() => {
  console.log("API called successfully.");
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString

Return type

null (empty response body)

Authorization

api_key

getDevice

Get Device

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.getDevice(projectUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString

Return type

Successful 200 getDevice response

Authorization

api_key

getDeviceEnvironmentVariables

Get environment variables of a device

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.getDeviceEnvironmentVariables(projectUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString

Return type

Successful 200 getDeviceEnvironmentVariables response

Authorization

api_key

getDeviceEnvironmentVariablesByPin

Get environment variables of a device with device pin authorization

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: pin
let pin = defaultClient.authentications["pin"];
pin.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let productUID = "com.blues.airnote"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.getDeviceEnvironmentVariablesByPin(productUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
productUIDString
deviceUIDString

Authorization

pin

getDeviceHealthLog

Get Device Health Log

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.getDeviceHealthLog(projectUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString

Return type

Successful 200 getDeviceHealthLog response

Authorization

api_key

getDeviceLatest

Get Device Latest Events

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.getDeviceLatest(projectUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString

Return type

Successful 200 getDeviceLatest response

Authorization

api_key

getDevicePublicKey

Get Device Public Key

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.getDevicePublicKey(projectUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString

Authorization

api_key

getDeviceSessions

Get Device Sessions

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let opts = {
  pageSize: 50, // Number |
  pageNum: 1, // Number |
};
apiInstance.getDeviceSessions(projectUID, deviceUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
pageSizeNumber[optional] [default to 50]
pageNumNumber[optional] [default to 1]

Return type

Successful 200 getDeviceSessions response

Authorization

api_key

getProjectDevicePublicKeys

Get Device Public Keys of a Project

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
  pageSize: 50, // Number |
  pageNum: 1, // Number |
};
apiInstance.getProjectDevicePublicKeys(projectUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
pageSizeNumber[optional] [default to 50]
pageNumNumber[optional] [default to 1]

Authorization

api_key

getProjectDevices

Get Devices of a Project

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
  pageSize: 50, // Number |
  pageNum: 1, // Number |
  deviceUID: ["null"], // [String] | A Device UID.
  tag: ["null"], // [String] | Tag filter
  serialNumber: ["null"], // [String] | Serial number filter
  fleetUID: ["null"], // [String] |
  notecardFirmware: ["null"], // [String] | Firmware version filter
  location: ["null"], // [String] | Location filter
  hostFirmware: ["null"], // [String] | Host firmware filter
  productUID: ["null"], // [String] |
  sku: ["null"] // [String] | SKU filter
};
apiInstance.getProjectDevices(projectUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
pageSizeNumber[optional] [default to 50]
pageNumNumber[optional] [default to 1]
deviceUID[String]A Device UID.[optional]
tag[String]Tag filter[optional]
serialNumber[String]Serial number filter[optional]
fleetUID[String][optional]
notecardFirmware[String]Firmware version filter[optional]
location[String]Location filter[optional]
hostFirmware[String]Host firmware filter[optional]
productUID[String][optional]
sku[String]SKU filter[optional]

Return type

Successful 200 getProjectDevices response

Authorization

api_key

getProjectFleetDevices

Get Devices of a Fleet within a Project

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let opts = {
  pageSize: 50, // Number |
  pageNum: 1, // Number |
  deviceUID: ["null"], // [String] | A Device UID.
  tag: ["null"], // [String] | Tag filter
  serialNumber: ["null"], // [String] | Serial number filter
  notecardFirmware: ["null"], // [String] | Firmware version filter
  location: ["null"], // [String] | Location filter
  hostFirmware: ["null"], // [String] | Host firmware filter
  productUID: ["null"], // [String] |
  sku: ["null"] // [String] | SKU filter
};
apiInstance.getProjectFleetDevices(projectUID, fleetUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
fleetUIDString
pageSizeNumber[optional] [default to 50]
pageNumNumber[optional] [default to 1]
deviceUID[String]A Device UID.[optional]
tag[String]Tag filter[optional]
serialNumber[String]Serial number filter[optional]
notecardFirmware[String]Firmware version filter[optional]
location[String]Location filter[optional]
hostFirmware[String]Host firmware filter[optional]
productUID[String][optional]
sku[String]SKU filter[optional]

Return type

Successful 200 getProjectFleetDevices response

Authorization

api_key

handleNoteAdd

Adds a Note to a Notefile, creating the Notefile if it doesn't yet exist.

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let note = new NotehubJs.Note(); // Note | Body or payload of note to be added to the device
apiInstance.handleNoteAdd(projectUID, deviceUID, notefileID, note).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
notefileIDString
noteNoteBody or payload of note to be added to the device

Note Properties

NameTypeDescriptionNotes
bodyObject[optional] Example: {body: {temp: 72.22 } }
payloadStringBase64-encoded binary payload. A note must have either a body or a payload, and can have both.[optional]

Return type

Successful 200 handleNoteAdd response

Authorization

api_key

handleNoteChanges

Incrementally retrieve changes within a specific Notefile.

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let opts = {
  tracker: "tracker_example", // String | The change tracker ID.
  max: 56, // Number | The maximum number of Notes to return in the request.
  start: true, // Boolean | true to reset the tracker to the beginning.
  stop: true, // Boolean | true to delete the tracker.
  deleted: true, // Boolean | true to return deleted notes.
  _delete: true, // Boolean | true to delete the notes returned by the request.
};
apiInstance.handleNoteChanges(projectUID, deviceUID, notefileID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
notefileIDString
trackerStringThe change tracker ID.[optional]
maxNumberThe maximum number of Notes to return in the request.[optional]
startBooleantrue to reset the tracker to the beginning.[optional]
stopBooleantrue to delete the tracker.[optional]
deletedBooleantrue to return deleted notes.[optional]
_deleteBooleantrue to delete the notes returned by the request.[optional]

Return type

Successful 200 handleNoteChanges response

Authorization

api_key

handleNoteCreateAdd

Adds a Note to a Notefile, creating the Notefile if it doesn't yet exist.

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let noteID = "noteID_example"; // String |
let note = new NotehubJs.Note(); // Note | Body or payload of note to be added to the device
apiInstance
  .handleNoteCreateAdd(projectUID, deviceUID, notefileID, noteID, note)
  .then(
    () => {
      console.log("API called successfully.");
    },
    (error) => {
      console.error(error);
    }
  );

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
notefileIDString
noteIDString
noteNoteBody or payload of note to be added to the device

Note Properties

NameTypeDescriptionNotes
bodyObject[optional] Example: {body: {temp: 72.22 } }
payloadStringBase64-encoded binary payload. A note must have either a body or a payload, and can have both.[optional]

Return type

Successful 200 handleNoteCreateAdd response

Authorization

api_key

handleNoteDelete

Delete a note from a DB notefile

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let noteID = "noteID_example"; // String |
apiInstance.handleNoteDelete(projectUID, deviceUID, notefileID, noteID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
notefileIDString
noteIDString

Return type

null (empty response body)

Authorization

api_key

handleNoteGet

Get a note from a DB notefile

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let noteID = "noteID_example"; // String |
let opts = {
  _delete: true, // Boolean | Whether to delete the note from the DB notefile
  deleted: true, // Boolean | Whether to return deleted notes
};
apiInstance.handleNoteGet(projectUID, deviceUID, notefileID, noteID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
notefileIDString
noteIDString
_deleteBooleanWhether to delete the note from the DB notefile[optional]
deletedBooleanWhether to return deleted notes[optional]

Return type

Successful 200 handleNoteGet response

Authorization

api_key

handleNoteSignal

Send a signal from Notehub to a Notecard.

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let body = new NotehubJs.Body(); // Body | Body or payload of signal to be sent to the device
apiInstance.handleNoteSignal(projectUID, deviceUID, body).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
bodyBodyBody or payload of signal to be sent to the device

Body Properties

NameTypeDescriptionNotes
bodyObject[optional] Example code: {key1: "value1" }

Return type

Successful 200 handleNoteSignal Response

Authorization

api_key

handleNoteUpdate

Update a note in a DB notefile

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let noteID = "noteID_example"; // String |
let note = new NotehubJs.Note(); // Note | Body or payload of note to be added to the device
apiInstance
  .handleNoteUpdate(projectUID, deviceUID, notefileID, noteID, note)
  .then(
    () => {
      console.log("API called successfully.");
    },
    (error) => {
      console.error(error);
    }
  );

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
notefileIDString
noteIDString
noteNoteBody or payload of note to be added to the device

Note Properties

NameTypeDescriptionNotes
bodyObject[optional] Example code: { body: {interval: 60 } }
payloadStringBase64-encoded binary payload. A note must have either a body or a payload, and can have both.[optional]

Return type

null (empty response body)

Authorization

api_key

handleNotefileChanges

Used to perform queries on a single or multiple files to determine if new Notes are available to read

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let opts = {
  tracker: "tracker_example", // String | The change tracker ID.
  files: ["null"], // [String] | One or more files to obtain change information from.
};
apiInstance.handleNotefileChanges(projectUID, deviceUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
trackerStringThe change tracker ID.[optional]
files[String]One or more files to obtain change information from.[optional]

Return type

Successful 200 handleNotefileChanges response

Authorization

api_key

handleNotefileChangesPending

Returns info about file changes that are pending upload to Notehub or download to the Notecard.

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.handleNotefileChangesPending(projectUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString

Return type

Successful 200 handleNotefileChangesPending response

Authorization

api_key

handleNotefileDelete

Deletes Notefiles and the Notes they contain.

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let handleNotefileDeleteRequest = new NotehubJs.HandleNotefileDeleteRequest(); // HandleNotefileDeleteRequest |
apiInstance
  .handleNotefileDelete(projectUID, deviceUID, handleNotefileDeleteRequest)
  .then(
    () => {
      console.log("API called successfully.");
    },
    (error) => {
      console.error(error);
    }
  );

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
handleNotefileDeleteRequestHandleNotefileDeleteRequest

HandleNotefileDeleteRequest Properties

NameTypeDescriptionNotes
files[String]One or more files to obtain change information from.[optional] Example code: {["file1", "file2", "file3"]}

Return type

null (empty response body)

Authorization

api_key

postProvisionProjectDevice

Provision Device for a Project

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let postProvisionProjectDeviceRequest = new NotehubJs.PostProvisionProjectDeviceRequest(); // PostProvisionProjectDeviceRequest | Provision a device to a specific ProductUID, device serial number, or fleetUIDs
apiInstance.postProvisionProjectDevice(projectUID, deviceUID, postProvisionProjectDeviceRequest).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
postProvisionProjectDeviceRequestPostProvisionProjectDeviceRequestProvision a device to a specific ProductUID

PostProvisionProjectDeviceRequest Properties

NameTypeDescriptionNotes
productUidStringThe ProductUID that the device should use.Example code: {productUid: "product_uid", deviceSn: "deviceUID_example", fleetUids: ["fleet_uid_1, fleet_uid_2"]}
deviceSnStringThe serial number to assign to the device.[optional]
fleetUids[String]The fleetUIDs to provision the device to.[optional]

Return type

null (empty response body)

Authorization

api_key

putDeviceEnvironmentVariables

Put environment variables of a device

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let envVars = {key1: "value1", key2: "value2"} // {String: String} |
let environmentVariables = new NotehubJs.EnvironmentVariables(envVars); // EnvironmentVariables | Environment variables to be added to the device
apiInstance
  .putDeviceEnvironmentVariables(projectUID, deviceUID, environmentVariables)
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
environmentVariablesEnvironmentVariablesEnvironment variables to be added to the device

EnvironmentVariables Properties

NameTypeDescriptionNotes
environmentVariables{String: String}Example code: {key1: "value1", key2: "value2"}

Return type

Successful 200 putDeviceEnvironmentVariables response

Authorization

api_key

putDeviceEnvironmentVariablesByPin

Put environment variables of a device with device pin authorization

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: pin
let pin = defaultClient.authentications["pin"];
pin.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.DeviceApi();
let productUID = "com.blues.airnote"; // String |
let deviceUID = "deviceUID_example"; // String |
let envVars = {key1: "value1", key2: "value2"} // {String: String} |
let environmentVariables = new NotehubJs.EnvironmentVariables(envVars); // EnvironmentVariables | Environment variables to be added to the device
apiInstance
  .putDeviceEnvironmentVariablesByPin(
    productUID,
    deviceUID,
    environmentVariables
  )
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );

Parameters

NameTypeDescriptionNotes
producttUIDString
deviceUIDString
environmentVariablesEnvironmentVariablesEnvironment variables to be added to the device

EnvironmentVariables Properties

NameTypeDescriptionNotes
environmentVariables{String: String}Example code: {key1: "value1", key2: "value2"}

Authorization

pin

Event API

MethodHTTP Request
getFleetEventsGET /v1/projects/{projectUID}/fleets/{fleetUID}/events
getFleetEventsByCursorGET /v1/projects/{projectUID}/fleets/{fleetUID}/events-cursor
getProjectEventsGET /v1/projects/{projectUID}/events
getProjectEventsByCursorGET /v1/projects/{projectUID}/events-cursor
getRouteLogsByEventGET /v1/projects/{projectUID}/events/{eventUID}/route-logs

getFleetEvents

Get Events of a Fleet

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.EventApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let opts = {
  pageSize: 50, // Number |
  pageNum: 1, // Number |
  deviceUID: ["null"], // [String] | A Device UID.
  sortBy: "captured", // String |
  sortOrder: "asc", // String |
  startDate: 1628631763, // Number | Unix timestamp
  endDate: 1657894210, // Number | Unix timestamp
  dateType: "uploaded", // String | Which date to filter on, either 'captured' or 'uploaded'.  This will apply to the startDate and endDate parameters
  systemFilesOnly: true, // Boolean |
  files: "_health.qo, data.qo", // String |
  format: "json", // String | Response format (JSON or CSV)
  serialNumber: ["null"], // [String] | Filter by Serial Number
  sessionUID: ["null"], // [String] | Filter by Session UID
  eventUID: ["null"], // [String] | Filter by Event UID
  selectFields: "selectFields_example", // String | Comma-separated list of fields to select from JSON payload (e.g., \"field1,field2.subfield,field3\"), this will reflect the columns in the CSV output.
};
apiInstance.getFleetEvents(projectUID, fleetUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
fleetUIDString
fleetUIDString
pageSizeNumber[optional] [default to 50]
pageNumNumber[optional] [default to 1]
deviceUID[String]A Device UID.[optional]
sortByString[optional] [default to "captured"]
sortOrderString[optional] [default to "asc"]
startDateNumberUnix timestamp[optional]
endDateNumberUnix timestamp[optional]
dateTypeStringWhich date to filter on, either "captured" or "uploaded". This will apply to the startDate and endDate parameters[optional] [default to "captured"]
systemFilesOnlyBoolean[optional]
filesString[optional]
formatStringResponse format ("json" or "csv")[optional] [default to "json"]
serialNumber[String]Filter by Serial Number[optional]
sessionUID[String]Filter by Session UID[optional]
eventUID[String]Filter by Event UID[optional]
selectFieldsStringComma-separated list of fields to include in the response (e.g., "field1,field2.subfield,field3").[optional]

Return type

Successful 200 getFleetEvents response

Authorization

api_key

getFleetEventsByCursor

Get Events of a Fleet by cursor

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.EventApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let opts = {
  limit: 50, // Number |
  cursor: "cursor_example", // String | A cursor, which can be obtained from the `next_cursor` value from a previous call to this endpoint. The results set returned will include this event as its first result if the given identifier is actually the UID of an event. If this event UID is not found, the parameter is ignored and the results set is the same as if the parameter was not included.
  sortOrder: "asc", // String |
  systemFilesOnly: true, // Boolean |
  files: "_health.qo, data.qo", // String |
  deviceUID: ["null"], // [String] | A Device UID.
  startDate: 1628631763, // Number | Unix timestamp
  endDate: 1657894210 // Number | Unix timestamp
};
apiInstance.getFleetEventsByCursor(projectUID, fleetUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
fleetUIDString
limitNumber[optional] [default to 50]
cursorStringA cursor, which can be obtained from the next_cursor value from a previous call to this endpoint. The results set returned will include this event as its first result if the given identifier is actually the UID of an event. If this event UID is not found, the parameter is ignored and the results set is the same as if the parameter was not included.[optional]
sortOrderString[optional] [default to "asc"]
systemFilesOnlyBoolean[optional]
filesString[optional]
deviceUID[String]A Device UID.[optional]
startDateNumberUnix timestamp[optional]
endDateNumberUnix timestamp[optional]

Return type

Successful 200 getFleetEventsByCursor response

Authorization

api_key

getProjectEvents

Get Events of a Project

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.EventApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
  pageSize: 50, // Number |
  pageNum: 1, // Number |
  deviceUID: ["null"], // [String] | A Device UID.
  sortBy: "captured", // String |
  sortOrder: "asc", // String |
  startDate: 1628631763, // Number | Unix timestamp
  endDate: 1657894210, // Number | Unix timestamp
  dateType: "uploaded", // String | Which date to filter on, either 'captured' or 'uploaded'.  This will apply to the startDate and endDate parameters
  systemFilesOnly: true, // Boolean |
  files: "_health.qo, data.qo", // String |
  format: "json", // String | Response format (JSON or CSV)
  serialNumber: ["null"], // [String] | Filter by Serial Number
  fleetUID: ["null"], // [String] | Filter by Fleet UID
  sessionUID: ["null"], // [String] | Filter by Session UID
  eventUID: ["null"], // [String] | Filter by Event UID
  selectFields: "selectFields_example", // String | Comma-separated list of fields to select from JSON payload (e.g., \"field1,field2.subfield,field3\"), this will reflect the columns in the CSV output.
};
apiInstance.getProjectEvents(projectUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
pageSizeNumber[optional] [default to 50]
pageNumNumber[optional] [default to 1]
deviceUID[String[A Device UID.[optional]
sortByString[optional] [default to "captured"]
sortOrderString[optional] [default to "asc"]
startDateNumberUnix timestamp[optional]
endDateNumberUnix timestamp[optional]
dateTypeStringWhich date to filter on, either "captured" or "uploaded". This will apply to the startDate and endDate parameters[optional] [default to "captured"]
systemFilesOnlyBoolean[optional]
filesString[optional]
systemFilesOnlyBoolean[optional]
filesString[optional]
formatStringResponse format ("json" or "csv")[optional] [default to "json"]
serialNumber[String]Filter by Serial Number[optional]
fleetUID[String]Filter by Fleet UID[optional]
sessionUID[String]Filter by Session UID[optional]
eventUID[String]Filter by Event UID[optional]
selectFieldsStringComma-separated list of fields to include in the response (e.g., "field1,field2.subfield,field3").[optional]

Return type

Successful 200 getProjectEvents response

Authorization

api_key

getProjectEventsByCursor

Get Events of a Project by cursor

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.EventApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
  limit: 50, // Number |
  cursor: "cursor_example", // String | A cursor, which can be obtained from the `next_cursor` value from a previous call to this endpoint. The results set returned will include this event as its first result if the given identifier is actually the UID of an event. If this event UID is not found, the parameter is ignored and the results set is the same as if the parameter was not included.
  sortOrder: "asc", // String |
  systemFilesOnly: true, // Boolean |
  files: "_health.qo, data.qo", // String |
  fleetUID: "fleetUID_example", // String | A Fleet UID.
  deviceUID: ["null"] // [String] | A Device UID.
};
apiInstance.getProjectEventsByCursor(projectUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
limitNumber[optional] [default to 50]
cursorStringA cursor, which can be obtained from the next_cursor value from a previous call to this endpoint. The results set returned will include this event as its first result if the given identifier is actually the UID of an event. If this event UID is not found, the parameter is ignored and the results set is the same as if the parameter was not included.[optional]
sortOrderString[optional] [default to "asc"]
systemFilesOnlyBoolean[optional]
filesString[optional]
fleetUIDString[optional]
deviceUID[String]A Device UID.[optional]

Return type

Successful 200 getProjectEventsByCursor response

Authorization

api_key

getRouteLogsByEvent

Get Route Logs by Event UID

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.EventApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let eventUID = "4506f411-dea6-44a0-9743-1130f57d7747"; // String |
apiInstance.getRouteLogsByEvent(projectUID, eventUID).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
eventUIDString

Return type

Successful 200 getRouteLogsByEvent response

Authorization

api_key

Monitor API

MethodHTTP Request
createMonitorPOST /v1/projects/{projectUID}/monitors
deleteMonitorDELETE /v1/projects/{projectUID}/monitors/{monitorUID}
getMonitorGET /v1/projects/{projectUID}/monitors/{monitorUID}
getMonitorsGET /v1/projects/{projectUID}/monitors
updateMonitorPUT /v1/projects/{projectUID}/monitors/{monitorUID}

createMonitor

Create a new Monitor

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.MonitorApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let monitorProps = {
  name: "Monitor Name", // String |
  description: "Monitor Description", // String |
  notefileFilter: ["data.qo"], // [String] |
  sourceSelector: "temperature", // String |
  conditionType: "greater_than", // String |
  threshold: 100, // Number |
  alertRoutes: [ 
    {
      email: "example@blues.com"
    }
  ] // [MonitorAlertRoutes] |
}
let monitor = new NotehubJs.CreateMonitor(monitorProps); // Monitor | Body or payload of monitor to be created
apiInstance.createMonitor(projectUID, monitor).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
createMonitorCreateMonitorBody or payload of monitor to be created

CreateMonitor Properties

NameTypeDescriptionNotes
uidString[optional]
nameString
descriptionString
sourceTypeStringThe type of source to monitor. Currently only "event" is supported.[optional]
disabledBooleanIf true, the monitor will not be evaluated.[optional]
alertBooleanIf true, the monitor is in alert state.[optional]
notefileFilter[String]
fleetFilter[String][optional]
sourceSelectorStringA valid JSONata expression that selects the value to monitor from the source. It should return a single, numeric value.[optional]
conditionTypeStringA comparison operation to apply to the value selected by the sourceSelector ["greater_than", "greater_than_or_equal_to", "less_than", "less_than_or_equal_to", "equal_to", "not_equal_to"][optional]
thresholdNumberThe type of condition to apply to the value selected by the sourceSelector[optional]
alertRoutes[MonitorAlertRoutes]An array of entities to notify when an alert is triggered.
lastRoutedAtStringThe last time the monitor was evaluated and routed.[optional]
silencedBooleanIf true, alerts will be created, but no notifications will be sent.[optional]
routingCooldownPeriodStringThe time period to wait before routing another event after the monitor has been triggered. It follows the format of a number followed by a time unit.[optional] Example code: "5hr30m10s" for 5 hours, 30 minutes, 10 seconds.
aggregateFunctionStringAggregate function to apply to the selected values before applying the condition. ["none", "sum", "average", "max", "min"][optional]
aggregateWindowStringThe time window to aggregate the selected values. It follows the format of a number followed by a time unit.[optional] Example code: "5hr30m10s" for 5 hours, 30 minutes, 10 seconds
perDeviceBooleanOnly relevant when using an aggregate_function. If true, the monitor will be evaluated per device, rather than across the set of selected devices. If true then if a single device matches the specified criteria, an alert will be created, otherwise the aggregate function will be applied across all devices.[optional]

MonitorAlertRoutes Properties

NameTypeDescriptionNotes
urlStringThe URL of the Slack webhook.[optional] Example code: { url: "hooks.slack.com/...", messageType: "text|blocks", text: "Message text" }
messageTypeStringtext or blocks[optional]
textStringThe text of the message, or the blocks definition[optional]
tokenStringThe bearer token for the Slack app.[optional] Example code: { token: "your_token", channel: "CXXXXXXXX", messageType: "text|blocks", text: "Message text" }
channelStringThe channel to send the message to.[optional]
emailStringEmail Address[optional] Example code: { email: "your.email@blues.com" }

Return type

Successful 200 createMonitor response

Authorization

api_key

deleteMonitor

Delete Monitor

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.MonitorApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let monitorUID = "monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad"; // String |
apiInstance.deleteMonitor(projectUID, monitorUID).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
monitorUIDString

Return type

Successful 200 deleteMonitor response

Authorization

api_key

getMonitor

Get Monitor

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.MonitorApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let monitorUID = "monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad"; // String |
apiInstance.getMonitor(projectUID, monitorUID).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
monitorUIDString

Return type

Successful 200 getMonitor response

Authorization

api_key

getMonitors

Get list of defined Monitors

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.MonitorApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getMonitors(projectUID).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString

Return type

Successful 200 getMonitors response

Authorization

api_key

updateMonitor

Update Monitor

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.MonitorApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let monitorUID = "monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad"; // String |
let monitorProps = {
  name: "Monitor Name", // String |
  description: "Monitor Description", // String |
  notefileFilter: ["data.qo"], // [String] |
  sourceSelector: "temperature", // String |
  conditionType: "greater_than", // String |
  threshold: 100, // Number |
  alertRoutes: [ 
    {
      email: "example@blues.com"
    }
  ] // [MonitorAlertRoutes] |
}
let monitor = new NotehubJs.Monitor(monitorProps); // Monitor | Body or payload of monitor to be created
apiInstance.updateMonitor(projectUID, monitorUID, monitor).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
monitorUIDString
monitorMonitorBody or payload of monitor to be created

Monitor Properties

NameTypeDescriptionNotes
uidString[optional]
nameString[optional]
descriptionString[optional]
sourceTypeStringThe type of source to monitor. Currently only "event" is supported.[optional]
disabledBooleanIf true, the monitor will not be evaluated.[optional]
alertBooleanIf true, the monitor is in alert state.[optional]
notefileFilter[String][optional]
fleetFilter[String][optional]
sourceSelectorStringA valid JSONata expression that selects the value to monitor from the source.It should return a single, numeric value.
conditionTypeStringA comparison operation to apply to the value selected by the sourceSelector ["greater_than", "greater_than_or_equal_to", "less_than", "less_than_or_equal_to", "equal_to", "not_equal_to"][optional]
thresholdNumberThe type of condition to apply to the value selected by the sourceSelector[optional]
alertRoutes[MonitorAlertRoutesInner]An array of entities to notify when an alert is triggered.[optional]
lastRoutedAtStringThe last time the monitor was evaluated and routed.[optional]
silencedBooleanIf true, alerts will be created, but no notifications will be sent.[optional]
routingCooldownPeriodStringThe time period to wait before routing another event after the monitor has been triggered. It follows the format of a number followed by a time unit.[optional]
aggregateFunctionStringAggregate function to apply to the selected values before applying the condition. ["none", "sum", "average", "max", "min"][optional]
aggregateWindowStringThe time window to aggregate the selected values. It follows the format of a number followed by a time unit[optional]
perDeviceBooleanOnly relevant when using an aggregate_function. If true, the monitor will be evaluated per device, rather than across the set of selected devices. If true then if a single device matches the specified criteria, and alert will be created, otherwise the aggregate function will be applied across all devices.[optional]

MonitorAlertRoutes Properties

NameTypeDescriptionNotes
urlStringThe URL of the Slack webhook.[optional] Example code: { url: "hooks.slack.com/...", messageType: "text|blocks", text: "Message text" }
messageTypeStringtext or blocks[optional]
textStringThe text of the message, or the blocks definition[optional]
tokenStringThe bearer token for the Slack app.[optional] Example code: { token: "your_token", channel: "CXXXXXXXX", messageType: "text|blocks", text: "Message text" }
channelStringThe channel to send the message to.[optional]
emailStringEmail Address[optional] Example code: { email: "your.email@blues.com" }

Return type

Successful 200 updateMonitor response

Authorization

api_key

Project API

MethodHTTP Request
cloneProjectPOST /v1/projects/{projectUID}/clone
createFleetPOST /v1/projects/{projectUID}/fleets
createProductPOST /v1/projects/{projectUID}/products
createProjectPOST /v1/projects
deleteDeviceFleetsDELETE /v1/projects/{projectUID}/devices/{deviceUID}/fleets
deleteFleetDELETE /v1/projects/{projectUID}/fleets/{fleetUID}
deleteFleetEnvironmentVariableDELETE /v1/projects/{projectUID}/fleets/{fleetUID}/environment_variables/{key}
deleteProjectDELETE /v1/projects/{projectUID}
deleteProjectEnvironmentVariableDELETE /v1/projects/{projectUID}/environment_variables/\{key\}
dfuActionPOST /v1/projects/{projectUID}/dfu/{firmwareType}/{action}
disableGlobalTransformationPOST /v1/projects/{projectUID}/global-transformation/disable
enableGlobalTransformationPOST /v1/projects/{projectUID}/global-transformation/enable
getDeviceDfuHistoryGET /v1/projects/{projectUID}/devices/{deviceUID}/dfu/{firmwareType}/history
getDeviceDfuStatusGET /v1/projects/{projectUID}/devices/{deviceUID}/dfu/{firmwareType}/status
getDeviceFleetsGET /v1/projects/{projectUID}/devices/{deviceUID}/fleets
getDevicesDfuHistoryGET /v1/projects/{projectUID}/dfu/{firmwareType}/history
getDevicesDfuStatusGET /v1/projects/{projectUID}/dfu/{firmwareType}/status
getFirmwareInfoGET /v1/projects/{projectUID}/firmware
getFleetGET /v1/projects/{projectUID}/fleets/{fleetUID}
getFleetEnvironmentVariablesGET /v1/projects/{projectUID}/fleets/{fleetUID}/environment_variables
getProjectGET /v1/projects/{projectUID}
getProjectByProductGET /v1/products/{productUID}/project
getProjectEnvironmentVariablesGET /v1/projects/{projectUID}/environment_variables
getProjectFleetsGET /v1/projects/{projectUID}/fleets
getProjectMembersGET /v1/projects/{projectUID}/members
getProjectProductsGET /v1/projects/{projectUID}/products
getProjectsGET /v1/projects
putDeviceFleetsPUT /v1/projects/{projectUID}/devices/{deviceUID}/fleets
putFleetEnvironmentVariablesPUT /v1/projects/{projectUID}/fleets/{fleetUID}/environment_variables
putProjectEnvironmentVariablesPUT /v1/projects/{projectUID}/environment_variables
setGlobalTransformationPOST /v1/projects/{projectUID}/global-transformation
updateFleetPUT /v1/projects/{projectUID}/fleets/{fleetUID}

cloneProject

Clone a Project

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String | The project UID to be cloned.
let cloneProjectProps = {
  label: "My Cloned Project", // String |
  billingAccountUid: "billing-account-uid", // String |
  disableCloneRoutes: false, // Boolean |
  disableCloneFleets: true // Boolean |
}
let cloneProjectRequest = new NotehubJs.CloneProjectRequest(cloneProjectProps); // CloneProjectRequest | Project to be cloned
apiInstance.cloneProject(projectUID, cloneProjectRequest).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDStringThe project UID to be cloned.
cloneProjectRequestCloneProjectRequestProject to be cloned

CloneProjectRequest Properties

NameTypeDescriptionNotes
labelStringThe label for the project.Example code: {label: "My Cloned Project", billingAccountUid: "billing-account-uid", disableCloneRoutes: false, disableCloneFleets: true}
billingAccountUidStringThe billing account UID for the project. The caller of the API must be able to create projects within the billing account, otherwise an error will be returned.
disableCloneRoutesBooleanWhether to disallow the cloning of the routes from the parent project. Default is false if not specified.[optional]
disableCloneFleetsBooleanWhether to disallow the cloning of the fleets from the parent project. Default is false if not specified.[optional]

Return type

Successful 200 cloneProject response

Authorization

api_key

createFleet

Create Fleet

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let createFleetRequest = new NotehubJs.CreateFleetRequest(fleetLabel); // CreateFleetRequest | Fleet to be added
apiInstance.createFleet(projectUID, createFleetRequest).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
createFleetRequestCreateFleetRequestFleet to be added

CreateFleetRequest Properties

NameTypeDescriptionNotes
labelStringThe label for the Fleet.[optional] Example code: "My New Fleet"
smartRuleStringJSONata expression that will be evaluated to determine device membership into this fleet, if the expression evaluates to a 1, the device will be included, if it evaluates to -1 it will be removed, and if it evaluates to 0 or errors it will be left unchanged.[optional]

Return type

Successful 200 createFleet response

Authorization

api_key

createProduct

Create Product within a Project

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let createProductProps = {
  productUid: "product_uid", // String |
  label: "Product 1", // String |
  autoProvisionFleets: ["fleet_uid_1", "fleet_uid_2"], // [String] |
  disableDevicesByDefault: true // Boolean |
}
let createProductRequest = new NotehubJs.CreateProductRequest(createProductProps); // CreateProductRequest | Product to be created
apiInstance.createProduct(projectUID, createProductRequest).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
createProductRequestCreateProductRequestProduct to be created

CreateProductRequest Properties

NameTypeDescriptionNotes
productUidStringThe requested uid for the Product. Will be prefixed with the user's reversed email.Example code: {productUid: "product_uid", label: "Product 1", autoProvisionFleets: ["fleet_uid_1", "fleet_uid_2"], disableDevicesByDefault: true }
labelStringThe label for the Product.
autoProvisionFleets[String][optional]
disableDevicesByDefaultBooleanIf true, devices provisioned to this product will be automatically disabled by default.[optional]

Return type

Successful 200 createProduct response

Authorization

api_key

createProject

Create a Project

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let createProjectProps = {
  label: "My New Project", // String |
  billingAccountUid: "billing-account-uid" // String |
}
let createProjectRequest = new NotehubJs.CreateProjectRequest(createProjectProps); // CreateProjectRequest | Project to be created
apiInstance.createProject(createProjectRequest).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
createProjectRequestCreateProjectRequestProject to be created

CreateProjectRequest Properties

NameTypeDescriptionNotes
labelStringThe label for the project.Example code: {label: "My New Project", billingAccountUid: "billing-account-uid"}
billingAccountUidStringThe billing account UID for the project. The caller of the API must be able to create projects within the billing account, otherwise an error will be returned.

Return type

Successful 200 createProject response

Authorization

api_key

deleteDeviceFleets

Remove Device from Fleets

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let deleteDeviceFleetUids = ["fleetUID1", "fleetUID2"] // [String]
let deleteDeviceFleetsRequest = new NotehubJs.DeleteDeviceFleetsRequest(deleteDeviceFleetUids); // DeleteDeviceFleetsRequest | The fleets to remove from the device. Note that the endpoint takes an array of fleetUIDs, to facilitate multi-fleet devices. Multi-fleet is not yet enabled on all SaaS plans - unless it is supported by the SaaS plan of the project, passing more than a single fleetUID in the array is an error.
apiInstance
  .deleteDeviceFleets(projectUID, deviceUID, deleteDeviceFleetsRequest)
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
deleteDeviceFleetsRequestDeleteDeviceFleetsRequestThe fleets to remove from the device. Note that the endpoint takes an array of fleetUIDs, to facilitate multi-fleet devices. Multi-fleet is not yet enabled on all SaaS plans - unless it is supported by the SaaS plan of the project, passing more than a single fleetUID in the array is an error.

DeleteDeviceFleetsRequest Properties

NameTypeDescriptionNotes
fleetUids[String]The fleetUIDs to remove from the device.Code example: ["fleetUID1", "fleetUID2"]

Return type

Successful 200 deleteDeviceFleets response

Authorization

api_key

deleteFleet

Delete Fleet

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
apiInstance.deleteFleet(projectUID, fleetUID).then(
  () => {
    console.log("API called successfully.");
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
fleetUIDString

Return type

null (empty response body)

Authorization

api_key

deleteFleetEnvironmentVariable

Delete environment variables of a fleet

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let key = "key_example"; // String | The environment variable key to delete.
apiInstance.deleteFleetEnvironmentVariable(projectUID, fleetUID, key).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
fleetUIDString
keyStringThe environment variable key to delete.

Return type

null (empty response body)

Authorization

api_key

deleteProject

Delete a Project by ProjectUID

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.deleteProject(projectUID).then(() => {
  console.log("API called successfully.");
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString

Return type

null (empty response body)

Authorization

api_key

deleteProjectEnvironmentVariable

Delete an environment variable of a project by key

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let key = "key_example"; // String | The environment variable key to delete.
apiInstance.deleteProjectEnvironmentVariable(projectUID, key).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
keyStringThe environment variable key to delete.

Return type

Successful 200 deleteProjectEnvironmentVariable response

Authorization

api_key

dfuAction

Update/cancel host or notecard firmware updates

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String |
let action = "action_example"; // String |
let opts = {
  deviceUID: ["null"], // [String] | A Device UID.
  tag: ["null"], // [String] | Tag filter
  serialNumber: ["null"], // [String] | Serial number filter
  fleetUID: "fleetUID_example", // String |
  notecardFirmware: ["null"], // [String] | Firmware version filter
  location: ["null"], // [String] | Location filter
  hostFirmware: ["null"], // [String] | Host firmware filter
  productUID: ["null"], // [String] |
  sku: ["null"], // [String] | SKU filter
  dfuActionRequest: new NotehubJs.DfuActionRequest() // DfuActionRequest | Which firmware in the case of an update action
};
apiInstance.dfuAction(projectUID, firmwareType, action, opts).then(() => {
  console.log("API called successfully.");
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
firmwareTypeString
actionString
deviceUID[String]A Device UID.[optional]
tag[String]Tag filter[optional]
serialNumber[String]Serial number filter[optional]
fleetUIDString[optional]
notecardFirmware[String]Firmware version filter[optional]
location[String]Location filter[optional]
hostFirmware[String]Host firmware filter[optional]
productUID[String][optional]
sku[String]SKU filter[optional]
dfuActionRequestDfuActionRequestWhich firmware in the case of an update action[optional]

DfuActionRequest Properties

NameTypeDescriptionNotes
filenameStringThe name of the firmware file[optional]

Return type

null (empty response body)

Authorization

api_key

disableGlobalTransformation

Disable the project-level event JSONata transformation

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.disableGlobalTransformation(projectUID).then(() => {
  console.log("API called successfully.");
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString

Return type

null (empty response body)

Authorization

api_key

enableGlobalTransformation

Enable the project-level event JSONata transformation

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.enableGlobalTransformation(projectUID).then(() => {
  console.log("API called successfully.");
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString

Return type

null (empty response body)

Authorization

api_key

getDeviceDfuHistory

Get device DFU history for host or Notecard firmware

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let firmwareType = "firmwareType_example"; // String |
apiInstance.getDeviceDfuHistory(projectUID, deviceUID, firmwareType).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
firmwareTypeString

Return type

Successful 200 getDeviceDfuHistory response

Authorization

api_key

getDeviceDfuStatus

Get device DFU history for host or Notecard firmware

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let firmwareType = "firmwareType_example"; // String |
apiInstance.getDeviceDfuStatus(projectUID, deviceUID, firmwareType).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
firmwareTypeString

Return type

Successful 200 getDeviceDfuStatus response

Authorization

api_key

getDeviceFleets

Get Device Fleets

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.getDeviceFleets(projectUID, deviceUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString

Return type

Successful 200 getDeviceFleets response

Authorization

api_key

getDevicesDfuHistory

Get host or Notecard DFU history for all devices that match the filter criteria

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = "NotehubJs.ApiClient.instance";
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String |
let opts = {
  pageSize: 50, // Number |
  pageNum: 1, // Number |
  sortBy: "captured", // String |
  sortOrder: "asc", // String |
  deviceUID: ["null"], // [String] | A Device UID.
  tag: ["null"], // [String] | Tag filter
  serialNumber: ["null"], // [String] | Serial number filter
  fleetUID: "fleetUID_example", // String |
  notecardFirmware: ["null"], // [String] | Firmware version filter
  location: ["null"], // [String] | Location filter
  hostFirmware: ["null"], // [String] | Host firmware filter
  productUID: ["null"], // [String] |
  sku: ["null"] // [String] | SKU filter
};
apiInstance.getDevicesDfuHistory(projectUID, firmwareType, opts).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
firmwareTypeString
pageSizeNumber[optional] [default to 50]
pageNumNumber[optional] [default to 1]
sortByString[optional] [default to "captured"]
sortOrderString[optional] [default to "asc"]
deviceUID[String]A Device UID.[optional]
tag[String]Tag filter[optional]
serialNumber[String]Serial number filter[optional]
fleetUIDString[optional]
notecardFirmware[String]Firmware version filter[optional]
location[String]Location filter[optional]
hostFirmware[String]Host firmware filter[optional]
productUID[String][optional]
sku[String]SKU filter[optional]

Return type

Successful 200 getDevicesDfuHistory response

Authorization

api_key

getDevicesDfuStatus

Get host or Notecard DFU history for all devices that match the filter criteria

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String |
let opts = {
  pageSize: 50, // Number |
  pageNum: 1, // Number |
  sortBy: "captured", // String |
  sortOrder: "asc", // String |
  deviceUID: ["null"], // [String] | A Device UID.
  tag: ["null"], // [String] | Tag filter
  serialNumber: ["null"], // [String] | Serial number filter
  fleetUID: "fleetUID_example", // String |
  notecardFirmware: ["null"], // [String] | Firmware version filter
  location: ["null"], // [String] | Location filter
  hostFirmware: ["null"], // [String] | Host firmware filter
  productUID: ["null"], // [String] |
  sku: ["null"] // [String] | SKU filter
};
apiInstance.getDevicesDfuStatus(projectUID, firmwareType, opts).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
firmwareTypeString
pageSizeNumber[optional] [default to 50]
pageNumNumber[optional] [default to 1]
sortByString[optional] [default to "captured"]
sortOrderString[optional] [default to "asc"]
deviceUID[String]A Device UID.[optional]
tag[String]Tag filter[optional]
serialNumber[String]Serial number filter[optional]
fleetUIDString[optional]
notecardFirmware[String]Firmware version filter[optional]
location[String]Location filter[optional]
hostFirmware[String]Host firmware filter[optional]
productUID[String][optional]
sku[String]SKU filter[optional]

Return type

Successful 200 getDevicesDfuStatus response

Authorization

api_key

getFirmwareInfo

Get Available Firmware Information

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
  product: "product_example", // String |
  firmwareType: "firmwareType_example", // String |
  version: "version_example", // String |
  target: "target_example", // String |
  filename: "notecard-7.2.2.16518$20240410043100.bin", // String |
  md5: "md5_example", // String |
  unpublished: true // Boolean |
};
apiInstance.getFirmwareInfo(projectUID, opts).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
productString[optional]
firmwareTypeString[optional]
versionString[optional]
targetString[optional]
filenameString[optional]
md5String[optional]
unpublishedBoolean[optional]

Authorization

api_key

getFleet

Get Fleet

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
apiInstance.getFleet(projectUID, fleetUID).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
fleetUIDString

Return type

Successful 200 getFleet response

Authorization

api_key

getFleetEnvironmentVariables

Get environment variables of a fleet

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
apiInstance.getFleetEnvironmentVariables(projectUID, fleetUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
fleetUIDString

Return type

Successful 200 getFleetEnvironmentVariables response

Authorization

api_key

getProject

Get a Project by ProjectUID

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProject(projectUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString

Return type

Successful 200 getProject response

Authorization

api_key

getProjectByProduct

Get a Project by ProductUID

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let productUID = "com.blues.airnote;" // String |
apiInstance.getProjectByProduct(productUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
productUIDString

Return type

Successful 200 getProjectByProduct response

Authorization

api_key

getProjectEnvironmentVariables

Get environment variables of a project

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectEnvironmentVariables(projectUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString

Return type

Successful 200 getProjectEnvironmentVariables response

Authorization

api_key

getProjectFleets

Get Project Fleets

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectFleets(projectUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString

Return type

Successful 200 getProjectFleets response

Authorization

api_key

getProjectMembers

Get Project Members

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectMembers(projectUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString

Return type

Successful 200 getProjectMembers response

Authorization

api_key

getProjectProducts

Get Products within a Project

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectProducts(projectUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString

Return type

Successful 200 getProjectProducts response

Authorization

api_key

getProjects

Get Projects accessible by the api_key

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
apiInstance.getProjects().then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

This endpoint does not need any parameter.

Return type

Successful 200 getProjects response

Authorization

api_key

putDeviceFleets

Add Device to Fleets

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let putDeviceFleetUids = ["fleetUID1", "fleetUID2"] // [String]
let putDeviceFleetsRequest = new NotehubJs.PutDeviceFleetsRequest(putDeviceFleetUids); // PutDeviceFleetsRequest | The fleets to add to the device. Note that the endpoint takes an array of fleetUIDs, to facilitate multi-fleet devices. Multi-fleet is not yet enabled on all SaaS plans - unless it is supported by the SaaS plan of the project, passing more than a single fleetUID in the array is an error.
apiInstance.putDeviceFleets(projectUID, deviceUID, putDeviceFleetsRequest).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
deviceUIDString
putDeviceFleetsRequestPutDeviceFleetsRequestThe fleets to add to the device. Note that the endpoint takes an array of fleetUIDs, to facilitate multi-fleet devices. Multi-fleet is not yet enabled on all SaaS plans - unless it is supported by the SaaS plan of the project, passing more than a single fleetUID in the array is an error.

PutDeviceFleetRequest Properties

NameTypeDescriptionNotes
fleetUids[String]The fleetUIDs to add to the device.Code example: ["fleetUID1", "fleetUID2"]

Return type

Successful 200 putDeviceFleets response

Authorization

api_key

putFleetEnvironmentVariables

Put environment variables of a fleet

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let envVars = {key1: "value1", key2: "value2"} // {String: String}
let environmentVariables = new NotehubJs.EnvironmentVariables(envVars); // EnvironmentVariables | Environment variables to be added to the fleet
apiInstance
  .putFleetEnvironmentVariables(projectUID, fleetUID, environmentVariables)
  .then(
    (data) => {
      console.log(
        "API called successfully. Returned data: " + JSON.stringify(data)
      );
    },
    (error) => {
      console.error(error);
    }
  );

Parameters

NameTypeDescriptionNotes
projectUIDString
fleetUIDString
environmentVariablesEnvironmentVariablesEnvironment variables to be added to the fleet

EnvironmentVariables Properties

NameTypeDescriptionNotes
environmentVariables{String: String}Example code: {key1: "value1", key2: "value2"}

Return type

Successful 200 putFleetEnvironmentVariables response

Authorization

api_key

putProjectEnvironmentVariables

Put environment variables of a project

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let envVars = {key1: "value1", key2: "value2"} // {String: String}
let opts = {
  environmentVariables: new NotehubJs.EnvironmentVariables(envVars), // EnvironmentVariables |
};
apiInstance.putProjectEnvironmentVariables(projectUID, opts).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
environmentVariablesEnvironmentVariables[optional]

EnvironmentVariables Properties

NameTypeDescriptionNotes
environmentVariables{String: String}Example code: {key1: "value1", key2: "value2"}

Return type

Successful 200 putProjectEnvironmentVariables response

Authorization

api_key

setGlobalTransformation

Set the project-level event JSONata transformation

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let body = {key: null}; // Object | JSONata expression which will be applied to each event before it is persisted and routed
apiInstance.setGlobalTransformation(projectUID, body).then(() => {
  console.log("API called successfully.");
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
bodyObjectJSONata expression which will be applied to each event before it is persisted and routed

Return type

null (empty response body)

Authorization

api_key

updateFleet

Update Fleet

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |

let updateFleetRequest = {
  label: "Fleet Label",
  addDevices: ["device_id_1", "device_id_2"],
  removeDevices: ["device_id_3", "device_id_4"]
} // UpdateFleetRequest | Fleet details to update

apiInstance.updateFleet(projectUID, fleetUID, updateFleetRequest).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
fleetUIDString
updateFleetRequestUpdateFleetRequestFleet details to update

UpdateFleetRequest Properties

NameTypeDescriptionNotes
labelStringThe label for the Fleet.Code example: { label: "Fleet Label", addDevices: ["device_id_1", "device_id_2"], removeDevices: ["device_id_3", "device_id_4"] }
addDevices[String]List of DeviceUIDs to add to fleet[optional]
removeDevices[String]List of DeviceUIDs to remove from fleet[optional]
smartRuleStringJSONata expression that will be evaluated to determine device membership into this fleet, if the expression evaluates to a 1, the device will be included, if it evaluates to -1 it will be removed, and if it evaluates to 0 or errors it will be left unchanged.[optional]

Return type

Successful 200 updateFleet response

Authorization

api_key

Route API

MethodHTTP Request
createRoutePOST /v1/projects/{projectUID}/routes
deleteRouteDELETE /v1/projects/{projectUID}/routes/{routeUID}
getRouteGET /v1/projects/{projectUID}/routes/{routeUID}
getRouteLogsByRouteGET /v1/projects/{projectUID}/routes/{routeUID}/route-logs
getRoutesGET /v1/projects/{projectUID}/routes
updateRoutePUT /v1/projects/{projectUID}/routes/{routeUID}

createRoute

Create Notehub Route within a Project.

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let notehubRoute = {
  label: "Route Label",
  type: "http",
  http: {
    fleets: ["fleet:1042ddc5-3b2c-4cec-b1fb-d3040538094d"],
    throttle_ms: 100,
    url: "http://route.url",
  },
}; // NotehubRoute | Route to be Created
apiInstance.createRoute(projectUID, notehubRoute).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
notehubRouteNotehubRouteRoute to be Created

NotehubRoute Properties

NameTypeDescriptionNotes
uidStringRoute UID[optional]
labelStringRoute Label[optional]
routeTypeStringType of route.[optional] [default to "http"]
modifiedStringLast Modified[optional]
disabledBooleanIs route disabled?[optional] [default to false]
schemaRouteSchema[optional]

NotehubRouteSchema Properties

NameTypeDescriptionNotes
fleets[String]list of Fleet UIDs to apply route to, if any. If empty, applies to all Fleets[optional]
filterHttpFilter[optional]
transformSnowflakeTransform[optional]
throttleMsNumberMinimum time between requests in Miliseconds[optional]
urlString[optional]
httpHeaders{String: String}[optional]
disableHttpHeadersBoolean[optional] [default to false]
timeoutNumberTimeout in seconds for each request[optional] [default to 15]
tokenStringOptional authentication token[optional]
aliasString[optional]
brokerString[optional]
portNumber[optional]
usernameString[optional]
passwordStringThis value is input-only and will be omitted from the response and replaced with a placeholder[optional]
topicString[optional]
certificateStringCertificate with \n newlines. This value is input-only and will be omitted from the response and replaced with a placeholder[optional]
certificateNameStringName of certificate.[optional]
keyStringKey with \n newlines. This value is input-only and will be omitted from the response and replaced with a placeholder[optional]
privateKeyNameStringName of PEM key. If omitted, defaults to "present"[optional] [default to "present"]
regionString[optional]
accessKeyIdString[optional]
accessKeySecretStringThis value is input-only and will be omitted from the response and replaced with a placeholder[optional]
messageGroupIdString[optional]
messageDeduplicationIdString[optional]
channelStringThe Channel ID for Bearer Token method, if the "slack-bearer" type is selected[optional]
testApiBoolean[optional] [default to false]
dataFeedKeyString[optional]
clientIdString[optional]
clientSecretStringThis value is input-only and will be omitted from the response and replaced with a placeholder[optional]
functionsKeySecretStringThis value is input-only and will be omitted from the response and replaced with a placeholder[optional]
sasPolicyNameString[optional]
sasPolicyKeyStringThis value is input-only and will be omitted from the response and replaced with a placeholder[optional]
appKeyStringThis value is input-only and will be omitted from the response and replaced with a placeholder[optional]
organizationNameString[optional]
accountNameString[optional]
userNameString[optional]
pemStringPEM key with \n newlines. This value is input-only and will be omitted from the response and replaced with a placeholder[optional]
slackTypeStringThe type of Slack message. Must be one of "slack-bearer" for Bearer Token or "slack-webhook" for Webhook messages[optional]
bearerStringThe Bearer Token for Slack messaging, if the "slack-bearer" type is selected[optional]
webhookUrlStringThe Webhook URL for Slack Messaging if the "slack-webhook" type is selected[optional]
textStringThe simple text message to be sent, if the blocks message field is not in use. Placeholders are available for this field.[optional]
blocksStringThe Blocks message to be sent. If populated, this field overrides the text field within the Slack Messaging API. Placeholders are available for this field.[optional]

HTTPFilter Properties

NameTypeDescriptionNotes
typeStringWhat notefiles this route applies to.[optional]
systemNotefilesBooleanWhether system notefiles should be affected by this route[optional]
files[String][optional]

SnowflakeTransform Properties

NameTypeDescriptionNotes
formatStringData transformation to apply. Only "jsonata" is valid for Snowflake routes[optional] [default to "jsonata"]
jsonataStringJSONata transformation[optional]

Return type

Successful 200 createRoute response

Authorization

api_key

deleteRoute

Delete single route within a project

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String |
apiInstance.deleteRoute(projectUID, routeUID).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
routeUIDString

Return type

null (empty response body)

Authorization

api_key

getRoute

Get single Notehub route within a project.

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String |
apiInstance.getRoute(projectUID, routeUID).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
routeUIDString

Return type

Successful 200 getRoute response

Authorization

api_key

getRouteLogsByRoute

Get Route Logs by Route UID

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String |
let opts = {
  pageSize: 50, // Number |
  pageNum: 1, // Number |
  deviceUID: ["null"], // [String] | A Device UID.
  sortBy: "captured", // String |
  sortOrder: "asc", // String |
  startDate: 1628631763, // Number | Unix timestamp
  endDate: 1657894210, // Number | Unix timestamp
  systemFilesOnly: true, // Boolean |
  files: "_health.qo, data.qo" // String |
};
apiInstance.getRouteLogsByRoute(projectUID, routeUID, opts).then((data) => {
  console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

Parameters

NameTypeDescriptionNotes
projectUIDString
routeUIDString
pageSizeNumber[optional] [default to 50]
pageNumNumber[optional] [default to 1]
deviceUID[String]A Device UID.[optional]
sortByString[optional] [default to "captured"]
sortOrderString[optional] [default to "asc"]
startDateNumberUnix timestamp[optional]
endDateNumberUnix timestamp[optional]
systemFilesOnlyBoolean[optional]
filesString[optional]

Return type

Successful 200 getRouteLogsByRoute response

Authorization

api_key

getRoutes

Get all Routes within a Project.

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getRoutes(projectUID).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString

Return type

Successful 200 getRoutes response

Authorization

api_key

updateRoute

Update Notehub route by UID

Example

import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";

let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String |
let notehubRoute = {
  http: {
    filter: { 
      type: "include",
      system_notefiles: true,
      files: ["somefile.qo"]
    },
    throttle_ms: 50,
    url: "http://new-route.url",
  },
}; // NotehubRoute | Route settings to be updated
apiInstance.updateRoute(projectUID, routeUID, notehubRoute).then(
  (data) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  },
  (error) => {
    console.error(error);
  }
);

Parameters

NameTypeDescriptionNotes
projectUIDString
routeUIDString
notehubRouteNotehubRouteRoute settings to be updated

NotehubRoute Properties

NameTypeDescriptionNotes
uidStringRoute UID[optional]
labelStringRoute Label[optional]
routeTypeStringType of route.[optional] [default to "http"]
modifiedStringLast Modified[optional]
disabledBooleanIs route disabled?[optional] [default to false]
schemaRouteSchema[optional]

NotehubRouteSchema Properties

NameTypeDescriptionNotes
fleets[String]list of Fleet UIDs to apply route to, if any. If empty, applies to all Fleets[optional]
filterHttpFilter[optional]
transformSnowflakeTransform[optional]
throttleMsNumberMinimum time between requests in Miliseconds[optional]
urlString[optional]
httpHeaders{String: String}[optional]
disableHttpHeadersBoolean[optional] [default to false]
timeoutNumberTimeout in seconds for each request[optional] [default to 15]
tokenStringOptional authentication token[optional]
aliasString[optional]
brokerString[optional]
portNumber[optional]
usernameString[optional]
passwordStringThis value is input-only and will be omitted from the response and replaced with a placeholder[optional]
topicString[optional]
certificateStringCertificate with \n newlines. This value is input-only and will be omitted from the response and replaced with a placeholder[optional]
certificateNameStringName of certificate.[optional]
keyStringKey with \n newlines. This value is input-only and will be omitted from the response and replaced with a placeholder[optional]
privateKeyNameStringName of PEM key. If omitted, defaults to "present"[optional] [default to "present"]
regionString[optional]
accessKeyIdString[optional]
accessKeySecretStringThis value is input-only and will be omitted from the response and replaced with a placeholder[optional]
messageGroupIdString[optional]
messageDeduplicationIdString[optional]
channelStringThe Channel ID for Bearer Token method, if the "slack-bearer" type is selected[optional]
testApiBoolean[optional] [default to false]
dataFeedKeyString[optional]
clientIdString[optional]
clientSecretStringThis value is input-only and will be omitted from the response and replaced with a placeholder[optional]
functionsKeySecretStringThis value is input-only and will be omitted from the response and replaced with a placeholder[optional]
sasPolicyNameString[optional]
sasPolicyKeyStringThis value is input-only and will be omitted from the response and replaced with a placeholder[optional]
appKeyStringThis value is input-only and will be omitted from the response and replaced with a placeholder[optional]
organizationNameString[optional]
accountNameString[optional]
userNameString[optional]
pemStringPEM key with \n newlines. This value is input-only and will be omitted from the response and replaced with a placeholder[optional]
slackTypeStringThe type of Slack message. Must be one of "slack-bearer" for Bearer Token or "slack-webhook" for Webhook messages[optional]
bearerStringThe Bearer Token for Slack messaging, if the "slack-bearer" type is selected[optional]
webhookUrlStringThe Webhook URL for Slack Messaging if the "slack-webhook" type is selected[optional]
textStringThe simple text message to be sent, if the blocks message field is not in use. Placeholders are available for this field.[optional]
blocksStringThe Blocks message to be sent. If populated, this field overrides the text field within the Slack Messaging API. Placeholders are available for this field.[optional]

HTTPFilter Properties

NameTypeDescriptionNotes
typeStringWhat notefiles this route applies to.[optional]
systemNotefilesBooleanWhether system notefiles should be affected by this route[optional]
files[String][optional]

SnowflakeTransform Properties

NameTypeDescriptionNotes
formatStringData transformation to apply. Only "jsonata" is valid for Snowflake routes[optional] [default to "jsonata"]
jsonataStringJSONata transformation[optional]

Return type

Successful 200 updateRoute response

Authorization

api_key

Can we improve this page? Send us feedback
© 2025 Blues Inc.
© 2025 Blues Inc.
TermsPrivacy
Notecard Disconnected
Having trouble connecting?

Try changing your USB cable as some cables do not support transferring data. If that does not solve your problem, contact us at support@blues.com and we will get you set up with another tool to communicate with the Notecard.

Advanced Usage

The help command gives more info.

Connect a Notecard
Use USB to connect and start issuing requests from the browser.
Try Notecard Simulator
Experiment with Notecard's latest firmware on a Simulator assigned to your free Notehub account.

Don't have an account? Sign up