Notehub JS Library Overview
The Notehub JS library is an npm library built specifically for use in JavaScript-based applications.
It is designed to get you connected to the Notehub API quickly, and allow you to access all the API routes relevant to interacting with Notehub in a JavaScript-friendly way.
Installation
You can install the Notehub JS library in any JavaScript-based application using the steps below.
In the root of the project where you wish to use Notehub JS, run the following command from the terminal.
Using npm:
npm install @blues-inc/notehub-js
Using yarn:
yarn add @blues-inc/notehub-js
Once the package is installed, you can import the library using import
or require
:
Using import
:
import * as NotehubJs from "@blues-inc/notehub-js";
const defaultClient = NotehubJs.ApiClient.instance;
Using import
to access the library in a TypeScript project currently will cause an
error because there is not yet a @types
file for it. To make the error disappear,
declare the module in a file with a .d.ts
extension.
declare module '@blues-inc/notehub-js';
Using require
:
const NotehubJs = require("@blues-inc/notehub-js");
const defaultClient = NotehubJs.ApiClient.instance;
Usage
Below is documentation and code examples for all the Notehub API methods.
There is one main type of authorization the Notehub API uses for nearly all requests:
API Key
The api_key
referenced in the following code examples is an API key (also known locally
as an X-Session-Token
).
The API key is an authentication token that can be obtained in two ways:
Manually cURL the token from the command line
Using the command line, a user can request a new token from the
Notehub API /auth/login
endpoint
using a Notehub username and password in the body of the request.
Use NotehubJs.AuthorizationApi login
Using the Notehub JS library, a user can programmatically call the Notehub API's /auth/login
endpoint
via the NotehubJs.AuthorizationApi's login()
method while supplying a Notehub username and
password in the loginRequest
object.
API Calls and Consumption Credits
Be aware that all Notehub API calls made using the Notehub JS library utilize your account's Consumption Credits (CCs). For more information, please consult our pricing page.
All URIs are relative to https://api.notefile.net
Async/Await Syntax
If you'd like to use async/await
syntax in any of the documented code examples below,
add the async
keyword to the outer function/mthod with the following implementation.
// add the async keyword to your outer function/method
// sample code above stays the same
try {
data = await apiInstance.getRoutes(projectUID);
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
} catch (error) {
console.error(error);
}
Real World Use Cases of Notehub JS Library
As this library gains adoptions, we'll continue to provide new links to repos where this library being used in real world projects.
Indoor Floor Level Tracker Project
If you'd like to see examples of this library being used in real-world applications, check out this indoor floor-level tracker project in the Blues App Accelerator repo on GitHub.
The files that deserve special attention are:
ServiceLocatorServer.ts
- this file makes the variety of services composing the backend logic of the application discoverable to each other. For DRY-er code, the Notehub JS library's instances were created and passed to the various services that would require them to fetch and update data via the Notehub API. An instance of the Notehub JS client is created viaconst notehubJsClient = NotehubJs.ApiClient.instance
, and passed to thegetDataProvider()
andgetAttributeStore()
services that will need to interact with the Notehub API to perform their duties.NotehubDataProvider.ts
- this file is responsible for fetching data from the Notehub API for the application to display. It calls the project API'sgetProjectFleetDevices()
andgetProjectEvents()
methods, and the fleet API'sgetFleetEnvironmentVariables()
method as well.NotehubAttributeStore.ts
- this file sends updates to the Notehub API from the application like updated device name or updated environment variables. It calls two of the environment variable API's methods:putDeviceEnvironmentVariables()
andputFleetEnvironmentVariables()
.
Method | HTTP Request |
---|---|
login | POST /auth/login |
This is the only Notehub API call that does not require some form of authentication token, and it is used to generate the token which can then be used for almost all subsequent API requests.
login
Gets a session token from the API from a username and password.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let apiInstance = new NotehubJs.AuthorizationApi();
let loginRequest = {"username":"name@example.com","password":"test-password"}; // LoginRequest |
apiInstance.login(loginRequest).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
loginRequest | LoginRequest |
LoginRequest Properties
Name | Type | Description | Notes |
---|---|---|---|
username | String | ||
password | String |
No authorization required
Billing Account API
Method | HTTP Request |
---|---|
getBillingAccounts | GET /v1/billing-accounts |
getBillingAccounts
Get Billing Accounts accessible by the api_key
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.BillingAccountApi();
apiInstance.getBillingAccounts().then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
This endpoint does not need any parameter.
Return type
Successful 200 getBillingAccounts response
Device API
Method | HTTP Request |
---|---|
deleteDeviceEnvironmentVariable | DELETE /v1/projects/{projectUID}/devices/{deviceUID}/environment_variables/{key} |
deleteProjectDevice | DELETE /v1/projects/{projectUID}/devices/{deviceUID} |
disableDevice | POST /v1/projects/{projectUID}/devices/{deviceUID}/disable |
disableDeviceConnectivityAssurance | POST /v1/projects/{projectUID}/devices/{deviceUID}/disable-connectivity-assurance |
enableDevice | POST /v1/projects/{projectUID}/devices/{deviceUID}/enable |
enableDeviceConnectivityAssurance | POST /v1/projects/{projectUID}/devices/{deviceUID}/enable-connectivity-assurance |
getDevice | GET /v1/projects/{projectUID}/devices/{deviceUID} |
getDeviceEnvironmentVariables | GET /v1/projects/{projectUID}/devices/{deviceUID}/environment_variables |
getDeviceEnvironmentVariablesByPin | GET /v1/products/{productUID}/devices/{deviceUID}/environment_variables_with_pin |
getDeviceHealthLog | GET /v1/projects/{projectUID}/devices/{deviceUID}/health-log |
getDeviceLatest | GET /v1/projects/{projectUID}/devices/{deviceUID}/latest |
getDevicePublicKey | GET /v1/projects/{projectUID}/devices/{deviceUID}/public-key |
getDeviceSessions | GET /v1/projects/{projectUID}/devices/{deviceUID}/sessions |
getProjectDevicePublicKeys | GET /v1/projects/{projectUID}/devices/public-keys |
getProjectDevices | GET /v1/projects/{projectUID}/devices |
getProjectFleetDevices | GET /v1/projects/{projectUID}/fleets/{fleetUID}/devices |
handleNoteAdd | POST /v1/projects/{projectUID}/devices/{deviceUID}/notes/{notefileID} |
handleNoteChanges | GET /v1/projects/{projectUID}/devices/{deviceUID}/notes/{notefileID}/changes |
handleNoteCreateAdd | POST /v1/projects/{projectUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} |
handleNoteDelete | DELETE /v1/projects/{projectUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} |
handleNoteGet | GET /v1/projects/{projectUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} |
handleNoteSignal | POST /v1/projects/{projectUID}/devices/{deviceUID}/signal |
handleNoteUpdate | PUT /v1/projects/{projectUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} |
handleNotefileChanges | GET /v1/projects/{projectUID}/devices/{deviceUID}/files/changes |
handleNotefileChangesPending | GET /v1/projects/{projectUID}/devices/{deviceUID}/files/changes/pending |
handleNotefileDelete | DELETE /v1/projects/{projectUID}/devices/{deviceUID}/files |
postProvisionProjectDevice | POST /v1/projects/{projectUID}/devices/{deviceUID}/provision |
putDeviceEnvironmentVariables | PUT /v1/projects/{projectUID}/devices/{deviceUID}/environment_variables |
putDeviceEnvironmentVariablesByPin | PUT /v1/products/{productUID}/devices/{deviceUID}/environment_variables_with_pin |
deleteDeviceEnvironmentVariable
Delete environment variable of a device
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let key = "key_example"; // String | The environment variable key to delete.
apiInstance.deleteDeviceEnvironmentVariable(projectUID, deviceUID, key).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String | ||
key | String | The environment variable key to delete. |
Return type
Successful 200 deleteDeviceEnvironmentVariable response
deleteProjectDevice
Delete Device
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let purge = false; // Boolean |
apiInstance.deleteProjectDevice(projectUID, deviceUID, purge).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String | ||
purge | Boolean | [default to false] |
Return type
Successful 200 deleteProjectDevice response
disableDevice
Disable Device
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.disableDevice(projectUID, deviceUID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String |
Return type
null (empty response body)
disableDeviceConnectivityAssurance
Disable Connectivity Assurance
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.disableDeviceConnectivityAssurance(projectUID, deviceUID).then(() => {
console.log("API called successfully.");
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String |
Return type
null (empty response body)
enableDevice
Enable Device
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.enableDevice(projectUID, deviceUID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String |
Return type
null (empty response body)
enableDeviceConnectivityAssurance
Enable Connectivity Assurance
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.enableDeviceConnectivityAssurance(projectUID, deviceUID).then(() => {
console.log("API called successfully.");
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String |
Return type
null (empty response body)
getDevice
Get Device
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.getDevice(projectUID, deviceUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String |
Return type
Successful 200 getDevice response
getDeviceEnvironmentVariables
Get environment variables of a device
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.getDeviceEnvironmentVariables(projectUID, deviceUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String |
Return type
Successful 200 getDeviceEnvironmentVariables response
getDeviceEnvironmentVariablesByPin
Get environment variables of a device with device pin authorization
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: pin
let pin = defaultClient.authentications["pin"];
pin.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let productUID = "com.blues.airnote"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.getDeviceEnvironmentVariablesByPin(productUID, deviceUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
productUID | String | ||
deviceUID | String |
pin
getDeviceHealthLog
Get Device Health Log
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.getDeviceHealthLog(projectUID, deviceUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String |
Return type
Successful 200 getDeviceHealthLog response
getDeviceLatest
Get Device Latest Events
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.getDeviceLatest(projectUID, deviceUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String |
Return type
Successful 200 getDeviceLatest response
getDevicePublicKey
Get Device Public Key
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.getDevicePublicKey(projectUID, deviceUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String |
getDeviceSessions
Get Device Sessions
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let opts = {
pageSize: 50, // Number |
pageNum: 1, // Number |
};
apiInstance.getDeviceSessions(projectUID, deviceUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String | ||
pageSize | Number | [optional] [default to 50] | |
pageNum | Number | [optional] [default to 1] |
Return type
Successful 200 getDeviceSessions response
getProjectDevicePublicKeys
Get Device Public Keys of a Project
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
pageSize: 50, // Number |
pageNum: 1, // Number |
};
apiInstance.getProjectDevicePublicKeys(projectUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
pageSize | Number | [optional] [default to 50] | |
pageNum | Number | [optional] [default to 1] |
getProjectDevices
Get Devices of a Project
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
pageSize: 50, // Number |
pageNum: 1, // Number |
};
apiInstance.getProjectDevices(projectUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
pageSize | Number | [optional] [default to 50] | |
pageNum | Number | [optional] [default to 1] |
Return type
Successful 200 getProjectDevices response
getProjectFleetDevices
Get Devices of a Fleet within a Project
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let opts = {
pageSize: 50, // Number |
pageNum: 1, // Number |
};
apiInstance.getProjectFleetDevices(projectUID, fleetUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
fleetUID | String | ||
pageSize | Number | [optional] [default to 50] | |
pageNum | Number | [optional] [default to 1] |
Return type
Successful 200 getProjectFleetDevices response
handleNoteAdd
Adds a Note to a Notefile, creating the Notefile if it doesn't yet exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let note = new NotehubJs.Note(); // Note | Body or payload of note to be added to the device
apiInstance.handleNoteAdd(projectUID, deviceUID, notefileID, note).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String | ||
notefileID | String | ||
note | Note | Body or payload of note to be added to the device |
Note Properties
Name | Type | Description | Notes |
---|---|---|---|
body | Object | [optional] Example: {body: {temp: 72.22 } } | |
payload | String | Base64-encoded binary payload. A note must have either a body or a payload , and can have both. | [optional] |
Return type
Successful 200 handleNoteAdd response
handleNoteChanges
Incrementally retrieve changes within a specific Notefile.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let opts = {
tracker: "tracker_example", // String | The change tracker ID.
max: 56, // Number | The maximum number of Notes to return in the request.
start: true, // Boolean | true to reset the tracker to the beginning.
stop: true, // Boolean | true to delete the tracker.
deleted: true, // Boolean | true to return deleted notes.
_delete: true, // Boolean | true to delete the notes returned by the request.
};
apiInstance.handleNoteChanges(projectUID, deviceUID, notefileID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String | ||
notefileID | String | ||
tracker | String | The change tracker ID. | [optional] |
max | Number | The maximum number of Notes to return in the request. | [optional] |
start | Boolean | true to reset the tracker to the beginning. | [optional] |
stop | Boolean | true to delete the tracker. | [optional] |
deleted | Boolean | true to return deleted notes. | [optional] |
_delete | Boolean | true to delete the notes returned by the request. | [optional] |
Return type
Successful 200 handleNoteChanges response
handleNoteCreateAdd
Adds a Note to a Notefile, creating the Notefile if it doesn't yet exist.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let noteID = "noteID_example"; // String |
let note = new NotehubJs.Note(); // Note | Body or payload of note to be added to the device
apiInstance
.handleNoteCreateAdd(projectUID, deviceUID, notefileID, noteID, note)
.then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String | ||
notefileID | String | ||
noteID | String | ||
note | Note | Body or payload of note to be added to the device |
Note Properties
Name | Type | Description | Notes |
---|---|---|---|
body | Object | [optional] Example: {body: {temp: 72.22 } } | |
payload | String | Base64-encoded binary payload. A note must have either a body or a payload , and can have both. | [optional] |
Return type
Successful 200 handleNoteCreateAdd response
handleNoteDelete
Delete a note from a DB notefile
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let noteID = "noteID_example"; // String |
apiInstance.handleNoteDelete(projectUID, deviceUID, notefileID, noteID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);
Parameters
Return type
null (empty response body)
handleNoteGet
Get a note from a DB notefile
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let noteID = "noteID_example"; // String |
let opts = {
_delete: true, // Boolean | Whether to delete the note from the DB notefile
deleted: true, // Boolean | Whether to return deleted notes
};
apiInstance.handleNoteGet(projectUID, deviceUID, notefileID, noteID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String | ||
notefileID | String | ||
noteID | String | ||
_delete | Boolean | Whether to delete the note from the DB notefile | [optional] |
deleted | Boolean | Whether to return deleted notes | [optional] |
Return type
Successful 200 handleNoteGet response
handleNoteSignal
Send a signal from Notehub to a Notecard.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let body = new NotehubJs.Body(); // Body | Body or payload of signal to be sent to the device
apiInstance.handleNoteSignal(projectUID, deviceUID, body).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String | ||
body | Body | Body or payload of signal to be sent to the device |
Body Properties
Name | Type | Description | Notes |
---|---|---|---|
body | Object | [optional] Example code: {key1: "value1" } |
Return type
Successful 200 handleNoteSignal Response
handleNoteUpdate
Update a note in a DB notefile
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let notefileID = "notefileID_example"; // String |
let noteID = "noteID_example"; // String |
let note = new NotehubJs.Note(); // Note | Body or payload of note to be added to the device
apiInstance
.handleNoteUpdate(projectUID, deviceUID, notefileID, noteID, note)
.then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String | ||
notefileID | String | ||
noteID | String | ||
note | Note | Body or payload of note to be added to the device |
Note Properties
Name | Type | Description | Notes |
---|---|---|---|
body | Object | [optional] Example code: { body: {interval: 60 } } | |
payload | String | Base64-encoded binary payload. A note must have either a body or a payload , and can have both. | [optional] |
Return type
null (empty response body)
handleNotefileChanges
Used to perform queries on a single or multiple files to determine if new Notes are available to read
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let opts = {
tracker: "tracker_example", // String | The change tracker ID.
files: ["null"], // [String] | One or more files to obtain change information from.
};
apiInstance.handleNotefileChanges(projectUID, deviceUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String | ||
tracker | String | The change tracker ID. | [optional] |
files | [String] | One or more files to obtain change information from. | [optional] |
Return type
Successful 200 handleNotefileChanges response
handleNotefileChangesPending
Returns info about file changes that are pending upload to Notehub or download to the Notecard.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.handleNotefileChangesPending(projectUID, deviceUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String |
Return type
Successful 200 handleNotefileChangesPending response
handleNotefileDelete
Deletes Notefiles and the Notes they contain.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let handleNotefileDeleteRequest = new NotehubJs.HandleNotefileDeleteRequest(); // HandleNotefileDeleteRequest |
apiInstance
.handleNotefileDelete(projectUID, deviceUID, handleNotefileDeleteRequest)
.then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String | ||
handleNotefileDeleteRequest | HandleNotefileDeleteRequest |
HandleNotefileDeleteRequest Properties
Name | Type | Description | Notes |
---|---|---|---|
files | [String] | One or more files to obtain change information from. | [optional] Example code: {["file1", "file2", "file3"]} |
Return type
null (empty response body)
postProvisionProjectDevice
Provision Device for a Project
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let postProvisionProjectDeviceRequest = new NotehubJs.PostProvisionProjectDeviceRequest(); // PostProvisionProjectDeviceRequest | Provision a device to a specific ProductUID
apiInstance.postProvisionProjectDevice(projectUID, deviceUID, postProvisionProjectDeviceRequest).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String | ||
postProvisionProjectDeviceRequest | PostProvisionProjectDeviceRequest | Provision a device to a specific ProductUID |
PostProvisionProjectDeviceRequest Properties
Name | Type | Description | Notes |
---|---|---|---|
productUid | String | The ProductUID that the device should use. | Example code: {productUid: "product_uid", deviceSn: "deviceUID_example"} |
deviceSn | String | The serial number to assign to the device. | [optional] |
Return type
null (empty response body)
putDeviceEnvironmentVariables
Put environment variables of a device
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let envVars = {key1: "value1", key2: "value2"} // {String: String} |
let environmentVariables = new NotehubJs.EnvironmentVariables(envVars); // EnvironmentVariables | Environment variables to be added to the device
apiInstance
.putDeviceEnvironmentVariables(projectUID, deviceUID, environmentVariables)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String | ||
environmentVariables | EnvironmentVariables | Environment variables to be added to the device |
EnvironmentVariables Properties
Name | Type | Description | Notes |
---|---|---|---|
environmentVariables | {String: String} | Example code: {key1: "value1", key2: "value2"} |
Return type
Successful 200 putDeviceEnvironmentVariables response
putDeviceEnvironmentVariablesByPin
Put environment variables of a device with device pin authorization
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: pin
let pin = defaultClient.authentications["pin"];
pin.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.DeviceApi();
let productUID = "com.blues.airnote"; // String |
let deviceUID = "deviceUID_example"; // String |
let envVars = {key1: "value1", key2: "value2"} // {String: String} |
let environmentVariables = new NotehubJs.EnvironmentVariables(envVars); // EnvironmentVariables | Environment variables to be added to the device
apiInstance
.putDeviceEnvironmentVariablesByPin(
productUID,
deviceUID,
environmentVariables
)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
producttUID | String | ||
deviceUID | String | ||
environmentVariables | EnvironmentVariables | Environment variables to be added to the device |
EnvironmentVariables Properties
Name | Type | Description | Notes |
---|---|---|---|
environmentVariables | {String: String} | Example code: {key1: "value1", key2: "value2"} |
pin
Event API
Method | HTTP Request |
---|---|
getFleetEvents | GET /v1/projects/{projectUID}/fleets/{fleetUID}/events |
getFleetEventsByCursor | GET /v1/projects/{projectUID}/fleets/{fleetUID}/events-cursor |
getProjectEvents | GET /v1/projects/{projectUID}/events |
getProjectEventsByCursor | GET /v1/projects/{projectUID}/events-cursor |
getRouteLogsByEvent | GET /v1/projects/{projectUID}/events/{eventUID}/route-logs |
getFleetEvents
Get Events of a Fleet
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.EventApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let opts = {
fleetUID: ["null"], // [String] | Filter by Fleet UID
pageSize: 50, // Number |
pageNum: 1, // Number |
deviceUID: ["null"], // [String] | A Device UID.
sortBy: "captured", // String |
sortOrder: "asc", // String |
startDate: 1628631763, // Number | Unix timestamp
endDate: 1657894210, // Number | Unix timestamp
systemFilesOnly: true, // Boolean |
files: "_health.qo, data.qo", // String |
format: "json", // String | Response format (JSON or CSV)
serialNumber: ["null"], // [String] | Filter by Serial Number
sessionUID: ["null"], // [String] | Filter by Session UID
eventUID: ["null"], // [String] | Filter by Event UID
selectFields: "selectFields_example", // String | Comma-separated list of fields to select from JSON payload (e.g., \"field1,field2.subfield,field3\"), this will reflect the columns in the CSV output.
deviceUIDs: ["null"], // [String] | Deprecated.
since: "since_example" // String | Deprecated.
};
apiInstance.getFleetEvents(projectUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
fleetUID | [String] | Filter by Fleet UID | [optional] |
fleetUID | String | ||
pageSize | Number | [optional] [default to 50] | |
pageNum | Number | [optional] [default to 1] | |
deviceUID | [String] | A Device UID. | [optional] |
sortBy | String | [optional] [default to "captured"] | |
sortOrder | String | [optional] [default to "asc"] | |
startDate | Number | Unix timestamp | [optional] |
endDate | Number | Unix timestamp | [optional] |
systemFilesOnly | Boolean | [optional] | |
files | String | [optional] | |
format | String | Response format ("json" or "csv") | [optional] [default to "json"] |
since | String | Deprecated. | [optional] |
serialNumber | [String] | Filter by Serial Number | [optional] |
sessionUID | [String] | Filter by Session UID | [optional] |
eventUID | [String] | Filter by Event UID | [optional] |
selectFields | String | Comma-separated list of fields to include in the response (e.g., "field1,field2.subfield,field3"). | [optional] |
deviceUIDs | [String] | Deprecated. | [optional] |
since | String | Deprecated. | [optional] |
Return type
Successful 200 getFleetEvents response
getFleetEventsByCursor
Get Events of a Fleet by cursor
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.EventApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let opts = {
limit: 50, // Number |
cursor: "cursor_example", // String | A cursor, which can be obtained from the `next_cursor` value from a previous call to this endpoint. The results set returned will include this event as its first result if the given identifier is actually the UID of an event. If this event UID is not found, the parameter is ignored and the results set is the same as if the parameter was not included.
sortOrder: "asc", // String |
systemFilesOnly: true, // Boolean |
files: "_health.qo, data.qo", // String |
deviceUID: ["null"], // [String] | A Device UID.
startDate: 1628631763, // Number | Unix timestamp
endDate: 1657894210 // Number | Unix timestamp
};
apiInstance.getFleetEventsByCursor(projectUID, fleetUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
fleetUID | String | ||
limit | Number | [optional] [default to 50] | |
cursor | String | A cursor, which can be obtained from the next_cursor value from a previous call to this endpoint. The results set returned will include this event as its first result if the given identifier is actually the UID of an event. If this event UID is not found, the parameter is ignored and the results set is the same as if the parameter was not included. | [optional] |
sortOrder | String | [optional] [default to "asc"] | |
systemFilesOnly | Boolean | [optional] | |
files | String | [optional] | |
deviceUID | [String] | A Device UID. | [optional] |
startDate | Number | Unix timestamp | [optional] |
endDate | Number | Unix timestamp | [optional] |
Return type
Successful 200 getFleetEventsByCursor response
getProjectEvents
Get Events of a Project
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.EventApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
pageSize: 50, // Number |
pageNum: 1, // Number |
deviceUID: ["null"], // [String] | A Device UID.
sortBy: "captured", // String |
sortOrder: "asc", // String |
startDate: 1628631763, // Number | Unix timestamp
endDate: 1657894210, // Number | Unix timestamp
systemFilesOnly: true, // Boolean |
files: "_health.qo, data.qo", // String |
format: "json", // String | Response format (JSON or CSV)
serialNumber: ["null"], // [String] | Filter by Serial Number
fleetUID: ["null"], // [String] | Filter by Fleet UID
sessionUID: ["null"], // [String] | Filter by Session UID
eventUID: ["null"], // [String] | Filter by Event UID
selectFields: "selectFields_example", // String | Comma-separated list of fields to select from JSON payload (e.g., \"field1,field2.subfield,field3\"), this will reflect the columns in the CSV output.
deviceUIDs: ["null"], // [String] | Deprecated.
since: "since_example" // String | Deprecated.
};
apiInstance.getProjectEvents(projectUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
pageSize | Number | [optional] [default to 50] | |
pageNum | Number | [optional] [default to 1] | |
deviceUID | [String[ | A Device UID. | [optional] |
sortBy | String | [optional] [default to "captured"] | |
sortOrder | String | [optional] [default to "asc"] | |
startDate | Number | Unix timestamp | [optional] |
endDate | Number | Unix timestamp | [optional] |
systemFilesOnly | Boolean | [optional] | |
files | String | [optional] | |
systemFilesOnly | Boolean | [optional] | |
files | String | [optional] | |
format | String | Response format ("json" or "csv") | [optional] [default to "json"] |
since | String | Deprecated. | [optional] |
serialNumber | [String] | Filter by Serial Number | [optional] |
fleetUID | [String] | Filter by Fleet UID | [optional] |
sessionUID | [String] | Filter by Session UID | [optional] |
eventUID | [String] | Filter by Event UID | [optional] |
selectFields | String | Comma-separated list of fields to include in the response (e.g., "field1,field2.subfield,field3"). | [optional] |
deviceUIDs | [String] | Deprecated. | [optional] |
since | String | Deprecated. | [optional] |
Return type
Successful 200 getProjectEvents response
getProjectEventsByCursor
Get Events of a Project by cursor
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.EventApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
limit: 50, // Number |
cursor: "cursor_example", // String | A cursor, which can be obtained from the `next_cursor` value from a previous call to this endpoint. The results set returned will include this event as its first result if the given identifier is actually the UID of an event. If this event UID is not found, the parameter is ignored and the results set is the same as if the parameter was not included.
sortOrder: "asc", // String |
systemFilesOnly: true, // Boolean |
files: "_health.qo, data.qo", // String |
fleetUID: "fleetUID_example", // String | A Fleet UID.
deviceUID: ["null"] // [String] | A Device UID.
};
apiInstance.getProjectEventsByCursor(projectUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
limit | Number | [optional] [default to 50] | |
cursor | String | A cursor, which can be obtained from the next_cursor value from a previous call to this endpoint. The results set returned will include this event as its first result if the given identifier is actually the UID of an event. If this event UID is not found, the parameter is ignored and the results set is the same as if the parameter was not included. | [optional] |
sortOrder | String | [optional] [default to "asc"] | |
systemFilesOnly | Boolean | [optional] | |
files | String | [optional] | |
fleetUID | String | [optional] | |
deviceUID | [String] | A Device UID. | [optional] |
Return type
Successful 200 getProjectEventsByCursor response
getRouteLogsByEvent
Get Route Logs by Event UID
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.EventApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let eventUID = "4506f411-dea6-44a0-9743-1130f57d7747"; // String |
apiInstance.getRouteLogsByEvent(projectUID, eventUID).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
eventUID | String |
Return type
Successful 200 getRouteLogsByEvent response
Monitor API
Method | HTTP Request |
---|---|
createMonitor | POST /v1/projects/{projectUID}/monitors |
deleteMonitor | DELETE /v1/projects/{projectUID}/monitors/{monitorUID} |
getMonitor | GET /v1/projects/{projectUID}/monitors/{monitorUID} |
getMonitors | GET /v1/projects/{projectUID}/monitors |
updateMonitor | PUT /v1/projects/{projectUID}/monitors/{monitorUID} |
createMonitor
Create a new Monitor
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.MonitorApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let monitorProps = {
name: "Monitor Name", // String |
description: "Monitor Description", // String |
notefileFilter: ["data.qo"], // [String] |
sourceSelector: "temperature", // String |
conditionType: "greater_than", // String |
threshold: 100, // Number |
alertRoutes: [
{
email: "example@blues.com"
}
] // [MonitorAlertRoutes] |
}
let monitor = new NotehubJs.CreateMonitor(monitorProps); // Monitor | Body or payload of monitor to be created
apiInstance.createMonitor(projectUID, monitor).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
createMonitor | CreateMonitor | Body or payload of monitor to be created |
CreateMonitor Properties
Name | Type | Description | Notes |
---|---|---|---|
uid | String | [optional] | |
name | String | ||
description | String | ||
sourceType | String | The type of source to monitor. Currently only "event" is supported. | [optional] |
disabled | Boolean | If true , the monitor will not be evaluated. | [optional] |
alert | Boolean | If true , the monitor is in alert state. | [optional] |
notefileFilter | [String] | ||
fleetFilter | [String] | [optional] | |
sourceSelector | String | A valid JSONata expression that selects the value to monitor from the source. It should return a single, numeric value. | [optional] |
conditionType | String | A comparison operation to apply to the value selected by the sourceSelector ["greater_than", "greater_than_or_equal_to", "less_than", "less_than_or_equal_to", "equal_to", "not_equal_to"] | [optional] |
threshold | Number | The type of condition to apply to the value selected by the sourceSelector | [optional] |
alertRoutes | [MonitorAlertRoutes] | An array of entities to notify when an alert is triggered. | |
lastRoutedAt | String | The last time the monitor was evaluated and routed. | [optional] |
silenced | Boolean | If true , alerts will be created, but no notifications will be sent. | [optional] |
routingCooldownPeriod | String | The time period to wait before routing another event after the monitor has been triggered. It follows the format of a number followed by a time unit. | [optional] Example code: "5hr30m10s" for 5 hours, 30 minutes, 10 seconds. |
aggregateFunction | String | Aggregate function to apply to the selected values before applying the condition. ["none", "sum", "average", "max", "min"] | [optional] |
aggregateWindow | String | The time window to aggregate the selected values. It follows the format of a number followed by a time unit. | [optional] Example code: "5hr30m10s" for 5 hours, 30 minutes, 10 seconds |
perDevice | Boolean | Only relevant when using an aggregate_function . If true , the monitor will be evaluated per device, rather than across the set of selected devices. If true then if a single device matches the specified criteria, an alert will be created, otherwise the aggregate function will be applied across all devices. | [optional] |
MonitorAlertRoutes Properties
Name | Type | Description | Notes |
---|---|---|---|
url | String | The URL of the Slack webhook. | [optional] Example code: { url: "hooks.slack.com/...", messageType: "text|blocks", text: "Message text" } |
messageType | String | text or blocks | [optional] |
text | String | The text of the message, or the blocks definition | [optional] |
token | String | The bearer token for the Slack app. | [optional] Example code: { token: "your_token", channel: "CXXXXXXXX", messageType: "text|blocks", text: "Message text" } |
channel | String | The channel to send the message to. | [optional] |
String | Email Address | [optional] Example code: { email: "your.email@blues.com" } |
Return type
Successful 200 createMonitor response
deleteMonitor
Delete Monitor
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.MonitorApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let monitorUID = "monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad"; // String |
apiInstance.deleteMonitor(projectUID, monitorUID).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
monitorUID | String |
Return type
Successful 200 deleteMonitor response
getMonitor
Get Monitor
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.MonitorApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let monitorUID = "monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad"; // String |
apiInstance.getMonitor(projectUID, monitorUID).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
monitorUID | String |
Return type
Successful 200 getMonitor response
getMonitors
Get list of defined Monitors
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.MonitorApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getMonitors(projectUID).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String |
Return type
Successful 200 getMonitors response
updateMonitor
Update Monitor
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.MonitorApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let monitorUID = "monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad"; // String |
let monitorProps = {
name: "Monitor Name", // String |
description: "Monitor Description", // String |
notefileFilter: ["data.qo"], // [String] |
sourceSelector: "temperature", // String |
conditionType: "greater_than", // String |
threshold: 100, // Number |
alertRoutes: [
{
email: "example@blues.com"
}
] // [MonitorAlertRoutes] |
}
let monitor = new NotehubJs.Monitor(monitorProps); // Monitor | Body or payload of monitor to be created
apiInstance.updateMonitor(projectUID, monitorUID, monitor).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
monitorUID | String | ||
monitor | Monitor | Body or payload of monitor to be created |
Monitor Properties
Name | Type | Description | Notes |
---|---|---|---|
uid | String | [optional] | |
name | String | [optional] | |
description | String | [optional] | |
sourceType | String | The type of source to monitor. Currently only "event" is supported. | [optional] |
disabled | Boolean | If true , the monitor will not be evaluated. | [optional] |
alert | Boolean | If true , the monitor is in alert state. | [optional] |
notefileFilter | [String] | [optional] | |
fleetFilter | [String] | [optional] | |
sourceSelector | String | A valid JSONata expression that selects the value to monitor from the source. | It should return a single, numeric value. |
conditionType | String | A comparison operation to apply to the value selected by the sourceSelector ["greater_than", "greater_than_or_equal_to", "less_than", "less_than_or_equal_to", "equal_to", "not_equal_to"] | [optional] |
threshold | Number | The type of condition to apply to the value selected by the sourceSelector | [optional] |
alertRoutes | [MonitorAlertRoutesInner] | An array of entities to notify when an alert is triggered. | [optional] |
lastRoutedAt | String | The last time the monitor was evaluated and routed. | [optional] |
silenced | Boolean | If true , alerts will be created, but no notifications will be sent. | [optional] |
routingCooldownPeriod | String | The time period to wait before routing another event after the monitor has been triggered. It follows the format of a number followed by a time unit. | [optional] |
aggregateFunction | String | Aggregate function to apply to the selected values before applying the condition. ["none", "sum", "average", "max", "min"] | [optional] |
aggregateWindow | String | The time window to aggregate the selected values. It follows the format of a number followed by a time unit | [optional] |
perDevice | Boolean | Only relevant when using an aggregate_function . If true, the monitor will be evaluated per device, rather than across the set of selected devices. If true then if a single device matches the specified criteria, and alert will be created, otherwise the aggregate function will be applied across all devices. | [optional] |
MonitorAlertRoutes Properties
Name | Type | Description | Notes |
---|---|---|---|
url | String | The URL of the Slack webhook. | [optional] Example code: { url: "hooks.slack.com/...", messageType: "text|blocks", text: "Message text" } |
messageType | String | text or blocks | [optional] |
text | String | The text of the message, or the blocks definition | [optional] |
token | String | The bearer token for the Slack app. | [optional] Example code: { token: "your_token", channel: "CXXXXXXXX", messageType: "text|blocks", text: "Message text" } |
channel | String | The channel to send the message to. | [optional] |
String | Email Address | [optional] Example code: { email: "your.email@blues.com" } |
Return type
Successful 200 updateMonitor response
Project API
Method | HTTP Request |
---|---|
cloneProject | POST /v1/projects/{projectUID}/clone |
createFleet | POST /v1/projects/{projectUID}/fleets |
createProduct | POST /v1/projects/{projectUID}/products |
createProject | POST /v1/projects |
deleteDeviceFleets | DELETE /v1/projects/{projectUID}/devices/{deviceUID}/fleets |
deleteFleet | DELETE /v1/projects/{projectUID}/fleets/{fleetUID} |
deleteFleetEnvironmentVariable | DELETE /v1/projects/{projectUID}/fleets/{fleetUID}/environment_variables/{key} |
deleteProject | DELETE /v1/projects/{projectUID} |
deleteProjectEnvironmentVariable | DELETE /v1/projects/{projectUID}/environment_variables/\{key\} |
disableGlobalTransformation | POST /v1/projects/{projectUID}/global-transformation/disable |
enableGlobalTransformation | POST /v1/projects/{projectUID}/global-transformation/enable |
getDeviceFleets | GET /v1/projects/{projectUID}/devices/{deviceUID}/fleets |
getFirmwareInfo | GET /v1/projects/{projectUID}/firmware |
getFleetEnvironmentVariables | GET /v1/projects/{projectUID}/fleets/{fleetUID}/environment_variables |
getProject | GET /v1/projects/{projectUID} |
getProjectByProduct | GET /v1/products/{productUID}/project |
getProjectEnvironmentVariables | GET /v1/projects/{projectUID}/environment_variables |
getProjectFleets | GET /v1/projects/{projectUID}/fleets |
getProjectMembers | GET /v1/projects/{projectUID}/members |
getProjectOTAStatus | GET /v1/projects/{projectUID}/ota/status |
getProjectProducts | GET /v1/projects/{projectUID}/products |
getProjects | GET /v1/projects |
putDeviceFleets | PUT /v1/projects/{projectUID}/devices/{deviceUID}/fleets |
putFleetEnvironmentVariables | PUT /v1/projects/{projectUID}/fleets/{fleetUID}/environment_variables |
putProjectEnvironmentVariables | PUT /v1/projects/{projectUID}/environment_variables |
setGlobalTransformation | POST /v1/projects/{projectUID}/global-transformation |
updateFleet | PUT /v1/projects/{projectUID}/fleets/{fleetUID} |
updateProjectFirmware | POST /v1/projects/{projectUID}/ota/update |
cloneProject
Clone a Project
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String | The project UID to be cloned.
let cloneProjectProps = {
label: "My Cloned Project", // String |
billingAccountUid: "billing-account-uid", // String |
disableCloneRoutes: false, // Boolean |
disableCloneFleets: true // Boolean |
}
let cloneProjectRequest = new NotehubJs.CloneProjectRequest(cloneProjectProps); // CloneProjectRequest | Project to be cloned
apiInstance.cloneProject(projectUID, cloneProjectRequest).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | The project UID to be cloned. | |
cloneProjectRequest | CloneProjectRequest | Project to be cloned |
CloneProjectRequest Properties
Name | Type | Description | Notes |
---|---|---|---|
label | String | The label for the project. | Example code: {label: "My Cloned Project", billingAccountUid: "billing-account-uid", disableCloneRoutes: false, disableCloneFleets: true} |
billingAccountUid | String | The billing account UID for the project. The caller of the API must be able to create projects within the billing account, otherwise an error will be returned. | |
disableCloneRoutes | Boolean | Whether to disallow the cloning of the routes from the parent project. Default is false if not specified. | [optional] |
disableCloneFleets | Boolean | Whether to disallow the cloning of the fleets from the parent project. Default is false if not specified. | [optional] |
Return type
Successful 200 cloneProject response
createFleet
Create Fleet
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetLabel = "My New Fleet"; // String | The label for the Fleet.
let createFleetRequest = new NotehubJs.CreateFleetRequest(fleetLabel); // CreateFleetRequest | Fleet to be added
apiInstance.createFleet(projectUID, createFleetRequest).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
createFleetRequest | CreateFleetRequest | Fleet to be added |
CreateFleetRequest Properties
Name | Type | Description | Notes |
---|---|---|---|
label | String | The label for the Fleet. | [optional] Example code: "My New Fleet" |
Return type
Successful 200 createFleet response
createProduct
Create Product within a Project
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let createProductProps = {
productUid: "product_uid", // String |
label: "Product 1", // String |
autoProvisionFleets: ["fleet_uid_1", "fleet_uid_2"], // [String] |
disableDevicesByDefault: true // Boolean |
}
let createProductRequest = new NotehubJs.CreateProductRequest(createProductProps); // CreateProductRequest | Product to be created
apiInstance.createProduct(projectUID, createProductRequest).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
createProductRequest | CreateProductRequest | Product to be created |
CreateProductRequest Properties
Name | Type | Description | Notes |
---|---|---|---|
productUid | String | The requested uid for the Product. Will be prefixed with the user's reversed email. | Example code: {productUid: "product_uid", label: "Product 1", autoProvisionFleets: ["fleet_uid_1", "fleet_uid_2"], disableDevicesByDefault: true } |
label | String | The label for the Product. | |
autoProvisionFleets | [String] | [optional] | |
disableDevicesByDefault | Boolean | If true , devices provisioned to this product will be automatically disabled by default. | [optional] |
Return type
Successful 200 createProduct response
createProject
Create a Project
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let createProjectProps = {
label: "My New Project", // String |
billingAccountUid: "billing-account-uid" // String |
}
let createProjectRequest = new NotehubJs.CreateProjectRequest(createProjectProps); // CreateProjectRequest | Project to be created
apiInstance.createProject(createProjectRequest).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
createProjectRequest | CreateProjectRequest | Project to be created |
CreateProjectRequest Properties
Name | Type | Description | Notes |
---|---|---|---|
label | String | The label for the project. | Example code: {label: "My New Project", billingAccountUid: "billing-account-uid"} |
billingAccountUid | String | The billing account UID for the project. The caller of the API must be able to create projects within the billing account, otherwise an error will be returned. |
Return type
Successful 200 createProject response
deleteDeviceFleets
Remove Device from Fleets
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let deleteDeviceFleetUids = ["fleetUID1", "fleetUID2"] // [String]
let deleteDeviceFleetsRequest = new NotehubJs.DeleteDeviceFleetsRequest(deleteDeviceFleetUids); // DeleteDeviceFleetsRequest | The fleets to remove from the device. Note that the endpoint takes an array of fleetUIDs, to facilitate multi-fleet devices. Multi-fleet is not yet enabled on all SaaS plans - unless it is supported by the SaaS plan of the project, passing more than a single fleetUID in the array is an error.
apiInstance
.deleteDeviceFleets(projectUID, deviceUID, deleteDeviceFleetsRequest)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String | ||
deleteDeviceFleetsRequest | DeleteDeviceFleetsRequest | The fleets to remove from the device. Note that the endpoint takes an array of fleetUIDs, to facilitate multi-fleet devices. Multi-fleet is not yet enabled on all SaaS plans - unless it is supported by the SaaS plan of the project, passing more than a single fleetUID in the array is an error. |
DeleteDeviceFleetsRequest Properties
Name | Type | Description | Notes |
---|---|---|---|
fleetUids | [String] | The fleetUIDs to remove from the device. | Code example: ["fleetUID1", "fleetUID2"] |
Return type
Successful 200 deleteDeviceFleets response
deleteFleet
Delete Fleet
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
apiInstance.deleteFleet(projectUID, fleetUID).then(
() => {
console.log("API called successfully.");
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
fleetUID | String |
Return type
null (empty response body)
deleteFleetEnvironmentVariable
Delete environment variables of a fleet
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let key = "key_example"; // String | The environment variable key to delete.
apiInstance.deleteFleetEnvironmentVariable(projectUID, fleetUID, key).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
fleetUID | String | ||
key | String | The environment variable key to delete. |
Return type
null (empty response body)
deleteProject
Delete a Project by ProjectUID
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.deleteProject(projectUID).then(() => {
console.log("API called successfully.");
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String |
Return type
null (empty response body)
deleteProjectEnvironmentVariable
Delete an environment variable of a project by key
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let key = "key_example"; // String | The environment variable key to delete.
apiInstance.deleteProjectEnvironmentVariable(projectUID, key).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
key | String | The environment variable key to delete. |
Return type
Successful 200 deleteProjectEnvironmentVariable response
disableGlobalTransformation
Disable the project-level event JSONata transformation
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.disableGlobalTransformation(projectUID).then(() => {
console.log("API called successfully.");
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String |
Return type
null (empty response body)
enableGlobalTransformation
Enable the project-level event JSONata transformation
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.enableGlobalTransformation(projectUID).then(() => {
console.log("API called successfully.");
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String |
Return type
null (empty response body)
getDeviceFleets
Get Device Fleets
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
apiInstance.getDeviceFleets(projectUID, deviceUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String |
Return type
Successful 200 getDeviceFleets response
getFirmwareInfo
Get Available Firmware Information
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
product: "product_example", // String |
firmwareType: "firmwareType_example", // String |
version: "version_example", // String |
target: "target_example", // String |
filename: "notecard-7.2.2.16518$20240410043100.bin", // String |
md5: "md5_example", // String |
unpublished: true // Boolean |
};
apiInstance.getFirmwareInfo(projectUID, opts).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
product | String | [optional] | |
firmwareType | String | [optional] | |
version | String | [optional] | |
target | String | [optional] | |
filename | String | [optional] | |
md5 | String | [optional] | |
unpublished | Boolean | [optional] |
getFleetEnvironmentVariables
Get environment variables of a fleet
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
apiInstance.getFleetEnvironmentVariables(projectUID, fleetUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
fleetUID | String |
Return type
Successful 200 getFleetEnvironmentVariables response
getProject
Get a Project by ProjectUID
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProject(projectUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String |
Return type
Successful 200 getProject response
getProjectByProduct
Get a Project by ProductUID
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let productUID = "com.blues.airnote;" // String |
apiInstance.getProjectByProduct(productUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
productUID | String |
Return type
Successful 200 getProjectByProduct response
getProjectEnvironmentVariables
Get environment variables of a project
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectEnvironmentVariables(projectUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String |
Return type
Successful 200 getProjectEnvironmentVariables response
getProjectFleets
Get Project Fleets
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectFleets(projectUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String |
Return type
Successful 200 getProjectFleets response
getProjectMembers
Get Project Members
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectMembers(projectUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String |
Return type
Successful 200 getProjectMembers response
getProjectOTAStatus
Get Project OTA Status
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let opts = {
deviceUIDs: ["null"], // [String] | An array of Device UIDs.
fleetUIDs: ["null"], // [String] |
deviceTags: ["null"], // [String] |
pageSize: 50, // Number |
pageNum: 1 // Number |
};
apiInstance.getProjectOTAStatus(projectUID, opts).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUIDs | [String] | An array of Device UIDs. | [optional] |
fleetUIDs | [String] | [optional] | |
deviceTags | [String] | [optional] | |
pageSize | Number | [optional] [default to 50] | |
pageNum | Number | [optional] [default to 1] |
getProjectProducts
Get Products within a Project
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getProjectProducts(projectUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String |
Return type
Successful 200 getProjectProducts response
getProjects
Get Projects accessible by the api_key
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
apiInstance.getProjects().then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
This endpoint does not need any parameter.
Return type
Successful 200 getProjects response
putDeviceFleets
Add Device to Fleets
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let deviceUID = "deviceUID_example"; // String |
let putDeviceFleetUids = ["fleetUID1", "fleetUID2"] // [String]
let putDeviceFleetsRequest = new NotehubJs.PutDeviceFleetsRequest(putDeviceFleetUids); // PutDeviceFleetsRequest | The fleets to add to the device. Note that the endpoint takes an array of fleetUIDs, to facilitate multi-fleet devices. Multi-fleet is not yet enabled on all SaaS plans - unless it is supported by the SaaS plan of the project, passing more than a single fleetUID in the array is an error.
apiInstance.putDeviceFleets(projectUID, deviceUID, putDeviceFleetsRequest).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
deviceUID | String | ||
putDeviceFleetsRequest | PutDeviceFleetsRequest | The fleets to add to the device. Note that the endpoint takes an array of fleetUIDs, to facilitate multi-fleet devices. Multi-fleet is not yet enabled on all SaaS plans - unless it is supported by the SaaS plan of the project, passing more than a single fleetUID in the array is an error. |
PutDeviceFleetRequest Properties
Name | Type | Description | Notes |
---|---|---|---|
fleetUids | [String] | The fleetUIDs to add to the device. | Code example: ["fleetUID1", "fleetUID2"] |
Return type
Successful 200 putDeviceFleets response
putFleetEnvironmentVariables
Put environment variables of a fleet
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let envVars = {key1: "value1", key2: "value2"} // {String: String}
let environmentVariables = new NotehubJs.EnvironmentVariables(envVars); // EnvironmentVariables | Environment variables to be added to the fleet
apiInstance
.putFleetEnvironmentVariables(projectUID, fleetUID, environmentVariables)
.then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
fleetUID | String | ||
environmentVariables | EnvironmentVariables | Environment variables to be added to the fleet |
EnvironmentVariables Properties
Name | Type | Description | Notes |
---|---|---|---|
environmentVariables | {String: String} | Example code: {key1: "value1", key2: "value2"} |
Return type
Successful 200 putFleetEnvironmentVariables response
putProjectEnvironmentVariables
Put environment variables of a project
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let envVars = {key1: "value1", key2: "value2"} // {String: String}
let opts = {
environmentVariables: new NotehubJs.EnvironmentVariables(envVars), // EnvironmentVariables |
};
apiInstance.putProjectEnvironmentVariables(projectUID, opts).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
environmentVariables | EnvironmentVariables | [optional] |
EnvironmentVariables Properties
Name | Type | Description | Notes |
---|---|---|---|
environmentVariables | {String: String} | Example code: {key1: "value1", key2: "value2"} |
Return type
Successful 200 putProjectEnvironmentVariables response
setGlobalTransformation
Set the project-level event JSONata transformation
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let body = {key: null}; // Object | JSONata expression which will be applied to each event before it is persisted and routed
apiInstance.setGlobalTransformation(projectUID, body).then(() => {
console.log("API called successfully.");
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
body | Object | JSONata expression which will be applied to each event before it is persisted and routed |
Return type
null (empty response body)
updateFleet
Update Fleet
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let fleetUID = "fleetUID_example"; // String |
let updateFleetRequest = {
label: "Fleet Label",
addDevices: ["device_id_1", "device_id_2"],
removeDevices: ["device_id_3", "device_id_4"]
} // UpdateFleetRequest | Fleet details to update
apiInstance.updateFleet(projectUID, fleetUID, updateFleetRequest).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
fleetUID | String | ||
updateFleetRequest | UpdateFleetRequest | Fleet details to update |
UpdateFleetRequest Properties
Name | Type | Description | Notes |
---|---|---|---|
label | String | The label for the Fleet. | Code example: { label: "Fleet Label", addDevices: ["device_id_1", "device_id_2"], removeDevices: ["device_id_3", "device_id_4"] } |
addDevices | [String] | List of DeviceUIDs to add to fleet | [optional] |
removeDevices | [String] | List of DeviceUIDs to remove from fleet | [optional] |
Return type
Successful 200 updateFleet response
updateProjectFirmware
Update Project Firmware
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.ProjectApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let otaUpdateProps = {
product: "product_example", // String |
firmwareType: "firmwareType_example", // String |
version: "version_example", // String |
target: "target_example", // String |
filename: "notecard-7.2.2.16518$20240410043100.bin", // String |
md5: "md5_example", // String |
unpublished: true // Boolean |
};
let oTAUpdateRequest = new NotehubJs.OTAUpdateRequest(otaUpdateProps); // OTAUpdateRequest | Body or payload of firmware update
apiInstance.updateProjectFirmware(projectUID, oTAUpdateRequest).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
oTAUpdateRequest | OTAUpdateRequest | Body or payload of firmware update |
OTAUpdateRequest Properties
Name | Type | Description | Notes |
---|---|---|---|
filename | String | The name of the firmware file | [optional] |
deviceUids | [String] | The device UIDs to update | [optional] |
fleetUids | [String] | The fleet UIDs to update | [optional] |
deviceTags | [String] | The device tags to update | [optional] |
version | String | The version of the firmware | [optional] |
mD5 | String | The MD5 hash of the firmware file | [optional] |
type | String | The type of firmware | [optional] |
product | String | The product that the firmware is for | [optional] |
target | String | The target device for the firmware | [optional] |
unpublished | Boolean | If true , the firmware is unpublished | [optional] |
cancelDfu | Boolean | If true , the DFU is canceled | [optional] |
Route API
Method | HTTP Request |
---|---|
createRoute | POST /v1/projects/{projectUID}/routes |
deleteRoute | DELETE /v1/projects/{projectUID}/routes/{routeUID} |
getRoute | GET /v1/projects/{projectUID}/routes/{routeUID} |
getRouteLogsByRoute | GET /v1/projects/{projectUID}/routes/{routeUID}/route-logs |
getRoutes | GET /v1/projects/{projectUID}/routes |
updateRoute | PUT /v1/projects/{projectUID}/routes/{routeUID} |
createRoute
Create Route within a Project.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let route = {
label: "Route Label",
type: "http",
http: {
fleets: ["fleet:1042ddc5-3b2c-4cec-b1fb-d3040538094d"],
throttle_ms: 100,
url: "http://route.url",
},
}; // Route | Route to be Created
apiInstance.createRoute(projectUID, route).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
route | Route | Route to be Created |
Route Properties
Name | Type | Description | Notes |
---|---|---|---|
uid | String | Route UID | [optional] |
label | String | Route Label | [optional] |
routeType | String | Type of route. | [optional] [default to "http" ] |
modified | String | Last Modified | [optional] |
disabled | Boolean | Is route disabled? | [optional] [default to false ] |
schema | RouteSchema | [optional] |
RouteSchema Properties
Name | Type | Description | Notes |
---|---|---|---|
fleets | [String] | list of Fleet UIDs to apply route to, if any. If empty, applies to all Fleets | [optional] |
filter | HttpFilter | [optional] | |
transform | SnowflakeTransform | [optional] | |
throttleMs | Number | Minimum time between requests in Miliseconds | [optional] |
url | String | [optional] | |
httpHeaders | {String: String} | [optional] | |
disableHttpHeaders | Boolean | [optional] [default to false ] | |
timeout | Number | Timeout in seconds for each request | [optional] [default to 15] |
token | String | Optional authentication token | [optional] |
alias | String | [optional] | |
broker | String | [optional] | |
port | Number | [optional] | |
username | String | [optional] | |
password | String | This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
topic | String | [optional] | |
certificate | String | Certificate with \n newlines. This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
certificateName | String | Name of certificate. | [optional] |
key | String | Key with \n newlines. This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
privateKeyName | String | Name of PEM key. If omitted, defaults to "present" | [optional] [default to "present" ] |
region | String | [optional] | |
accessKeyId | String | [optional] | |
accessKeySecret | String | This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
messageGroupId | String | [optional] | |
messageDeduplicationId | String | [optional] | |
channel | String | The Channel ID for Bearer Token method, if the "slack-bearer" type is selected | [optional] |
testApi | Boolean | [optional] [default to false ] | |
dataFeedKey | String | [optional] | |
clientId | String | [optional] | |
clientSecret | String | This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
functionsKeySecret | String | This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
sasPolicyName | String | [optional] | |
sasPolicyKey | String | This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
appKey | String | This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
organizationName | String | [optional] | |
accountName | String | [optional] | |
userName | String | [optional] | |
pem | String | PEM key with \n newlines. This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
slackType | String | The type of Slack message. Must be one of "slack-bearer" for Bearer Token or "slack-webhook" for Webhook messages | [optional] |
bearer | String | The Bearer Token for Slack messaging, if the "slack-bearer" type is selected | [optional] |
webhookUrl | String | The Webhook URL for Slack Messaging if the "slack-webhook" type is selected | [optional] |
text | String | The simple text message to be sent, if the blocks message field is not in use. Placeholders are available for this field. | [optional] |
blocks | String | The Blocks message to be sent. If populated, this field overrides the text field within the Slack Messaging API. Placeholders are available for this field. | [optional] |
HTTPFilter Properties
Name | Type | Description | Notes |
---|---|---|---|
type | String | What notefiles this route applies to. | [optional] |
systemNotefiles | Boolean | Whether system notefiles should be affected by this route | [optional] |
files | [String] | [optional] |
SnowflakeTransform Properties
Name | Type | Description | Notes |
---|---|---|---|
format | String | Data transformation to apply. Only "jsonata" is valid for Snowflake routes | [optional] [default to "jsonata"] |
jsonata | String | JSONata transformation | [optional] |
Return type
Successful 200 createRoute response
deleteRoute
Delete single route within a project
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String |
apiInstance.deleteRoute(projectUID, routeUID).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
routeUID | String |
Return type
null (empty response body)
getRoute
Get single route within a project.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String |
apiInstance.getRoute(projectUID, routeUID).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
routeUID | String |
Return type
Successful 200 getRoute response
getRouteLogsByRoute
Get Route Logs by Route UID
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String |
let opts = {
pageSize: 50, // Number |
pageNum: 1, // Number |
deviceUID: ["null"], // [String] | A Device UID.
sortBy: "captured", // String |
sortOrder: "asc", // String |
startDate: 1628631763, // Number | Unix timestamp
endDate: 1657894210, // Number | Unix timestamp
systemFilesOnly: true, // Boolean |
files: "_health.qo, data.qo" // String |
};
apiInstance.getRouteLogsByRoute(projectUID, routeUID, opts).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
routeUID | String | ||
pageSize | Number | [optional] [default to 50] | |
pageNum | Number | [optional] [default to 1] | |
deviceUID | [String] | A Device UID. | [optional] |
sortBy | String | [optional] [default to "captured"] | |
sortOrder | String | [optional] [default to "asc"] | |
startDate | Number | Unix timestamp | [optional] |
endDate | Number | Unix timestamp | [optional] |
systemFilesOnly | Boolean | [optional] | |
files | String | [optional] |
Return type
Successful 200 getRouteLogsByRoute response
getRoutes
Get all Routes within a Project.
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getRoutes(projectUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String |
Return type
Successful 200 getRoutes response
updateRoute
Update route by UID
Example
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String |
let route = {
http: {
filter: {
type: "include",
system_notefiles: true,
files: ["somefile.qo"]
},
throttle_ms: 50,
url: "http://new-route.url",
},
}; // Route | Route settings to be updated
apiInstance.updateRoute(projectUID, routeUID, route).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projectUID | String | ||
routeUID | String | ||
route | Route | Route settings to be updated |
Route Properties
Name | Type | Description | Notes |
---|---|---|---|
uid | String | Route UID | [optional] |
label | String | Route Label | [optional] |
routeType | String | Type of route. | [optional] [default to "http" ] |
modified | String | Last Modified | [optional] |
disabled | Boolean | Is route disabled? | [optional] [default to false ] |
schema | RouteSchema | [optional] |
RouteSchema Properties
Name | Type | Description | Notes |
---|---|---|---|
fleets | [String] | list of Fleet UIDs to apply route to, if any. If empty, applies to all Fleets | [optional] |
filter | HttpFilter | [optional] | |
transform | SnowflakeTransform | [optional] | |
throttleMs | Number | Minimum time between requests in Miliseconds | [optional] |
url | String | [optional] | |
httpHeaders | {String: String} | [optional] | |
disableHttpHeaders | Boolean | [optional] [default to false ] | |
timeout | Number | Timeout in seconds for each request | [optional] [default to 15] |
token | String | Optional authentication token | [optional] |
alias | String | [optional] | |
broker | String | [optional] | |
port | Number | [optional] | |
username | String | [optional] | |
password | String | This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
topic | String | [optional] | |
certificate | String | Certificate with \n newlines. This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
certificateName | String | Name of certificate. | [optional] |
key | String | Key with \n newlines. This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
privateKeyName | String | Name of PEM key. If omitted, defaults to "present" | [optional] [default to "present" ] |
region | String | [optional] | |
accessKeyId | String | [optional] | |
accessKeySecret | String | This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
messageGroupId | String | [optional] | |
messageDeduplicationId | String | [optional] | |
channel | String | The Channel ID for Bearer Token method, if the "slack-bearer" type is selected | [optional] |
testApi | Boolean | [optional] [default to false ] | |
dataFeedKey | String | [optional] | |
clientId | String | [optional] | |
clientSecret | String | This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
functionsKeySecret | String | This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
sasPolicyName | String | [optional] | |
sasPolicyKey | String | This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
appKey | String | This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
organizationName | String | [optional] | |
accountName | String | [optional] | |
userName | String | [optional] | |
pem | String | PEM key with \n newlines. This value is input-only and will be omitted from the response and replaced with a placeholder | [optional] |
slackType | String | The type of Slack message. Must be one of "slack-bearer" for Bearer Token or "slack-webhook" for Webhook messages | [optional] |
bearer | String | The Bearer Token for Slack messaging, if the "slack-bearer" type is selected | [optional] |
webhookUrl | String | The Webhook URL for Slack Messaging if the "slack-webhook" type is selected | [optional] |
text | String | The simple text message to be sent, if the blocks message field is not in use. Placeholders are available for this field. | [optional] |
blocks | String | The Blocks message to be sent. If populated, this field overrides the text field within the Slack Messaging API. Placeholders are available for this field. | [optional] |
HTTPFilter Properties
Name | Type | Description | Notes |
---|---|---|---|
type | String | What notefiles this route applies to. | [optional] |
systemNotefiles | Boolean | Whether system notefiles should be affected by this route | [optional] |
files | [String] | [optional] |
SnowflakeTransform Properties
Name | Type | Description | Notes |
---|---|---|---|
format | String | Data transformation to apply. Only "jsonata" is valid for Snowflake routes | [optional] [default to "jsonata"] |
jsonata | String | JSONata transformation | [optional] |
Return type
Successful 200 updateRoute response