Notehub JS Library Overview
The Notehub JS library is an npm package built for JavaScript applications. It provides a quick, JavaScript-friendly way to connect to the Notehub API, and perform Notehub API requests with a clean, intuitive interface.
Installation
You can install the Notehub JS library in any JavaScript application using the steps below.
Start by installing the @blues-inc/notehub-js package in your project using
your package manager of choice. The example below uses npm:
npm install @blues-inc/notehub-jsOnce the package is installed, you can import the library using either import
or require:
Using import:
import * as NotehubJs from "@blues-inc/notehub-js";Using import in a TypeScript project will currently cause an error because
type definitions are not yet included. To resolve this, create a .d.ts
file in your project (for example, types/notehub-js.d.ts) with the following
declaration:
declare module "@blues-inc/notehub-js";Using require:
const NotehubJs = require("@blues-inc/notehub-js");Usage
Authentication
The Notehub JS library authenticates using a Personal Access Token (PAT). Set your token once on the shared ApiClient instance before making any API calls:
import * as NotehubJs from "@blues-inc/notehub-js";
const defaultClient = NotehubJs.ApiClient.instance;
const auth = defaultClient.authentications["personalAccessToken"];
auth.accessToken = "YOUR_ACCESS_TOKEN";Finding Your Project UID
Most API methods require a ProjectUID —
a unique identifier for your Notehub project in the format app:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. You can find it on your project's Settings page in Notehub.
Example: Fetching Events
Here's a complete example that retrieves the 10 most recent events from a project:
import * as NotehubJs from "@blues-inc/notehub-js";
const defaultClient = NotehubJs.ApiClient.instance;
const auth = defaultClient.authentications["personalAccessToken"];
auth.accessToken = "YOUR_ACCESS_TOKEN";
const projectUID = "app:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
const eventApi = new NotehubJs.EventApi();
eventApi.getEvents(projectUID, { pageSize: 10, sortOrder: "desc" }).then(
(data) => console.log(data.events),
(error) => console.error(error)
);
// If you're using TypeScript you may need to add types to avoid
// compilation errors
// eventApi.getEvents(projectUID, { pageSize: 10, sortOrder: "desc" }).then(
// (data: any) => console.log(data.events),
// (error: unknown) => console.error(error)
// );getEvents() returns events oldest-first by default, so the example sets
sortOrder: "desc" to get the newest ones. The response contains an events
array and a has_more flag that tells you whether there are more pages to
fetch with the pageNum option.
The library also supports async/await:
try {
const data = await eventApi.getEvents(projectUID, {
pageSize: 10,
sortOrder: "desc",
});
console.log(data.events);
} catch (error) {
console.error(error.status ?? error, error.body);
}When Notehub returns an error response, the error includes the HTTP status
and the response body.
Usage Limits
The Notehub API has usage limits. Exceeding the request threshold may result in 429 responses (error.status === 429). See Notehub API Usage Limits for details.
API Reference
| API | Description |
|---|---|
| Device API | Manage devices, environment variables, and Notefiles |
| Event API | Query project and fleet events, with cursor and filter support |
| Jobs API | Manage and run Notehub batch jobs |
| Monitor API | Create and manage monitors that trigger alerts on event data |
| Organization API | Retrieve your organizations, their plans, and daily balance history |
| Project API | Manage projects, fleets, firmware, environment variables, and more |
| Route API | Create and manage routes for forwarding event data |
| Usage API | Query data, event, route log, and session usage by time range |
Device API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| addDbNote | POST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} | Add a note to a .db notefile |
| addQiNote | POST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID} | Queue a note for a Notecard |
| createNotefile | POST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notefiles/{notefileID} | Create an empty notefile |
| deleteDevice | DELETE /v1/projects/{projectOrProductUID}/devices/{deviceUID} | Delete a device |
| deleteDeviceEnvironmentVariable | DELETE /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables/{key} | Delete a device environment variable |
| deleteNote | DELETE /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} | Delete a note |
| deleteNotefiles | DELETE /v1/projects/{projectOrProductUID}/devices/{deviceUID}/files | Delete notefiles |
| disableDevice | POST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/disable | Disable a device |
| enableDevice | POST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/enable | Enable a device |
| getDbNote | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} | Get a note |
| getDevice | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID} | Get a device |
| getDeviceEnvironmentHierarchy | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_hierarchy | Get a device's environment hierarchy |
| getDeviceEnvironmentVariables | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables | Get device environment variables |
| getDeviceEnvironmentVariablesByPin | GET /v1/products/{productUID}/devices/{deviceUID}/environment_variables_with_pin | Get device environment variables using a PIN |
| getDeviceHealthLog | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/health-log | Get a device's health log |
| getDeviceJourney | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/journeys/{journeyID} | Get a journey and its events |
| getDeviceJourneys | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/journeys | List a device's journeys |
| getDeviceLatestEvents | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/latest | Get a device's latest event per notefile |
| getDevicePlans | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/plans | Get a device's cellular data plans |
| getDevicePublicKey | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/public-key | Get a device's public key |
| getDevicePublicKeys | GET /v1/projects/{projectOrProductUID}/devices/public-keys | List public keys of all devices |
| getDeviceSessions | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/sessions | List a device's sessions |
| getDevices | GET /v1/projects/{projectOrProductUID}/devices | List devices in a project |
| getFleetDevices | GET /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/devices | List devices in a fleet |
| getNotefile | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID} | Get the notes in a notefile |
| getSessions | GET /v1/projects/{projectOrProductUID}/sessions | List sessions in a project |
| listNotefiles | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/files | List a device's notefiles and notes |
| provisionDevice | POST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/provision | Provision a Notecard |
| setDeviceEnvironmentVariables | PUT /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables | Set device environment variables |
| setDeviceEnvironmentVariablesByPin | PUT /v1/products/{productUID}/devices/{deviceUID}/environment_variables_with_pin | Set device environment variables using a PIN |
| signalDevice | POST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/signal | Send a signal to a connected Notecard |
| updateDbNote | PUT /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} | Update a note in a .db notefile |
addDbNote
addDbNote(projectOrProductUID, deviceUID, notefileID, noteID, noteInput)
Add a note to a .db notefile
Add a note with the given ID to a database notefile on a device, synced to the Notecard on its next sync. To change an existing note, use `UpdateDbNote`; to queue a note in a `.qi` notefile, use `AddQiNote`. Requires the Owner or Developer role. Returns 400 unless the notefile ends in `.db` or `.dbs`, or if `payload` isn't valid base64.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let notefileID = "notefileID_example"; // String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
let noteID = "noteID_example"; // String | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
let noteInput = new NotehubJs.NoteInput(); // NoteInput | Body or payload of note to be added to the device
apiInstance
.addDbNote(projectOrProductUID, deviceUID, notefileID, noteID, noteInput)
.then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| notefileID | String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`. | |
| noteID | String | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`. | |
| noteInput | NoteInput | Body or payload of note to be added to the device |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
addQiNote
addQiNote(projectOrProductUID, deviceUID, notefileID, noteInput)
Queue a note for a Notecard
Add a note to an inbound queue (`.qi`) notefile on a device, creating the notefile if needed. The Notecard receives it on its next sync. For a `.db` notefile, use `AddDbNote`; to reach a connected Notecard immediately, use `SignalDevice`. Requires the Owner or Developer role. Returns 400 unless the notefile ends in `.qi` or `.qis`, or if `payload` isn't valid base64.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let notefileID = "notefileID_example"; // String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
let noteInput = new NotehubJs.NoteInput(); // NoteInput | Body or payload of note to be added to the device
apiInstance
.addQiNote(projectOrProductUID, deviceUID, notefileID, noteInput)
.then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| notefileID | String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`. | |
| noteInput | NoteInput | Body or payload of note to be added to the device |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
createNotefile
createNotefile(projectOrProductUID, deviceUID, notefileID)
Create an empty notefile
Create an empty notefile on a device. `AddQiNote` creates a notefile when needed, so this is only required for an empty one. Requires the Owner or Developer role. Returns 400 if the notefile already exists.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let notefileID = "notefileID_example"; // String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
apiInstance.createNotefile(projectOrProductUID, deviceUID, notefileID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| notefileID | String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`. |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
deleteDevice
deleteDevice(projectOrProductUID, deviceUID)
Delete a device
Delete a device and its notefiles from a project. Its events are kept. A Notecard that syncs again is added back as a new device; to block it instead, use `DisableDevice`. Requires the Owner or Developer role.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.deleteDevice(projectOrProductUID, deviceUID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
deleteDeviceEnvironmentVariable
EnvironmentVariables deleteDeviceEnvironmentVariable(projectOrProductUID, deviceUID, key)
Delete a device environment variable
Delete one device environment variable and return the ones left. Fleet and project variables with the same name then apply. Deleting a variable that doesn't exist succeeds. Requires the Owner or Developer role.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let key = "key_example"; // String | The environment variable key to delete.
apiInstance
.deleteDeviceEnvironmentVariable(projectOrProductUID, deviceUID, key)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| key | String | The environment variable key to delete. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
deleteNote
deleteNote(projectOrProductUID, deviceUID, notefileID, noteID)
Delete a note
Delete one note from a notefile on a device. To delete whole notefiles, use `DeleteNotefiles`. Requires the Owner or Developer role.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let notefileID = "notefileID_example"; // String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
let noteID = "noteID_example"; // String | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
apiInstance.deleteNote(projectOrProductUID, deviceUID, notefileID, noteID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| notefileID | String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`. | |
| noteID | String | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`. |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
deleteNotefiles
deleteNotefiles(projectOrProductUID, deviceUID, deleteNotefilesRequest)
Delete notefiles
Delete notefiles and all their notes from a device. To delete one note, use `DeleteNote`. Requires the Owner or Developer role. Returns 400 if `files` is empty.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let deleteNotefilesRequest = new NotehubJs.DeleteNotefilesRequest(); // DeleteNotefilesRequest | The notefiles to delete.
apiInstance
.deleteNotefiles(projectOrProductUID, deviceUID, deleteNotefilesRequest)
.then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| deleteNotefilesRequest | DeleteNotefilesRequest | The notefiles to delete. |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
disableDevice
disableDevice(projectOrProductUID, deviceUID)
Disable a device
Stop a device from connecting to Notehub, ending any open session. The device and its data stay in the project; undo with `EnableDevice`. Does nothing if it's already disabled. Requires the Owner or Developer role.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.disableDevice(projectOrProductUID, deviceUID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
enableDevice
enableDevice(projectOrProductUID, deviceUID)
Enable a device
Re-enable a device turned off with `DisableDevice`, so it can connect to Notehub again. Does nothing if the device is already enabled. Requires the Owner or Developer role. Returns 409 if the device's cellular service was deactivated; it must be reactivated instead.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.enableDevice(projectOrProductUID, deviceUID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDbNote
GetDbNote200Response getDbNote(projectOrProductUID, deviceUID, notefileID, noteID, opts)
Get a note
Get one note's body, payload and time from a notefile on a device. To get every note in a notefile, use `GetNotefile`. With `delete=true`, the note is deleted after it is read, which requires the Owner or Developer role.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let notefileID = "notefileID_example"; // String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
let noteID = "noteID_example"; // String | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
let opts = {
_delete: true, // Boolean | If true, delete the note after returning it. Requires the Owner or Developer role.
deleted: true, // Boolean | If true, also return the note if it has been deleted.
};
apiInstance
.getDbNote(projectOrProductUID, deviceUID, notefileID, noteID, opts)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| notefileID | String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`. | |
| noteID | String | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`. | |
| _delete | Boolean | If true, delete the note after returning it. Requires the Owner or Developer role. | [optional] |
| deleted | Boolean | If true, also return the note if it has been deleted. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDevice
Device getDevice(projectOrProductUID, deviceUID)
Get a device
Get one device's details: serial number, product, fleets, locations, firmware versions, SIM usage and DFU state. To find devices by tag, serial number or other fields, use `GetDevices`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.getDevice(projectOrProductUID, deviceUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDeviceEnvironmentHierarchy
EnvTreeJsonNode getDeviceEnvironmentHierarchy(projectOrProductUID, deviceUID)
Get a device's environment hierarchy
Get a device's environment variables and the fleet and project variables it inherits, as a tree. Each variable has its precedence and whether it is used or overridden. For just the resolved values, use `GetDeviceEnvironmentVariables`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.getDeviceEnvironmentHierarchy(projectOrProductUID, deviceUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDeviceEnvironmentVariables
GetDeviceEnvironmentVariablesByPin200Response getDeviceEnvironmentVariables(projectOrProductUID, deviceUID)
Get device environment variables
Get a device's own environment variables, its `env.default` values, and its effective values. Effective values merge in project and fleet variables, which device variables override. To see where each value comes from, use `GetDeviceEnvironmentHierarchy`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.getDeviceEnvironmentVariables(projectOrProductUID, deviceUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String |
Return type
GetDeviceEnvironmentVariablesByPin200Response
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDeviceEnvironmentVariablesByPin
GetDeviceEnvironmentVariablesByPin200Response getDeviceEnvironmentVariablesByPin(productUID, deviceUID, xAuthToken)
Get device environment variables using a PIN
Get a device's environment variables using its PIN instead of an API token. Pass the PIN in `X-Auth-Token`. Made for device dashboard pages; with a token, use `GetDeviceEnvironmentVariables`, which also returns effective values. Returns 401 if the project's device dashboard URL has no `[pin]`, or the PIN is wrong.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let productUID = "com.blues.bridge:sensors"; // String |
let deviceUID = "dev:000000000000000"; // String |
let xAuthToken = "xAuthToken_example"; // String | The device's PIN, used instead of an API token.
apiInstance
.getDeviceEnvironmentVariablesByPin(productUID, deviceUID, xAuthToken)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| productUID | String | ||
| deviceUID | String | ||
| xAuthToken | String | The device's PIN, used instead of an API token. |
Return type
GetDeviceEnvironmentVariablesByPin200Response
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDeviceHealthLog
GetDeviceHealthLog200Response getDeviceHealthLog(projectOrProductUID, deviceUID, opts)
Get a device's health log
Get a device's health log: timestamped status messages such as restarts and completed firmware updates. Only the latest 100 entries are kept. To filter by date, pass both `startDate` and `endDate`; `startDate` alone returns 400, and the same value for both returns every entry.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let opts = {
startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
logType: ["null"], // [String] | Return only these kinds of entry. If omitted, all entries are returned. - `boot`: the device restarted - `dfu_completed`: a host firmware update finished
};
apiInstance.getDeviceHealthLog(projectOrProductUID, deviceUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| startDate | Number | Start date for filtering results, specified as a Unix timestamp | [optional] |
| endDate | Number | End date for filtering results, specified as a Unix timestamp | [optional] |
| logType | [String] | Return only these kinds of entry. If omitted, all entries are returned. - `boot`: the device restarted - `dfu_completed`: a host firmware update finished | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDeviceJourney
GetDeviceJourney200Response getDeviceJourney(projectOrProductUID, deviceUID, journeyID, opts)
Get a journey and its events
Get one journey's start and end time and its events, oldest first. Only events with a location are included, and a run of events at the same location is reduced to the first. The events are paginated; `journey.has_more` is true if there are more. Returns 404 if the journey doesn't exist, and 403 if the organization is suspended.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let journeyID = 789; // Number | Identifier of the journey, taken from the numeric `journey` field in the event body (a Unix timestamp marking the start of the journey).
let opts = {
pageSize: 1000, // Number |
pageNum: 1, // Number |
};
apiInstance
.getDeviceJourney(projectOrProductUID, deviceUID, journeyID, opts)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| journeyID | Number | Identifier of the journey, taken from the numeric `journey` field in the event body (a Unix timestamp marking the start of the journey). | |
| pageSize | Number | [optional] [default to 1000] | |
| pageNum | Number | [optional] [default to 1] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDeviceJourneys
GetDeviceJourneys200Response getDeviceJourneys(projectOrProductUID, deviceUID, opts)
List a device's journeys
List a device's journeys, newest first, without their events. A journey is the events whose body has the same `journey` value and a `jcount` field; one-event journeys are left out. For a journey's events, use `GetDeviceJourney`. Returns at most 100; `has_more` is true if there are more. `startDate` and `endDate` filter on the journey's start. Returns 403 if the organization is suspended.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let opts = {
startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
};
apiInstance.getDeviceJourneys(projectOrProductUID, deviceUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| startDate | Number | Start date for filtering results, specified as a Unix timestamp | [optional] |
| endDate | Number | End date for filtering results, specified as a Unix timestamp | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDeviceLatestEvents
GetDeviceLatestEvents200Response getDeviceLatestEvents(projectOrProductUID, deviceUID)
Get a device's latest event per notefile
Get the most recent event from each of a device's notefiles, sorted by notefile name. `_env.qo` is left out. To search a device's event history, use `GetEvents`. Returns 403 if the organization is suspended.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.getDeviceLatestEvents(projectOrProductUID, deviceUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String |
Return type
GetDeviceLatestEvents200Response
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDevicePlans
GetDevicePlans200Response getDevicePlans(projectOrProductUID, deviceUID)
Get a device's cellular data plans
Get the data plan of each cellular SIM in a device: plan type, data used and remaining, and expiry. Covers the built-in SIM and any external SIM, but not satellite plans. Returns 404 if the device has no cellular or satellite SIM.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.getDevicePlans(projectOrProductUID, deviceUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDevicePublicKey
GetDevicePublicKey200Response getDevicePublicKey(projectOrProductUID, deviceUID)
Get a device's public key
Get one Notecard's public key, in PEM format. For every device in the project, use `GetDevicePublicKeys`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.getDevicePublicKey(projectOrProductUID, deviceUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDevicePublicKeys
GetDevicePublicKeys200Response getDevicePublicKeys(projectOrProductUID, opts)
List public keys of all devices
List the public key of every device in a project. For one device, use `GetDevicePublicKey`. Paginated. Deleted devices are included only when reading with a `cursor`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
pageSize: 1000, // Number |
pageNum: 1, // Number |
cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
};
apiInstance.getDevicePublicKeys(projectOrProductUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| pageSize | Number | [optional] [default to 1000] | |
| pageNum | Number | [optional] [default to 1] | |
| cursor | String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
Return type
GetDevicePublicKeys200Response
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDeviceSessions
GetDeviceSessions200Response getDeviceSessions(projectOrProductUID, deviceUID, opts)
List a device's sessions
List a device's sessions, its connections to Notehub. Each shows why it opened and closed, signal strength, location and data usage. `startDate` and `endDate` filter on when the session began. For every device's sessions, use `GetSessions`. Paginated.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let opts = {
pageSize: 1000, // Number |
pageNum: 1, // Number |
cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
firstSync: false, // Boolean | If true, return only sessions whose `why_session_opened` begins with \"first sync\".
};
apiInstance.getDeviceSessions(projectOrProductUID, deviceUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| pageSize | Number | [optional] [default to 1000] | |
| pageNum | Number | [optional] [default to 1] | |
| cursor | String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| startDate | Number | Start date for filtering results, specified as a Unix timestamp | [optional] |
| endDate | Number | End date for filtering results, specified as a Unix timestamp | [optional] |
| firstSync | Boolean | If true, return only sessions whose `why_session_opened` begins with "first sync". | [optional] [default to false] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDevices
GetDevices200Response getDevices(projectOrProductUID, opts)
List devices in a project
List the devices in a project, with optional filters such as tag, serial number, fleet, location and firmware version. For one fleet's devices, use `GetFleetDevices`. Paginated.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
pageSize: 1000, // Number |
pageNum: 1, // Number |
cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
deviceUID: ["null"], // [String] | A DeviceUID.
tag: ["null"], // [String] | Tag filter. Matches the whole tag, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. For example, `51*` matches tags starting with `51`.
serialNumber: ["null"], // [String] | Serial number filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
fleetUID: ["null"], // [String] |
notecardFirmware: ["null"], // [String] | Firmware version filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
location: ["null"], // [String] | Location filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
hostFirmware: ["null"], // [String] | Host firmware filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
productUID: ["null"], // [String] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
sku: ["null"], // [String] | SKU filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
};
apiInstance.getDevices(projectOrProductUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| pageSize | Number | [optional] [default to 1000] | |
| pageNum | Number | [optional] [default to 1] | |
| cursor | String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| deviceUID | [String] | A DeviceUID. | [optional] |
| tag | [String] | Tag filter. Matches the whole tag, case-insensitive. Use `` as a wildcard and `\` to match a literal ``; all other characters, including `%` and `_`, match literally. For example, `51` matches tags starting with `51`. | [optional] |
| serialNumber | [String] | Serial number filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| fleetUID | [String] | [optional] | |
| notecardFirmware | [String] | Firmware version filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| location | [String] | Location filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| hostFirmware | [String] | Host firmware filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| productUID | [String] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| sku | [String] | SKU filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getFleetDevices
GetDevices200Response getFleetDevices(projectOrProductUID, fleetUID, opts)
List devices in a fleet
List the devices in one fleet, with the same filters as `GetDevices`. To list a device's fleets instead, use `GetDeviceFleets`. Paginated. Returns 404 if the fleet doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let opts = {
pageSize: 1000, // Number |
pageNum: 1, // Number |
cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
deviceUID: ["null"], // [String] | A DeviceUID.
tag: ["null"], // [String] | Tag filter. Matches the whole tag, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. For example, `51*` matches tags starting with `51`.
serialNumber: ["null"], // [String] | Serial number filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
notecardFirmware: ["null"], // [String] | Firmware version filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
location: ["null"], // [String] | Location filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
hostFirmware: ["null"], // [String] | Host firmware filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
productUID: ["null"], // [String] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
sku: ["null"], // [String] | SKU filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
};
apiInstance.getFleetDevices(projectOrProductUID, fleetUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| fleetUID | String | ||
| pageSize | Number | [optional] [default to 1000] | |
| pageNum | Number | [optional] [default to 1] | |
| cursor | String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| deviceUID | [String] | A DeviceUID. | [optional] |
| tag | [String] | Tag filter. Matches the whole tag, case-insensitive. Use `` as a wildcard and `\` to match a literal ``; all other characters, including `%` and `_`, match literally. For example, `51` matches tags starting with `51`. | [optional] |
| serialNumber | [String] | Serial number filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| notecardFirmware | [String] | Firmware version filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| location | [String] | Location filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| hostFirmware | [String] | Host firmware filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| productUID | [String] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| sku | [String] | SKU filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getNotefile
GetNotefile200Response getNotefile(projectOrProductUID, deviceUID, notefileID, opts)
Get the notes in a notefile
Get the notes in one notefile on a device. For a `.qi` notefile, that's the notes still queued; for a `.db` notefile, every note. To list all of a device's notefiles with their notes, use `ListNotefiles`. With `delete=true`, the returned notes are deleted, which requires the Owner or Developer role. Returns 400 if `notefileID` has no valid notefile extension.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let notefileID = "notefileID_example"; // String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
let opts = {
max: 56, // Number | The most notes to return.
deleted: true, // Boolean | If true, also return deleted notes.
_delete: true, // Boolean | If true, delete the notes this request returns. Requires the Owner or Developer role.
};
apiInstance.getNotefile(projectOrProductUID, deviceUID, notefileID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| notefileID | String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`. | |
| max | Number | The most notes to return. | [optional] |
| deleted | Boolean | If true, also return deleted notes. | [optional] |
| _delete | Boolean | If true, delete the notes this request returns. Requires the Owner or Developer role. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getSessions
GetDeviceSessions200Response getSessions(projectOrProductUID, opts)
List sessions in a project
List the sessions of every device in a project, as `GetDeviceSessions` does for one device. `startDate` and `endDate` filter on when the session began. `deviceUID` and `fleetUID` each match any of their values; `fleetUID` matches the fleets recorded on the session. Paginated.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
pageSize: 1000, // Number |
pageNum: 1, // Number |
cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
firstSync: false, // Boolean | If true, return only sessions whose `why_session_opened` begins with \"first sync\".
deviceUID: ["null"], // [String] | A DeviceUID.
fleetUID: ["null"], // [String] |
};
apiInstance.getSessions(projectOrProductUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| pageSize | Number | [optional] [default to 1000] | |
| pageNum | Number | [optional] [default to 1] | |
| cursor | String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| startDate | Number | Start date for filtering results, specified as a Unix timestamp | [optional] |
| endDate | Number | End date for filtering results, specified as a Unix timestamp | [optional] |
| firstSync | Boolean | If true, return only sessions whose `why_session_opened` begins with "first sync". | [optional] [default to false] |
| deviceUID | [String] | A DeviceUID. | [optional] |
| fleetUID | [String] | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
listNotefiles
[Notefile] listNotefiles(projectOrProductUID, deviceUID, opts)
List a device's notefiles and notes
List a device's notefiles with the notes in each, sorted `.qo`, then `.qi`, then `.db`. `.qo` notefiles are listed without notes, since Notehub empties them as it processes them. Most system notefiles (names starting with `_`) are left out. For one notefile, use `GetNotefile`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let opts = {
files: ["null"], // [String] | Notefiles to include, e.g. `config.db`. If omitted, all are listed.
pending: true, // Boolean | show only files that are pending sync to the Notecard
};
apiInstance.listNotefiles(projectOrProductUID, deviceUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| files | [String] | Notefiles to include, e.g. `config.db`. If omitted, all are listed. | [optional] |
| pending | Boolean | show only files that are pending sync to the Notecard | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
provisionDevice
Object provisionDevice(projectOrProductUID, deviceUID, provisionDeviceRequest)
Provision a Notecard
Add a Notecard to a project before it first connects, with its product, serial number and fleets. A device that already exists isn't reset and keeps its fleets. Requires the Owner or Developer role. Returns 404 if `product_uid` doesn't exist, and 400 if it belongs to another project or `deviceUID` isn't a valid Notecard DeviceUID.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let provisionDeviceRequest = new NotehubJs.ProvisionDeviceRequest(); // ProvisionDeviceRequest | The product, serial number and fleets for the device.
apiInstance
.provisionDevice(projectOrProductUID, deviceUID, provisionDeviceRequest)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| provisionDeviceRequest | ProvisionDeviceRequest | The product, serial number and fleets for the device. |
Return type
Object
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
setDeviceEnvironmentVariables
EnvironmentVariables setDeviceEnvironmentVariables(projectOrProductUID, deviceUID, environmentVariables)
Set device environment variables
Add or change a device's environment variables; variables you don't send keep their values. A value of `""` or `-` deletes that variable. Setting `_fw`, `_fwc` or `_fwm` starts a host, Notecard or modem firmware update. Requires the Owner or Developer role. Returns 400 if a note's key isn't a variable.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let environmentVariables = new NotehubJs.EnvironmentVariables(); // EnvironmentVariables | The variables to add or change, and optional notes.
apiInstance
.setDeviceEnvironmentVariables(
projectOrProductUID,
deviceUID,
environmentVariables
)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| environmentVariables | EnvironmentVariables | The variables to add or change, and optional notes. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
setDeviceEnvironmentVariablesByPin
EnvironmentVariables setDeviceEnvironmentVariablesByPin(productUID, deviceUID, xAuthToken, environmentVariables)
Set device environment variables using a PIN
Add or change a device's environment variables using its PIN instead of an API token. Pass the PIN in `X-Auth-Token`. Works like `SetDeviceEnvironmentVariables`: a value of `""` or `-` deletes that variable. Returns 401 if the project's device dashboard URL has no `[pin]`, or the PIN is wrong.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let productUID = "com.blues.bridge:sensors"; // String |
let deviceUID = "dev:000000000000000"; // String |
let xAuthToken = "xAuthToken_example"; // String | The device's PIN, used instead of an API token.
let environmentVariables = new NotehubJs.EnvironmentVariables(); // EnvironmentVariables | The variables to add or change, and optional notes.
apiInstance
.setDeviceEnvironmentVariablesByPin(
productUID,
deviceUID,
xAuthToken,
environmentVariables
)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| productUID | String | ||
| deviceUID | String | ||
| xAuthToken | String | The device's PIN, used instead of an API token. | |
| environmentVariables | EnvironmentVariables | The variables to add or change, and optional notes. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
signalDevice
SignalDevice200Response signalDevice(projectOrProductUID, deviceUID, body)
Send a signal to a connected Notecard
Send a JSON object straight to a Notecard, which the host can read with `hub.signal`. It's delivered only if the Notecard is connected to Notehub at that moment, and is never queued; `connected` in the response says whether it was. To queue data for the next sync, use `AddQiNote` instead. Requires the Owner or Developer role. Returns 400 if the body has a `type` field.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let body = new NotehubJs.Body(); // Body | The signal to send.
apiInstance.signalDevice(projectOrProductUID, deviceUID, body).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| body | Body | The signal to send. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
updateDbNote
updateDbNote(projectOrProductUID, deviceUID, notefileID, noteID, noteInput)
Update a note in a .db notefile
Replace the body and payload of a note in a database notefile on a device, synced to the Notecard on its next sync. To add a new note, use `AddDbNote`. Requires the Owner or Developer role. Returns 400 unless the notefile ends in `.db` or `.dbs`, or if `payload` isn't valid base64.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.DeviceApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let notefileID = "notefileID_example"; // String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
let noteID = "noteID_example"; // String | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
let noteInput = new NotehubJs.NoteInput(); // NoteInput | Body or payload of note to be added to the device
apiInstance
.updateDbNote(projectOrProductUID, deviceUID, notefileID, noteID, noteInput)
.then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| notefileID | String | Notefile name, including its extension, e.g. `config.db` or `commands.qi`. | |
| noteID | String | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`. | |
| noteInput | NoteInput | Body or payload of note to be added to the device |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
Event API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| getEvents | GET /v1/projects/{projectOrProductUID}/events | List events in a project |
| getFleetEvents | GET /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/events | List events in a fleet |
| getRouteLogsByEvent | GET /v1/projects/{projectOrProductUID}/events/{eventUID}/route-logs | Get an event's route logs |
getEvents
GetEvents200Response getEvents(projectOrProductUID, opts)
List events in a project
List a project's events, filtered by device, notefile, date, fleet, session and more. Use `cursor` to read events in the order Notehub stored them and to poll for new ones. Set `format=csv` for CSV. For one fleet, use `GetFleetEvents`. Paginated. Returns 403 if the organization is suspended, and 500 if the query times out; narrow the filters and retry.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.EventApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
pageSize: 1000, // Number |
pageNum: 1, // Number |
cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
deviceUID: ["null"], // [String] | A DeviceUID.
sensorUID: ["null"], // [String] | SensorUID to filter by, matched exactly. Repeat for more than one.
sortBy: "'captured'", // String |
sortOrder: "'asc'", // String |
startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
dateType: "uploaded", // String | Which time `startDate` and `endDate` filter on. - `captured`: when the Notecard created the event - `uploaded`: when Notehub received it
systemFilesOnly: true, // Boolean | If true, return only events from system notefiles, such as `_session.qo` and `_health.qo`.
files: "_health.qo, data.qo", // String | Comma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`.
format: "'json'", // String | Response format. - `json`: a JSON object with `events` - `csv`: CSV, with the columns in `selectFields`
serialNumber: ["null"], // [String] | Serial number to filter by. Repeat for more than one.
fleetUID: ["null"], // [String] | Filter by FleetUID
sessionUID: ["null"], // [String] | SessionUID to filter by. Repeat for more than one.
eventUID: ["null"], // [String] | EventUID to filter by. Repeat for more than one.
selectFields: "selectFields_example", // String | Comma-separated event fields to return, e.g. `device,when,body.temp`. Also sets the CSV columns.
};
apiInstance.getEvents(projectOrProductUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| pageSize | Number | [optional] [default to 1000] | |
| pageNum | Number | [optional] [default to 1] | |
| cursor | String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| deviceUID | [String] | A DeviceUID. | [optional] |
| sensorUID | [String] | SensorUID to filter by, matched exactly. Repeat for more than one. | [optional] |
| sortBy | String | [optional] [default to 'captured'] | |
| sortOrder | String | [optional] [default to 'asc'] | |
| startDate | Number | Start date for filtering results, specified as a Unix timestamp | [optional] |
| endDate | Number | End date for filtering results, specified as a Unix timestamp | [optional] |
| dateType | String | Which time `startDate` and `endDate` filter on. - `captured`: when the Notecard created the event - `uploaded`: when Notehub received it | [optional] [default to 'captured'] |
| systemFilesOnly | Boolean | If true, return only events from system notefiles, such as `_session.qo` and `_health.qo`. | [optional] |
| files | String | Comma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`. | [optional] |
| format | String | Response format. - `json`: a JSON object with `events` - `csv`: CSV, with the columns in `selectFields` | [optional] [default to 'json'] |
| serialNumber | [String] | Serial number to filter by. Repeat for more than one. | [optional] |
| fleetUID | [String] | Filter by FleetUID | [optional] |
| sessionUID | [String] | SessionUID to filter by. Repeat for more than one. | [optional] |
| eventUID | [String] | EventUID to filter by. Repeat for more than one. | [optional] |
| selectFields | String | Comma-separated event fields to return, e.g. `device,when,body.temp`. Also sets the CSV columns. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, text/csv
getFleetEvents
GetEvents200Response getFleetEvents(projectOrProductUID, fleetUID, opts)
List events in a fleet
List the events from one fleet, with the same filters, `cursor` and CSV output as `GetEvents`. Paginated. Returns 403 if the organization is suspended, and 500 if the query times out; narrow the filters and retry.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.EventApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let opts = {
pageSize: 1000, // Number |
pageNum: 1, // Number |
cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
deviceUID: ["null"], // [String] | A DeviceUID.
sensorUID: ["null"], // [String] | SensorUID to filter by, matched exactly. Repeat for more than one.
sortBy: "'captured'", // String |
sortOrder: "'asc'", // String |
startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
dateType: "uploaded", // String | Which time `startDate` and `endDate` filter on. - `captured`: when the Notecard created the event - `uploaded`: when Notehub received it
systemFilesOnly: true, // Boolean | If true, return only events from system notefiles, such as `_session.qo` and `_health.qo`.
files: "_health.qo, data.qo", // String | Comma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`.
format: "'json'", // String | Response format. - `json`: a JSON object with `events` - `csv`: CSV, with the columns in `selectFields`
serialNumber: ["null"], // [String] | Serial number to filter by. Repeat for more than one.
sessionUID: ["null"], // [String] | SessionUID to filter by. Repeat for more than one.
eventUID: ["null"], // [String] | EventUID to filter by. Repeat for more than one.
selectFields: "selectFields_example", // String | Comma-separated event fields to return, e.g. `device,when,body.temp`. Also sets the CSV columns.
};
apiInstance.getFleetEvents(projectOrProductUID, fleetUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| fleetUID | String | ||
| pageSize | Number | [optional] [default to 1000] | |
| pageNum | Number | [optional] [default to 1] | |
| cursor | String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| deviceUID | [String] | A DeviceUID. | [optional] |
| sensorUID | [String] | SensorUID to filter by, matched exactly. Repeat for more than one. | [optional] |
| sortBy | String | [optional] [default to 'captured'] | |
| sortOrder | String | [optional] [default to 'asc'] | |
| startDate | Number | Start date for filtering results, specified as a Unix timestamp | [optional] |
| endDate | Number | End date for filtering results, specified as a Unix timestamp | [optional] |
| dateType | String | Which time `startDate` and `endDate` filter on. - `captured`: when the Notecard created the event - `uploaded`: when Notehub received it | [optional] [default to 'captured'] |
| systemFilesOnly | Boolean | If true, return only events from system notefiles, such as `_session.qo` and `_health.qo`. | [optional] |
| files | String | Comma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`. | [optional] |
| format | String | Response format. - `json`: a JSON object with `events` - `csv`: CSV, with the columns in `selectFields` | [optional] [default to 'json'] |
| serialNumber | [String] | Serial number to filter by. Repeat for more than one. | [optional] |
| sessionUID | [String] | SessionUID to filter by. Repeat for more than one. | [optional] |
| eventUID | [String] | EventUID to filter by. Repeat for more than one. | [optional] |
| selectFields | String | Comma-separated event fields to return, e.g. `device,when,body.temp`. Also sets the CSV columns. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, text/csv
getRouteLogsByEvent
[RouteLog] getRouteLogsByEvent(projectOrProductUID, eventUID)
Get an event's route logs
Get the log of every attempt to send one event to each route, with the response status, body and duration. For a route's logs across events, use `GetRouteLogsByRoute`. Returns 404 if the event doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.EventApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let eventUID = "4506f411-dea6-44a0-9743-1130f57d7747"; // String | EventUID, e.g. `4506f411-dea6-44a0-9743-1130f57d7747`.
apiInstance.getRouteLogsByEvent(projectOrProductUID, eventUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| eventUID | String | EventUID, e.g. `4506f411-dea6-44a0-9743-1130f57d7747`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
Jobs API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| cancelJobRun | POST /v1/projects/{projectOrProductUID}/jobs/runs/{reportUID}/cancel | Cancel a job run |
| createJob | POST /v1/projects/{projectOrProductUID}/jobs | Create a batch job |
| deleteJob | DELETE /v1/projects/{projectOrProductUID}/jobs/{jobUID} | Delete a batch job |
| deleteJobRun | DELETE /v1/projects/{projectOrProductUID}/jobs/runs/{reportUID} | Delete a job run |
| getJob | GET /v1/projects/{projectOrProductUID}/jobs/{jobUID} | Get a batch job |
| getJobRun | GET /v1/projects/{projectOrProductUID}/jobs/runs/{reportUID} | Get a job run |
| getJobRuns | GET /v1/projects/{projectOrProductUID}/jobs/{jobUID}/runs | List a job's runs |
| getJobs | GET /v1/projects/{projectOrProductUID}/jobs | List batch jobs |
| runJob | POST /v1/projects/{projectOrProductUID}/jobs/{jobUID}/run | Run a batch job |
cancelJobRun
CancelJobRun200Response cancelJobRun(projectOrProductUID, reportUID)
Cancel a job run
Ask a running job to stop. `successful` is false if the run couldn't be cancelled. Requires the Owner or Developer role. Returns 404 if the run doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let reportUID = "my-reconciliation-job-1707654321000"; // String | Job run UID, as returned by `RunJob`.
apiInstance.cancelJobRun(projectOrProductUID, reportUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| reportUID | String | Job run UID, as returned by `RunJob`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
createJob
CreateJob201Response createJob(projectOrProductUID, name, jobDefinition)
Create a batch job
Create a batch job from a definition that selects devices and the changes to make to them. It doesn't run until `RunJob`. Each call creates a new job with its own UID; names needn't be unique. Requires the Owner or Developer role. Returns 400 without a `name`; an invalid definition returns 500.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let name = "name_example"; // String | Job name, shown in lists. It doesn't have to be unique.
let jobDefinition = new NotehubJs.JobDefinition(); // JobDefinition | The batch job definition
apiInstance.createJob(projectOrProductUID, name, jobDefinition).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| name | String | Job name, shown in lists. It doesn't have to be unique. | |
| jobDefinition | JobDefinition | The batch job definition |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
deleteJob
DeleteJob200Response deleteJob(projectOrProductUID, jobUID)
Delete a batch job
Delete a batch job. Requires the Owner or Developer role. Returns 404 if the job doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let jobUID = "my-reconciliation-job"; // String | Batch job UID, as returned by `CreateJob`.
apiInstance.deleteJob(projectOrProductUID, jobUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| jobUID | String | Batch job UID, as returned by `CreateJob`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
deleteJobRun
deleteJobRun(projectOrProductUID, reportUID)
Delete a job run
Delete a job run and its results. Deleting a run that doesn't exist also succeeds. Requires the Owner or Developer role.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let reportUID = "my-reconciliation-job-1707654321000"; // String | Job run UID, as returned by `RunJob`.
apiInstance.deleteJobRun(projectOrProductUID, reportUID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| reportUID | String | Job run UID, as returned by `RunJob`. |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getJob
JobDetail getJob(projectOrProductUID, jobUID)
Get a batch job
Get one batch job's definition and its latest run's status. Returns 404 if the job doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let jobUID = "my-reconciliation-job"; // String | Batch job UID, as returned by `CreateJob`.
apiInstance.getJob(projectOrProductUID, jobUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| jobUID | String | Batch job UID, as returned by `CreateJob`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getJobRun
JobRun getJobRun(projectOrProductUID, reportUID, opts)
Get a job run
Get a job run's status and, with `view=detail`, its full results. Returns 404 if the run doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let reportUID = "my-reconciliation-job-1707654321000"; // String | Job run UID, as returned by `RunJob`.
let opts = {
view: "'summary'", // String | Controls the level of detail returned: 'summary' returns metadata only, 'detail' returns the full result payload
};
apiInstance.getJobRun(projectOrProductUID, reportUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| reportUID | String | Job run UID, as returned by `RunJob`. | |
| view | String | Controls the level of detail returned: 'summary' returns metadata only, 'detail' returns the full result payload | [optional] [default to 'summary'] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getJobRuns
GetJobRuns200Response getJobRuns(projectOrProductUID, jobUID, opts)
List a job's runs
List a batch job's runs, optionally filtered by status or dry-run flag. Returns 404 if the job doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let jobUID = "my-reconciliation-job"; // String | Batch job UID, as returned by `CreateJob`.
let opts = {
status: "status_example", // String | Return only runs with this status.
dryRun: true, // Boolean | If set, return only dry runs (`true`) or only real runs (`false`).
};
apiInstance.getJobRuns(projectOrProductUID, jobUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| jobUID | String | Batch job UID, as returned by `CreateJob`. | |
| status | String | Return only runs with this status. | [optional] |
| dryRun | Boolean | If set, return only dry runs (`true`) or only real runs (`false`). | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getJobs
GetJobs200Response getJobs(projectOrProductUID)
List batch jobs
List a project's batch jobs with their latest run's status. A batch job applies changes, such as environment variables, to a selected set of devices.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getJobs(projectOrProductUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
runJob
RunJob200Response runJob(projectOrProductUID, jobUID, opts)
Run a batch job
Start a run of a batch job and return its run UID. The run continues in the background, and `GetJobRun` shows its progress. With `dry_run=true`, it reports what would change without changing anything. Requires the Owner or Developer role. Returns 404 if the job doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.JobsApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let jobUID = "my-reconciliation-job"; // String | Batch job UID, as returned by `CreateJob`.
let opts = {
dryRun: false, // Boolean | If true, report what the job would change without changing anything.
};
apiInstance.runJob(projectOrProductUID, jobUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| jobUID | String | Batch job UID, as returned by `CreateJob`. | |
| dryRun | Boolean | If true, report what the job would change without changing anything. | [optional] [default to false] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
Monitor API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| createMonitor | POST /v1/projects/{projectOrProductUID}/monitors | Create a monitor |
| deleteMonitor | DELETE /v1/projects/{projectOrProductUID}/monitors/{monitorUID} | Delete a monitor |
| getMonitor | GET /v1/projects/{projectOrProductUID}/monitors/{monitorUID} | Get a monitor |
| getMonitors | GET /v1/projects/{projectOrProductUID}/monitors | List monitors |
| updateMonitor | PUT /v1/projects/{projectOrProductUID}/monitors/{monitorUID} | Update a monitor |
createMonitor
Monitor createMonitor(projectOrProductUID, createMonitor)
Create a monitor
Create a monitor that raises an alert and notifies email, Slack or Twilio when its condition holds. It can watch an event value (`event`, the default), devices going quiet (`heartbeat`), or data usage (`usage`). Requires the Owner or Developer role. Returns 403 if the project's plan doesn't allow the monitor, and 400 for invalid settings.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.MonitorApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let createMonitor = new NotehubJs.CreateMonitor(); // CreateMonitor | Body or payload of monitor to be created
apiInstance.createMonitor(projectOrProductUID, createMonitor).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| createMonitor | CreateMonitor | Body or payload of monitor to be created |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
deleteMonitor
Monitor deleteMonitor(projectOrProductUID, monitorUID)
Delete a monitor
Delete a monitor so it stops raising alerts. Returns an empty monitor object. To pause it instead, set `disabled` with `UpdateMonitor`. Requires the Owner or Developer role. Returns 404 if the monitor never existed; deleting it again succeeds.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.MonitorApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let monitorUID = "monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad"; // String | MonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`.
apiInstance.deleteMonitor(projectOrProductUID, monitorUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| monitorUID | String | MonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getMonitor
Monitor getMonitor(projectOrProductUID, monitorUID)
Get a monitor
Get one monitor's settings and whether it's in alert. Slack and Twilio credentials in `alert_routes` come back as `(omitted)`. Returns 404 if the monitor never existed; a deleted monitor is still returned.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.MonitorApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let monitorUID = "monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad"; // String | MonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`.
apiInstance.getMonitor(projectOrProductUID, monitorUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| monitorUID | String | MonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getMonitors
[Monitor] getMonitors(projectOrProductUID)
List monitors
List a project's monitors with their settings and whether each is in alert. For the alerts they've raised, use `GetAlerts`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.MonitorApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getMonitors(projectOrProductUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
updateMonitor
Monitor updateMonitor(projectOrProductUID, monitorUID, monitor)
Update a monitor
Replace a monitor's settings with the whole monitor, as `GetMonitor` returns it. Omitted fields are cleared or reset, except `source_type`, `fleet_filter`, `notefile_filter`, `condition_type`, `aggregate_window` and `alert_routes`. Slack and Twilio credentials left as `(omitted)` are kept. Requires the Owner or Developer role. Returns 403 if the plan doesn't allow a new `source_type`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.MonitorApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let monitorUID = "monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad"; // String | MonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`.
let monitor = new NotehubJs.Monitor(); // Monitor | Body or payload of monitor to be created
apiInstance.updateMonitor(projectOrProductUID, monitorUID, monitor).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| monitorUID | String | MonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`. | |
| monitor | Monitor | Body or payload of monitor to be created |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
Organization API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| getOrganization | GET /v1/organizations/{organizationUID} | Get an organization |
| getOrganizationBalanceHistory | GET /v1/organizations/{organizationUID}/balance-history | Get an organization's daily balance |
| getOrganizations | GET /v1/organizations | List your organizations |
getOrganization
GetOrganization200Response getOrganization(organizationUID)
Get an organization
Get an organization's name, owner, contact email and current plan. The plan has its type, event capacity, billing period and remaining balance. For the daily history, use `GetOrganizationBalanceHistory`. Requires the `org_admin`, `billing_manager` or `org_support` role in the organization. Returns 403 if your membership is deactivated.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.OrganizationApi();
let organizationUID = "00000000-0000-0000-000000000001"; // String | Organization UID. List with `GetOrganizations`.
apiInstance.getOrganization(organizationUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| organizationUID | String | Organization UID. List with `GetOrganizations`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getOrganizationBalanceHistory
GetOrganizationBalanceHistory200Response getOrganizationBalanceHistory(organizationUID, opts)
Get an organization's daily balance
Get an organization's events used and remaining event capacity for each day. The range is `startDate` to `endDate`, which default to the start of the billing period and today. Requires the `org_admin`, `billing_manager` or `org_support` role in the organization. Returns 400 if `startDate` is after `endDate`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.OrganizationApi();
let organizationUID = "00000000-0000-0000-000000000001"; // String | Organization UID. List with `GetOrganizations`.
let opts = {
startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
};
apiInstance.getOrganizationBalanceHistory(organizationUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| organizationUID | String | Organization UID. List with `GetOrganizations`. | |
| startDate | Number | Start date for filtering results, specified as a Unix timestamp | [optional] |
| endDate | Number | End date for filtering results, specified as a Unix timestamp | [optional] |
Return type
GetOrganizationBalanceHistory200Response
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getOrganizations
GetOrganizations200Response getOrganizations()
List your organizations
List the organizations you belong to, with your role in each. A scoped token gets an empty list. Returns 401 if your email address isn't verified.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.OrganizationApi();
apiInstance.getOrganizations().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
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
Project API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| addDeviceToFleets | PUT /v1/projects/{projectOrProductUID}/devices/{deviceUID}/fleets | Add a device to fleets |
| cloneProject | POST /v1/projects/{projectOrProductUID}/clone | Clone a project |
| createFleet | POST /v1/projects/{projectOrProductUID}/fleets | Create a fleet |
| createProduct | POST /v1/projects/{projectOrProductUID}/products | Create a product |
| createProject | POST /v1/projects | Create a project |
| createProjectSecret | POST /v1/projects/{projectOrProductUID}/secrets | Create a project secret |
| deleteDeviceFromFleets | DELETE /v1/projects/{projectOrProductUID}/devices/{deviceUID}/fleets | Remove a device from fleets |
| deleteFirmware | DELETE /v1/projects/{projectOrProductUID}/firmware/{firmwareType}/{filename} | Delete host firmware |
| deleteFleet | DELETE /v1/projects/{projectOrProductUID}/fleets/{fleetUID} | Delete a fleet |
| deleteFleetEnvironmentVariable | DELETE /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_variables/{key} | Delete a fleet environment variable |
| deleteProduct | DELETE /v1/projects/{projectOrProductUID}/products/{productUID} | Delete a product |
| deleteProject | DELETE /v1/projects/{projectOrProductUID} | Delete a project |
| deleteProjectEnvironmentVariable | DELETE /v1/projects/{projectOrProductUID}/environment_variables/{key} | Delete a project environment variable |
| deleteProjectSecret | DELETE /v1/projects/{projectOrProductUID}/secrets/{secretName} | Delete a project secret |
| disableGlobalEventTransformation | POST /v1/projects/{projectOrProductUID}/global-transformation/disable | Disable the global event transformation |
| downloadFirmware | GET /v1/projects/{projectOrProductUID}/firmware/{firmwareType}/{filename} | Download host firmware |
| enableGlobalEventTransformation | POST /v1/projects/{projectOrProductUID}/global-transformation/enable | Enable the global event transformation |
| getAWSRoleConfig | GET /v1/projects/{projectOrProductUID}/aws-role-config | Get AWS role configuration for role-based authentication |
| getDeviceDfuHistory | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/dfu/{firmwareType}/history | Get a device's firmware update history |
| getDeviceDfuStatus | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/dfu/{firmwareType}/status | Get a device's firmware update status |
| getDeviceFleets | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/fleets | List a device's fleets |
| getDevicesDfuHistory | GET /v1/projects/{projectOrProductUID}/dfu/{firmwareType}/history | List devices' firmware update history |
| getDevicesDfuStatus | GET /v1/projects/{projectOrProductUID}/dfu/{firmwareType}/status | List devices' firmware status |
| getFirmwareInfo | GET /v1/projects/{projectOrProductUID}/firmware | List firmware |
| getFleet | GET /v1/projects/{projectOrProductUID}/fleets/{fleetUID} | Get a fleet |
| getFleetEnvironmentHierarchy | GET /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_hierarchy | Get a fleet's environment hierarchy |
| getFleetEnvironmentVariables | GET /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_variables | Get fleet environment variables |
| getFleets | GET /v1/projects/{projectOrProductUID}/fleets | List fleets |
| getNotefileSchemas | GET /v1/projects/{projectOrProductUID}/schemas | List Notefile schemas |
| getProducts | GET /v1/projects/{projectOrProductUID}/products | List a project's products |
| getProject | GET /v1/projects/{projectOrProductUID} | Get a project |
| getProjectByProduct | GET /v1/products/{productUID}/project | Get the project for a ProductUID |
| getProjectEnvironmentHierarchy | GET /v1/projects/{projectOrProductUID}/environment_hierarchy | Get the project environment hierarchy |
| getProjectEnvironmentVariables | GET /v1/projects/{projectOrProductUID}/environment_variables | Get project environment variables |
| getProjectMembers | GET /v1/projects/{projectOrProductUID}/members | List project members |
| getProjectSecrets | GET /v1/projects/{projectOrProductUID}/secrets | List project secrets |
| getProjects | GET /v1/projects | List projects |
| performDfuAction | POST /v1/projects/{projectOrProductUID}/dfu/{firmwareType}/{action} | Start or cancel firmware updates |
| setFleetEnvironmentVariables | PUT /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_variables | Set fleet environment variables |
| setGlobalEventTransformation | POST /v1/projects/{projectOrProductUID}/global-transformation | Set the global event transformation |
| setProjectEnvironmentVariables | PUT /v1/projects/{projectOrProductUID}/environment_variables | Set project environment variables |
| updateFirmware | POST /v1/projects/{projectOrProductUID}/firmware/{firmwareType}/{filename} | Update host firmware metadata |
| updateFleet | PUT /v1/projects/{projectOrProductUID}/fleets/{fleetUID} | Update a fleet |
| updateProjectSecret | PUT /v1/projects/{projectOrProductUID}/secrets/{secretName} | Update a project secret |
| uploadFirmware | PUT /v1/projects/{projectOrProductUID}/firmware/{firmwareType}/{filename} | Upload firmware |
addDeviceToFleets
GetDeviceFleets200Response addDeviceToFleets(projectOrProductUID, deviceUID, addDeviceToFleetsRequest)
Add a device to fleets
Add a device to one or more fleets, keeping the fleets it's already in, and return all its fleets. Fleets it's already in are skipped, so a retry is safe. Requires the Owner or Developer role. Returns 400 if a fleet doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let addDeviceToFleetsRequest = new NotehubJs.AddDeviceToFleetsRequest(); // AddDeviceToFleetsRequest | The fleets to add the device to.
apiInstance
.addDeviceToFleets(projectOrProductUID, deviceUID, addDeviceToFleetsRequest)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| addDeviceToFleetsRequest | AddDeviceToFleetsRequest | The fleets to add the device to. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
cloneProject
Project cloneProject(projectOrProductUID, cloneProjectRequest)
Clone a project
Create a new project as a copy of this one. Settings, environment variables, transformation, fleets, routes and host firmware are copied; devices, products and members aren't. Copied fleets get new FleetUIDs. Requires the Owner role (400 otherwise), a verified email address (401 otherwise), and permission to create projects in the target organization (403 otherwise).
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let cloneProjectRequest = new NotehubJs.CloneProjectRequest(); // CloneProjectRequest | The new project's name and organization, and what to leave out of the copy.
apiInstance.cloneProject(projectOrProductUID, cloneProjectRequest).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| cloneProjectRequest | CloneProjectRequest | The new project's name and organization, and what to leave out of the copy. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
createFleet
Fleet createFleet(projectOrProductUID, createFleetRequest)
Create a fleet
Create a fleet in the project. Connectivity assurance is on unless `connectivity_assurance.enabled` is `false`. A second call creates another fleet. Requires the Owner or Developer role. Returns 400 if `label` is missing or empty.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let createFleetRequest = new NotehubJs.CreateFleetRequest(); // CreateFleetRequest | The new fleet's name and settings.
apiInstance.createFleet(projectOrProductUID, createFleetRequest).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| createFleetRequest | CreateFleetRequest | The new fleet's name and settings. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
createProduct
Product createProduct(projectOrProductUID, createProductRequest)
Create a product
Add a ProductUID to the project, formed from the caller's reversed email and `product_uid`. For `jane@acme.com` and `sensors` it is `com.acme.jane:sensors`. Requires the Owner or Developer role and a verified email address (400 otherwise). Returns 404 if an `auto_provision_fleets` entry isn't a fleet in this project, and 500 if `product_uid` is invalid or already taken.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let createProductRequest = new NotehubJs.CreateProductRequest(); // CreateProductRequest | The new product's UID suffix, name and provisioning settings.
apiInstance.createProduct(projectOrProductUID, createProductRequest).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| createProductRequest | CreateProductRequest | The new product's UID suffix, name and provisioning settings. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
createProject
Project createProject(createProjectRequest)
Create a project
Create a project in an organization, with one default fleet, no products, and the caller as its Owner. A second call creates another project. Requires a verified email address (401 otherwise) and permission to create projects in the organization (403 otherwise).
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let createProjectRequest = new NotehubJs.CreateProjectRequest(); // CreateProjectRequest | The new project's name and organization.
apiInstance.createProject(createProjectRequest).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| createProjectRequest | CreateProjectRequest | The new project's name and organization. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
createProjectSecret
ProjectSecret createProjectSecret(projectOrProductUID, createProjectSecretRequest)
Create a project secret
Store a secret value that routes and alerts can reference as `[$$name]` without exposing it. The value can't be read back. Requires the Owner or Developer role. Returns 409 if the name is taken, and 400 if it's invalid.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let createProjectSecretRequest = new NotehubJs.CreateProjectSecretRequest(); // CreateProjectSecretRequest |
apiInstance
.createProjectSecret(projectOrProductUID, createProjectSecretRequest)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| createProjectSecretRequest | CreateProjectSecretRequest |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
deleteDeviceFromFleets
GetDeviceFleets200Response deleteDeviceFromFleets(projectOrProductUID, deviceUID, deleteDeviceFromFleetsRequest)
Remove a device from fleets
Remove a device from one or more fleets and return the fleets it's still in. Fleets it isn't in are ignored, so a retry is safe. Requires the Owner or Developer role.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let deleteDeviceFromFleetsRequest =
new NotehubJs.DeleteDeviceFromFleetsRequest(); // DeleteDeviceFromFleetsRequest | The fleets to remove the device from.
apiInstance
.deleteDeviceFromFleets(
projectOrProductUID,
deviceUID,
deleteDeviceFromFleetsRequest
)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| deleteDeviceFromFleetsRequest | DeleteDeviceFromFleetsRequest | The fleets to remove the device from. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
deleteFirmware
deleteFirmware(projectOrProductUID, firmwareType, filename)
Delete host firmware
Delete a host firmware file by its stored filename, including its `$` timestamp suffix. Notecard firmware can't be deleted. Requires the Owner or Developer role. Returns 404 if the file doesn't exist, and 400 for a sub-project, whose parent manages host firmware.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String |
let filename = "filename_example"; // String |
apiInstance.deleteFirmware(projectOrProductUID, firmwareType, filename).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| firmwareType | String | ||
| filename | String |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
deleteFleet
deleteFleet(projectOrProductUID, fleetUID)
Delete a fleet
Delete a fleet and remove it from all its devices. The devices stay in the project; the fleet's environment variables are deleted. To remove one device from a fleet, use `DeleteDeviceFromFleets`. Requires the Owner or Developer role. Returns 400 if the fleet does not exist, including on a retry.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
apiInstance.deleteFleet(projectOrProductUID, fleetUID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| fleetUID | String |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
deleteFleetEnvironmentVariable
EnvironmentVariables deleteFleetEnvironmentVariable(projectOrProductUID, fleetUID, key)
Delete a fleet environment variable
Delete one fleet environment variable and return the ones left. Requires the Owner or Developer role. Returns 404 if the fleet or the variable doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let key = "key_example"; // String | Name of the environment variable to delete.
apiInstance
.deleteFleetEnvironmentVariable(projectOrProductUID, fleetUID, key)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| fleetUID | String | ||
| key | String | Name of the environment variable to delete. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
deleteProduct
deleteProduct(projectOrProductUID, productUID)
Delete a product
Remove a ProductUID from the project. Accepts the UID with or without the `product:` prefix. Requires the Owner or Developer role. Returns 404 if the project has no such ProductUID.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let productUID = "com.blues.bridge:sensors"; // String |
apiInstance.deleteProduct(projectOrProductUID, productUID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| productUID | String |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
deleteProject
deleteProject(projectOrProductUID)
Delete a project
Delete a project, its ProductUIDs, and every member's access to it. Can't be undone through the API. Requires the Owner or Developer role. Returns 200 with no body.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.deleteProject(projectOrProductUID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
deleteProjectEnvironmentVariable
EnvironmentVariables deleteProjectEnvironmentVariable(projectOrProductUID, key)
Delete a project environment variable
Delete one project environment variable and return the ones left. Deleting a variable that doesn't exist still succeeds. Requires the Owner or Developer role.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let key = "key_example"; // String | Name of the environment variable to delete.
apiInstance.deleteProjectEnvironmentVariable(projectOrProductUID, key).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| key | String | Name of the environment variable to delete. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
deleteProjectSecret
deleteProjectSecret(projectOrProductUID, secretName)
Delete a project secret
Delete a project secret. Routes and alerts that still reference it can no longer resolve it. Requires the Owner or Developer role. Returns 404 if the secret doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let secretName = "secretName_example"; // String | Name of the secret, as listed by `GetProjectSecrets`.
apiInstance.deleteProjectSecret(projectOrProductUID, secretName).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| secretName | String | Name of the secret, as listed by `GetProjectSecrets`. |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
disableGlobalEventTransformation
disableGlobalEventTransformation(projectOrProductUID)
Disable the global event transformation
Stop applying the project's global event transformation to new events. The expression is kept, so `EnableGlobalEventTransformation` can turn it back on. Requires the Owner or Developer role. Returns 400 for a sub-project, whose parent's transformation applies.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.disableGlobalEventTransformation(projectOrProductUID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
downloadFirmware
File downloadFirmware(projectOrProductUID, firmwareType, filename)
Download host firmware
Download a host firmware binary by its stored filename, including its `$` timestamp suffix. Notecard firmware can't be downloaded (400). Requires the Owner or Developer role. Returns 404 if the file doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String | Which firmware: `host` (the host microcontroller's) or `notecard`.
let filename = "filename_example"; // String |
apiInstance.downloadFirmware(projectOrProductUID, firmwareType, filename).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| firmwareType | String | Which firmware: `host` (the host microcontroller's) or `notecard`. | |
| filename | String |
Return type
File
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/octet-stream, application/json
enableGlobalEventTransformation
enableGlobalEventTransformation(projectOrProductUID)
Enable the global event transformation
Resume applying the project's global event transformation to new events, without changing the expression. Undoes `DisableGlobalEventTransformation`. Requires the Owner or Developer role. Returns 400 for a sub-project, whose parent's transformation applies.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.enableGlobalEventTransformation(projectOrProductUID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getAWSRoleConfig
AWSRoleConfig getAWSRoleConfig(projectOrProductUID)
Get AWS role configuration for role-based authentication
Get the AWS account ID and External ID for the IAM role trust policy used by AWS routes with role-based authentication. The External ID is created on the first call and stays the same after that.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getAWSRoleConfig(projectOrProductUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDeviceDfuHistory
DeviceDfuHistory getDeviceDfuHistory(projectOrProductUID, deviceUID, firmwareType)
Get a device's firmware update history
Get a device's current host or Notecard firmware version and every firmware update requested for it, newest first. For just the latest update, use `GetDeviceDfuStatus`. Returns 400 if the device isn't in the project.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let firmwareType = "firmwareType_example"; // String | Which firmware: `host` (the host microcontroller's) or `notecard`.
apiInstance
.getDeviceDfuHistory(projectOrProductUID, deviceUID, firmwareType)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| firmwareType | String | Which firmware: `host` (the host microcontroller's) or `notecard`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDeviceDfuStatus
DeviceDfuStatus getDeviceDfuStatus(projectOrProductUID, deviceUID, firmwareType)
Get a device's firmware update status
Get a device's current host or Notecard firmware version and its latest firmware update. Includes whether an update is in progress. For every past update, use `GetDeviceDfuHistory`. Returns 400 if the device isn't in the project.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
let firmwareType = "firmwareType_example"; // String | Which firmware: `host` (the host microcontroller's) or `notecard`.
apiInstance
.getDeviceDfuStatus(projectOrProductUID, deviceUID, firmwareType)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String | ||
| firmwareType | String | Which firmware: `host` (the host microcontroller's) or `notecard`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDeviceFleets
GetDeviceFleets200Response getDeviceFleets(projectOrProductUID, deviceUID)
List a device's fleets
List the fleets a device belongs to, with only each fleet's UID, label and creation time. For a fleet's full details use `GetFleet`. Returns 404 if the device isn't in the project.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "dev:000000000000000"; // String |
apiInstance.getDeviceFleets(projectOrProductUID, deviceUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| deviceUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDevicesDfuHistory
DeviceDfuHistoryPage getDevicesDfuHistory(projectOrProductUID, firmwareType, opts)
List devices' firmware update history
List every host or Notecard firmware update requested for each matching device, newest first. Includes each device's current firmware version. For just the latest update, use `GetDevicesDfuStatus`. Paginated, by page or `cursor`. With a `cursor`, changes made through fleet or project firmware settings don't appear until the device itself is next updated.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String | Which firmware: `host` (the host microcontroller's) or `notecard`.
let opts = {
pageSize: 1000, // Number |
pageNum: 1, // Number |
cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
sortBy: "'captured'", // String |
sortOrder: "'asc'", // String |
deviceUID: ["null"], // [String] | A DeviceUID.
tag: ["null"], // [String] | Tag filter. Matches the whole tag, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. For example, `51*` matches tags starting with `51`.
serialNumber: ["null"], // [String] | Serial number filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
fleetUID: "fleetUID_example", // String |
notecardFirmware: ["null"], // [String] | Firmware version filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
location: ["null"], // [String] | Location filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
hostFirmware: ["null"], // [String] | Host firmware filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
productUID: ["null"], // [String] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
sku: ["null"], // [String] | SKU filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
};
apiInstance.getDevicesDfuHistory(projectOrProductUID, firmwareType, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| firmwareType | String | Which firmware: `host` (the host microcontroller's) or `notecard`. | |
| pageSize | Number | [optional] [default to 1000] | |
| pageNum | Number | [optional] [default to 1] | |
| cursor | String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| sortBy | String | [optional] [default to 'captured'] | |
| sortOrder | String | [optional] [default to 'asc'] | |
| deviceUID | [String] | A DeviceUID. | [optional] |
| tag | [String] | Tag filter. Matches the whole tag, case-insensitive. Use `` as a wildcard and `\` to match a literal ``; all other characters, including `%` and `_`, match literally. For example, `51` matches tags starting with `51`. | [optional] |
| serialNumber | [String] | Serial number filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| fleetUID | String | [optional] | |
| notecardFirmware | [String] | Firmware version filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| location | [String] | Location filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| hostFirmware | [String] | Host firmware filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| productUID | [String] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| sku | [String] | SKU filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDevicesDfuStatus
DeviceDfuStatusPage getDevicesDfuStatus(projectOrProductUID, firmwareType, opts)
List devices' firmware status
List the host or Notecard firmware version each matching device runs now, with its latest firmware update. Use this to find which firmware devices run. Paginated, by page or `cursor`. With a `cursor`, changes made through fleet or project firmware settings don't appear until the device itself is next updated.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String | Which firmware: `host` (the host microcontroller's) or `notecard`.
let opts = {
pageSize: 1000, // Number |
pageNum: 1, // Number |
cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
sortBy: "'captured'", // String |
sortOrder: "'asc'", // String |
deviceUID: ["null"], // [String] | A DeviceUID.
tag: ["null"], // [String] | Tag filter. Matches the whole tag, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. For example, `51*` matches tags starting with `51`.
serialNumber: ["null"], // [String] | Serial number filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
fleetUID: "fleetUID_example", // String |
notecardFirmware: ["null"], // [String] | Firmware version filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
location: ["null"], // [String] | Location filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
hostFirmware: ["null"], // [String] | Host firmware filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
productUID: ["null"], // [String] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
sku: ["null"], // [String] | SKU filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
};
apiInstance.getDevicesDfuStatus(projectOrProductUID, firmwareType, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| firmwareType | String | Which firmware: `host` (the host microcontroller's) or `notecard`. | |
| pageSize | Number | [optional] [default to 1000] | |
| pageNum | Number | [optional] [default to 1] | |
| cursor | String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| sortBy | String | [optional] [default to 'captured'] | |
| sortOrder | String | [optional] [default to 'asc'] | |
| deviceUID | [String] | A DeviceUID. | [optional] |
| tag | [String] | Tag filter. Matches the whole tag, case-insensitive. Use `` as a wildcard and `\` to match a literal ``; all other characters, including `%` and `_`, match literally. For example, `51` matches tags starting with `51`. | [optional] |
| serialNumber | [String] | Serial number filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| fleetUID | String | [optional] | |
| notecardFirmware | [String] | Firmware version filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| location | [String] | Location filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| hostFirmware | [String] | Host firmware filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| productUID | [String] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| sku | [String] | SKU filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getFirmwareInfo
[FirmwareInfo] getFirmwareInfo(projectOrProductUID, opts)
List firmware
List the host firmware uploaded to the project and the Notecard firmware available to it. Text filters match substrings, and unpublished Notecard builds are left out unless `unpublished` is `true`. Not paginated.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
product: "product_example", // String | Only firmware whose product contains this text.
firmwareType: "firmwareType_example", // String | Only list `host` or `notecard` firmware. Omit for both.
version: "version_example", // String | Only firmware whose version contains this text.
target: "target_example", // String | Only firmware whose target contains this text.
filename: "notecard-7.2.2.16518$20240410043100.bin", // String | Only firmware whose stored filename contains this text.
md5: "md5_example", // String | Only firmware whose MD5 hash contains this text.
unpublished: true, // Boolean | If `true`, also list unpublished Notecard firmware.
sortBy: "'created'", // String | Field to sort by
sortOrder: "'desc'", // String | Sort order (asc for ascending, desc for descending)
};
apiInstance.getFirmwareInfo(projectOrProductUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| product | String | Only firmware whose product contains this text. | [optional] |
| firmwareType | String | Only list `host` or `notecard` firmware. Omit for both. | [optional] |
| version | String | Only firmware whose version contains this text. | [optional] |
| target | String | Only firmware whose target contains this text. | [optional] |
| filename | String | Only firmware whose stored filename contains this text. | [optional] |
| md5 | String | Only firmware whose MD5 hash contains this text. | [optional] |
| unpublished | Boolean | If `true`, also list unpublished Notecard firmware. | [optional] |
| sortBy | String | Field to sort by | [optional] [default to 'created'] |
| sortOrder | String | Sort order (asc for ascending, desc for descending) | [optional] [default to 'desc'] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getFleet
Fleet getFleet(projectOrProductUID, fleetUID)
Get a fleet
Get one fleet's label, smart rule, watchdog and environment variables. Doesn't include `smart_rule_enabled`. Returns 404 if the fleet doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
apiInstance.getFleet(projectOrProductUID, fleetUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| fleetUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getFleetEnvironmentHierarchy
EnvTreeJsonNode getFleetEnvironmentHierarchy(projectOrProductUID, fleetUID)
Get a fleet's environment hierarchy
Get a fleet's environment variables and the project variables it inherits, as a tree. Each variable has its precedence and whether it is used or overridden. Returns 500 if the fleet doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
apiInstance.getFleetEnvironmentHierarchy(projectOrProductUID, fleetUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| fleetUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getFleetEnvironmentVariables
EnvironmentVariables getFleetEnvironmentVariables(projectOrProductUID, fleetUID)
Get fleet environment variables
Get the environment variables set on a fleet, with their notes. They override project variables, and device variables override them. Returns 404 if the fleet doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
apiInstance.getFleetEnvironmentVariables(projectOrProductUID, fleetUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| fleetUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getFleets
GetDeviceFleets200Response getFleets(projectOrProductUID)
List fleets
List the project's fleets with each one's label, smart rule, watchdog and environment variables. Doesn't include `smart_rule_enabled`. Not paginated.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getFleets(projectOrProductUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getNotefileSchemas
[NotefileSchema] getNotefileSchemas(projectOrProductUID)
List Notefile schemas
List the project's Notefiles, each with the event `body` fields Notehub has seen in it and their JSON types. Inferred from received events.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getNotefileSchemas(projectOrProductUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getProducts
GetProducts200Response getProducts(projectOrProductUID)
List a project's products
List the project's ProductUIDs, each with its label, auto-provision fleets, and whether new devices start disabled. UIDs here include the `product:` prefix; `CreateProduct` returns them without it. Not paginated.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProducts(projectOrProductUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getProject
Project getProject(projectOrProductUID)
Get a project
Get a project's label, creation time, contacts, and the caller's `role` in it. Accepts a ProductUID in place of the ProjectUID.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProject(projectOrProductUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getProjectByProduct
Project getProjectByProduct(productUID)
Get the project for a ProductUID
Get the project that a ProductUID belongs to. Returns the same object as `GetProject`, which also accepts a ProductUID in place of a ProjectUID.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let productUID = com.blues.airnote; // String | ProductUID, e.g. `com.blues.airnote`, with or without the `product:` prefix.
apiInstance.getProjectByProduct(productUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| productUID | String | ProductUID, e.g. `com.blues.airnote`, with or without the `product:` prefix. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getProjectEnvironmentHierarchy
EnvTreeJsonNode getProjectEnvironmentHierarchy(projectOrProductUID)
Get the project environment hierarchy
Get the project's environment variables as a one-node environment hierarchy tree. The fleet and device hierarchy operations use the same format; for plain key/value pairs, use `GetProjectEnvironmentVariables`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectEnvironmentHierarchy(projectOrProductUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getProjectEnvironmentVariables
EnvironmentVariables getProjectEnvironmentVariables(projectOrProductUID)
Get project environment variables
Get the environment variables set on the project, with their notes. Fleet and device variables override these; for what a device actually sees, use `GetDeviceEnvironmentVariables`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectEnvironmentVariables(projectOrProductUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getProjectMembers
GetProjectMembers200Response getProjectMembers(projectOrProductUID)
List project members
List the project's members with each one's name and role. Emails are filled in only when the caller is an Owner. Not paginated.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectMembers(projectOrProductUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getProjectSecrets
GetProjectSecretsResponse getProjectSecrets(projectOrProductUID)
List project secrets
List the project's secrets by name, with who created and last changed each one and when. Values are never returned.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectSecrets(projectOrProductUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getProjects
GetProjects200Response getProjects()
List projects
List every project the caller is a member of, with the caller's `role` in each. Not paginated.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
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
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
performDfuAction
performDfuAction(projectOrProductUID, firmwareType, action, opts)
Start or cancel firmware updates
Start or cancel a host or Notecard firmware update on every device matching the filters. With no filters, that is every device in the project. `update` sets each device's `_fw` or `_fwc` variable to `filename`. Requires the Owner or Developer role. `update` returns 404 if the file isn't found, and can return 400 if a matching device already has an update in progress.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String | Which firmware: `host` (the host microcontroller's) or `notecard`.
let action = "action_example"; // String | - `update`: start updating to the firmware in `filename` - `cancel`: cancel any update in progress
let opts = {
deviceUID: ["null"], // [String] | A DeviceUID.
tag: ["null"], // [String] | Tag filter. Matches the whole tag, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. For example, `51*` matches tags starting with `51`.
serialNumber: ["null"], // [String] | Serial number filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
fleetUID: "fleetUID_example", // String |
notecardFirmware: ["null"], // [String] | Firmware version filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
location: ["null"], // [String] | Location filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
hostFirmware: ["null"], // [String] | Host firmware filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
productUID: ["null"], // [String] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
sku: ["null"], // [String] | SKU filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally.
dfuActionRequest: new NotehubJs.DfuActionRequest(), // DfuActionRequest | Which firmware in the case of an update action
};
apiInstance
.performDfuAction(projectOrProductUID, firmwareType, action, opts)
.then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| firmwareType | String | Which firmware: `host` (the host microcontroller's) or `notecard`. | |
| action | String | - `update`: start updating to the firmware in `filename` - `cancel`: cancel any update in progress | |
| deviceUID | [String] | A DeviceUID. | [optional] |
| tag | [String] | Tag filter. Matches the whole tag, case-insensitive. Use `` as a wildcard and `\` to match a literal ``; all other characters, including `%` and `_`, match literally. For example, `51` matches tags starting with `51`. | [optional] |
| serialNumber | [String] | Serial number filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| fleetUID | String | [optional] | |
| notecardFirmware | [String] | Firmware version filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| location | [String] | Location filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| hostFirmware | [String] | Host firmware filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| productUID | [String] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| sku | [String] | SKU filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| dfuActionRequest | DfuActionRequest | Which firmware in the case of an update action | [optional] |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
setFleetEnvironmentVariables
EnvironmentVariables setFleetEnvironmentVariables(projectOrProductUID, fleetUID, environmentVariables)
Set fleet environment variables
Add or change a fleet's environment variables; variables you don't send keep their values. A value of `""` or `-` deletes that variable. Setting `_fw`, `_fwc` or `_fwm` starts a host, Notecard or modem firmware update. Requires the Owner or Developer role. Returns 404 if the fleet doesn't exist, and 400 if a note's key isn't a variable.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let environmentVariables = new NotehubJs.EnvironmentVariables(); // EnvironmentVariables | The variables to add or change, and optional notes.
apiInstance
.setFleetEnvironmentVariables(
projectOrProductUID,
fleetUID,
environmentVariables
)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| fleetUID | String | ||
| environmentVariables | EnvironmentVariables | The variables to add or change, and optional notes. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
setGlobalEventTransformation
setGlobalEventTransformation(projectOrProductUID, body)
Set the global event transformation
Set the project's JSONata expression that rewrites each new event before it's stored and routed. It can change `body`, `payload`, `details`, `file` and `note`, or drop the event with `$doNotRoute()`; an event it fails on is kept with `error` set. Doesn't enable or disable it. Requires the Owner or Developer role. Returns 400 if it doesn't compile, or for a sub-project, which uses its parent's.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let body = "body_example"; // String | JSONata expression as plain text. An empty body clears the transformation.
apiInstance.setGlobalEventTransformation(projectOrProductUID, body).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| body | String | JSONata expression as plain text. An empty body clears the transformation. |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: text/plain
- Accept: application/json
setProjectEnvironmentVariables
EnvironmentVariables setProjectEnvironmentVariables(projectOrProductUID, opts)
Set project environment variables
Add or change project environment variables; variables you don't send keep their values. A value of `""` or `-` deletes that variable. Setting `_fw`, `_fwc` or `_fwm` starts a host, Notecard or modem firmware update. Requires the Owner or Developer role. Returns 400 if a note's key isn't a variable.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
environmentVariables: new NotehubJs.EnvironmentVariables(), // EnvironmentVariables |
};
apiInstance.setProjectEnvironmentVariables(projectOrProductUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| environmentVariables | EnvironmentVariables | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
updateFirmware
FirmwareInfo updateFirmware(projectOrProductUID, firmwareType, filename, updateHostFirmwareRequest)
Update host firmware metadata
Change a host firmware file's `version`, `notes` or `info`; fields you leave out or send empty keep their values. Use the stored filename, including its `$` timestamp suffix. Requires the Owner or Developer role. Returns 400 for a sub-project, whose parent manages host firmware, and 404 if the file doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String |
let filename = "filename_example"; // String |
let updateHostFirmwareRequest = new NotehubJs.UpdateHostFirmwareRequest(); // UpdateHostFirmwareRequest | Firmware metadata fields to update. All fields are optional; only provided fields will be updated.
apiInstance
.updateFirmware(
projectOrProductUID,
firmwareType,
filename,
updateHostFirmwareRequest
)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| firmwareType | String | ||
| filename | String | ||
| updateHostFirmwareRequest | UpdateHostFirmwareRequest | Firmware metadata fields to update. All fields are optional; only provided fields will be updated. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
updateFleet
Fleet updateFleet(projectOrProductUID, fleetUID, updateFleetRequest)
Update a fleet
Change a fleet's label, smart rule, watchdog or connectivity assurance, or add and remove devices. Always send `smart_rule_enabled`; leaving it out turns the smart rule off. Empty `label` or `smart_rule` keeps the current value; `-` clears `smart_rule`. Requires the Owner or Developer role. Returns 400 for an unknown fleet or `label` of `-`, and for a bad DeviceUID after saving the other changes.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let updateFleetRequest = new NotehubJs.UpdateFleetRequest(); // UpdateFleetRequest | The fields to change. Fields left out keep their values, except `smart_rule_enabled`.
apiInstance.updateFleet(projectOrProductUID, fleetUID, updateFleetRequest).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| fleetUID | String | ||
| updateFleetRequest | UpdateFleetRequest | The fields to change. Fields left out keep their values, except `smart_rule_enabled`. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
updateProjectSecret
ProjectSecret updateProjectSecret(projectOrProductUID, secretName, updateProjectSecretRequest)
Update a project secret
Replace the value of an existing project secret. Routes and alerts that reference it use the new value from then on. Requires the Owner or Developer role. Returns 404 if the secret doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let secretName = "secretName_example"; // String | Name of the secret, as listed by `GetProjectSecrets`.
let updateProjectSecretRequest = new NotehubJs.UpdateProjectSecretRequest(); // UpdateProjectSecretRequest |
apiInstance
.updateProjectSecret(
projectOrProductUID,
secretName,
updateProjectSecretRequest
)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| secretName | String | Name of the secret, as listed by `GetProjectSecrets`. | |
| updateProjectSecretRequest | UpdateProjectSecretRequest |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
uploadFirmware
FirmwareInfo uploadFirmware(projectOrProductUID, firmwareType, filename, body, opts)
Upload firmware
Upload a host or Notecard firmware binary. Notehub usually adds a timestamp to `filename`; use the returned `filename` from then on. Requires the Owner or Developer role. Returns 400 for host firmware on a sub-project, whose parent manages it, and 500 for a wrong file type or a file over the limit: 1.5 MB for host firmware, 2 MB for `notecard-s3-*` and 1 MB for other Notecard firmware.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.ProjectApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let firmwareType = "firmwareType_example"; // String | Which firmware: `host` (the host microcontroller's) or `notecard`.
let filename = "filename_example"; // String | Name to store the file under. Notehub adds `$` and a timestamp before the extension, except for a Notecard firmware name that already contains `$`.
let body = "/path/to/file"; // File | contents of the firmware binary
let opts = {
version: "version_example", // String | Firmware version (optional). If not provided, the version will be extracted from firmware binary if available, otherwise left empty
notes: "notes_example", // String | Optional notes describing what's different about this firmware version
};
apiInstance
.uploadFirmware(projectOrProductUID, firmwareType, filename, body, opts)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| firmwareType | String | Which firmware: `host` (the host microcontroller's) or `notecard`. | |
| filename | String | Name to store the file under. Notehub adds `$` and a timestamp before the extension, except for a Notecard firmware name that already contains `$`. | |
| body | File | contents of the firmware binary | |
| version | String | Firmware version (optional). If not provided, the version will be extracted from firmware binary if available, otherwise left empty | [optional] |
| notes | String | Optional notes describing what's different about this firmware version | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: application/octet-stream
- Accept: application/json
Route API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| createRoute | POST /v1/projects/{projectOrProductUID}/routes | Create a route |
| deleteRoute | DELETE /v1/projects/{projectOrProductUID}/routes/{routeUID} | Delete a route |
| getRoute | GET /v1/projects/{projectOrProductUID}/routes/{routeUID} | Get a route |
| getRouteLogsByRoute | GET /v1/projects/{projectOrProductUID}/routes/{routeUID}/route-logs | List a route's logs |
| getRoutes | GET /v1/projects/{projectOrProductUID}/routes | List routes |
| updateRoute | PUT /v1/projects/{projectOrProductUID}/routes/{routeUID} | Update a route |
createRoute
NotehubRoute createRoute(projectOrProductUID, notehubRoute)
Create a route
Create a route that sends a project's events to a destination such as a URL, an MQTT broker or a cloud service. Set `type` and fill in the object it names. Omit `fleets` to send every fleet's events. Unknown FleetUIDs are ignored, so `fleets: []` or a list of only unknown UIDs gives a route that sends nothing. Requires the Owner or Developer role. Returns 400 for invalid settings.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.RouteApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let notehubRoute = {
http: {
disable_http_headers: false,
filter: {},
fleets: ["fleet:1042ddc5-3b2c-4cec-b1fb-d3040538094d"],
http_headers: { "X-My-Header": "value" },
throttle_ms: 100,
timeout: 5000,
transform: {},
url: "https://example.com/ingest",
},
label: "Route Label",
}; // NotehubRoute | Route to be created
apiInstance.createRoute(projectOrProductUID, notehubRoute).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| notehubRoute | NotehubRoute | Route to be created |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
deleteRoute
deleteRoute(projectOrProductUID, routeUID)
Delete a route
Delete a route so it stops sending events. To pause it instead, set `disabled` with `UpdateRoute`. Requires the Owner or Developer role.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.RouteApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
apiInstance.deleteRoute(projectOrProductUID, routeUID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| routeUID | String | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`. |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getRoute
NotehubRoute getRoute(projectOrProductUID, routeUID)
Get a route
Get one route's full settings: destination, filter, transform and fleets. Secrets such as passwords and keys come back as `(omitted)`. Requires the Owner or Developer role. Viewers can use `GetRoutes`. Returns 404 if the route doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.RouteApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
apiInstance.getRoute(projectOrProductUID, routeUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| routeUID | String | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getRouteLogsByRoute
[RouteLog] getRouteLogsByRoute(projectOrProductUID, routeUID, opts)
List a route's logs
List a route's attempts to send events, newest first, with each one's event, response status, body and duration. Filter by device, notefile, date, success or HTTP status. For one event, use `GetRouteLogsByEvent`. Paginated. Returns 404 if the route doesn't exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.RouteApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
let opts = {
pageSize: 1000, // Number |
pageNum: 1, // Number |
cursor: "cursor_example", // String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped.
deviceUID: ["null"], // [String] | A DeviceUID.
sortBy: "'date'", // String | Field to sort by. - `date`: when the attempt was made - `event`: the order the events arrived in, then the attempt time
sortOrder: "'desc'", // String | Sort direction. - `asc`: oldest first - `desc`: newest first
startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
systemFilesOnly: true, // Boolean | If true, return only events from system notefiles, such as `_session.qo` and `_health.qo`.
mostRecentOnly: true, // Boolean | If true, return only the latest attempt for each event.
files: "_health.qo, data.qo", // String | Comma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`.
routingStatus: failure, // [String] | Return only attempts with this outcome. - `success`: the destination accepted the event - `failure`: the attempt failed
responseStatus: 500, // [String] | Response status codes to include, e.g. `500`.
};
apiInstance.getRouteLogsByRoute(projectOrProductUID, routeUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| routeUID | String | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`. | |
| pageSize | Number | [optional] [default to 1000] | |
| pageNum | Number | [optional] [default to 1] | |
| cursor | String | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| deviceUID | [String] | A DeviceUID. | [optional] |
| sortBy | String | Field to sort by. - `date`: when the attempt was made - `event`: the order the events arrived in, then the attempt time | [optional] [default to 'date'] |
| sortOrder | String | Sort direction. - `asc`: oldest first - `desc`: newest first | [optional] [default to 'desc'] |
| startDate | Number | Start date for filtering results, specified as a Unix timestamp | [optional] |
| endDate | Number | End date for filtering results, specified as a Unix timestamp | [optional] |
| systemFilesOnly | Boolean | If true, return only events from system notefiles, such as `_session.qo` and `_health.qo`. | [optional] |
| mostRecentOnly | Boolean | If true, return only the latest attempt for each event. | [optional] |
| files | String | Comma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`. | [optional] |
| routingStatus | [String] | Return only attempts with this outcome. - `success`: the destination accepted the event - `failure`: the attempt failed | [optional] |
| responseStatus | [String] | Response status codes to include, e.g. `500`. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getRoutes
[NotehubRouteSummary] getRoutes(projectOrProductUID)
List routes
List a project's routes with their type and label and whether they're disabled, without their settings. For a route's settings, use `GetRoute`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.RouteApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getRoutes(projectOrProductUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
updateRoute
NotehubRoute updateRoute(projectOrProductUID, routeUID, notehubRoute)
Update a route
Change a route's settings. Fields you leave out keep their values, and a secret sent back as `(omitted)` is kept, but leaving out `notes` clears it. Requires the Owner or Developer role. Returns 404 if the route doesn't exist, and 400 for invalid settings.
Example
import * as NotehubJs from '@blues-inc/notehub-js';
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications['personalAccessToken'];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new NotehubJs.RouteApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
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(projectOrProductUID, routeUID, notehubRoute).then((data) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}, (error) => {
console.error(error);
});Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| routeUID | String | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`. | |
| notehubRoute | NotehubRoute | Route settings to be updated |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
Usage API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| getApiUsage | GET /v1/projects/{projectOrProductUID}/usage/api | Get billable API usage |
| getDataUsage | GET /v1/projects/{projectOrProductUID}/usage/data | Get cellular and satellite data usage |
| getEventsUsage | GET /v1/projects/{projectOrProductUID}/usage/events | Get event usage |
| getRouteLogsUsage | GET /v1/projects/{projectOrProductUID}/usage/route-logs | Get route log usage |
| getSessionsUsage | GET /v1/projects/{projectOrProductUID}/usage/sessions | Get session usage |
getApiUsage
GetApiUsage200Response getApiUsage(projectOrProductUID, period, opts)
Get billable API usage
Count a project's billable Notehub API requests per day, week or month, by endpoint. Only requests billed against the project's plan are counted. Returns 400 if `startDate` is after `endDate`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.UsageApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let period = "period_example"; // String | The length of time each data point covers.
let opts = {
startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
limit: 200000, // Number | The most data points to return. If there are more, `truncated` is true.
};
apiInstance.getApiUsage(projectOrProductUID, period, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| period | String | The length of time each data point covers. | |
| startDate | Number | Start date for filtering results, specified as a Unix timestamp | [optional] |
| endDate | Number | End date for filtering results, specified as a Unix timestamp | [optional] |
| limit | Number | The most data points to return. If there are more, `truncated` is true. | [optional] [default to 200000] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getDataUsage
GetDataUsage200Response getDataUsage(projectOrProductUID, period, opts)
Get cellular and satellite data usage
Get the cellular and satellite data a project's devices used, in bytes. It's counted per day, week or month, by device, fleet or the whole project. If there are more data points than `limit`, the rest are dropped and `truncated` is true. Returns 400 for an unknown device, or if `endDate` is before `startDate`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.UsageApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let period = "period_example"; // String | The length of time each data point covers.
let opts = {
startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
deviceUID: ["null"], // [String] | A DeviceUID.
fleetUID: ["null"], // [String] | Filter by FleetUID
limit: 200000, // Number | The most data points to return. If there are more, `truncated` is true.
aggregate: "'device'", // String | How to group the counts, such as per device or one total for the project.
};
apiInstance.getDataUsage(projectOrProductUID, period, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| period | String | The length of time each data point covers. | |
| startDate | Number | Start date for filtering results, specified as a Unix timestamp | [optional] |
| endDate | Number | End date for filtering results, specified as a Unix timestamp | [optional] |
| deviceUID | [String] | A DeviceUID. | [optional] |
| fleetUID | [String] | Filter by FleetUID | [optional] |
| limit | Number | The most data points to return. If there are more, `truncated` is true. | [optional] [default to 200000] |
| aggregate | String | How to group the counts, such as per device or one total for the project. | [optional] [default to 'device'] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getEventsUsage
UsageEventsResponse getEventsUsage(projectOrProductUID, period, opts)
Get event usage
Count a project's events per day, week or month, by device, fleet or the whole project, optionally per notefile. Summaries lag; with `period=day` and no `endDate`, the latest day is filled in from recent events unless `skipRecentData` is true. Returns 400 if `startDate` is after `endDate`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.UsageApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let period = "period_example"; // String | The length of time each data point covers.
let opts = {
startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
deviceUID: ["null"], // [String] | A DeviceUID.
fleetUID: ["null"], // [String] | Filter by FleetUID
limit: 200000, // Number | The most data points to return. If there are more, `truncated` is true.
aggregate: "'device'", // String | How to group the counts, such as per device or one total for the project.
notefile: ["null"], // [String] | Count only events from these notefiles.
skipRecentData: false, // Boolean | If true, return only summarized data, without filling in the latest day. Faster for large projects.
includeNotefiles: false, // Boolean | If true, include event counts for each notefile.
};
apiInstance.getEventsUsage(projectOrProductUID, period, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| period | String | The length of time each data point covers. | |
| startDate | Number | Start date for filtering results, specified as a Unix timestamp | [optional] |
| endDate | Number | End date for filtering results, specified as a Unix timestamp | [optional] |
| deviceUID | [String] | A DeviceUID. | [optional] |
| fleetUID | [String] | Filter by FleetUID | [optional] |
| limit | Number | The most data points to return. If there are more, `truncated` is true. | [optional] [default to 200000] |
| aggregate | String | How to group the counts, such as per device or one total for the project. | [optional] [default to 'device'] |
| notefile | [String] | Count only events from these notefiles. | [optional] |
| skipRecentData | Boolean | If true, return only summarized data, without filling in the latest day. Faster for large projects. | [optional] [default to false] |
| includeNotefiles | Boolean | If true, include event counts for each notefile. | [optional] [default to false] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getRouteLogsUsage
GetRouteLogsUsage200Response getRouteLogsUsage(projectOrProductUID, period, opts)
Get route log usage
Count a project's attempts to send events to routes per day, week or month, by route or for the whole project. If there are more data points than `limit`, the rest are dropped and `truncated` is true.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.UsageApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let period = "period_example"; // String | The length of time each data point covers.
let opts = {
startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
routeUID: ["null"], // [String] | A RouteUID.
limit: 200000, // Number | The most data points to return. If there are more, `truncated` is true.
aggregate: "'route'", // String | How to group the counts, per route or one total for the project.
skipRecentData: false, // Boolean | If true, return only summarized data, without filling in the latest day. Faster for large projects.
};
apiInstance.getRouteLogsUsage(projectOrProductUID, period, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| period | String | The length of time each data point covers. | |
| startDate | Number | Start date for filtering results, specified as a Unix timestamp | [optional] |
| endDate | Number | End date for filtering results, specified as a Unix timestamp | [optional] |
| routeUID | [String] | A RouteUID. | [optional] |
| limit | Number | The most data points to return. If there are more, `truncated` is true. | [optional] [default to 200000] |
| aggregate | String | How to group the counts, per route or one total for the project. | [optional] [default to 'route'] |
| skipRecentData | Boolean | If true, return only summarized data, without filling in the latest day. Faster for large projects. | [optional] [default to false] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
getSessionsUsage
GetSessionsUsage200Response getSessionsUsage(projectOrProductUID, period, opts)
Get session usage
Count a project's device sessions per day, week or month, by device, fleet or the whole project. If there are more data points than `limit`, the rest are dropped and `truncated` is true. Returns 400 if `startDate` is after `endDate`.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
let personalAccessToken = defaultClient.authentications["personalAccessToken"];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN";
let apiInstance = new NotehubJs.UsageApi();
let projectOrProductUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let period = "period_example"; // String | The length of time each data point covers.
let opts = {
startDate: 1628631763, // Number | Start date for filtering results, specified as a Unix timestamp
endDate: 1657894210, // Number | End date for filtering results, specified as a Unix timestamp
deviceUID: ["null"], // [String] | A DeviceUID.
fleetUID: ["null"], // [String] | Filter by FleetUID
limit: 200000, // Number | The most data points to return. If there are more, `truncated` is true.
aggregate: "'device'", // String | How to group the counts, such as per device or one total for the project.
skipRecentData: false, // Boolean | If true, return only summarized data, without filling in the latest day. Faster for large projects.
};
apiInstance.getSessionsUsage(projectOrProductUID, period, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectOrProductUID | String | ||
| period | String | The length of time each data point covers. | |
| startDate | Number | Start date for filtering results, specified as a Unix timestamp | [optional] |
| endDate | Number | End date for filtering results, specified as a Unix timestamp | [optional] |
| deviceUID | [String] | A DeviceUID. | [optional] |
| fleetUID | [String] | Filter by FleetUID | [optional] |
| limit | Number | The most data points to return. If there are more, `truncated` is true. | [optional] [default to 200000] |
| aggregate | String | How to group the counts, such as per device or one total for the project. | [optional] [default to 'device'] |
| skipRecentData | Boolean | If true, return only summarized data, without filling in the latest day. Faster for large projects. | [optional] [default to false] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json