AirVantage.js
Nodejs AirVantage API client
Full AirVantage API documentation: https://doc.airvantage.net/av/reference/cloud/API/
Install
:warning: Node.js 4 or higher is required for airvantage@3 and above. For older Node.js versions use airvantage@2.
$ npm install --save airvantage
Usage
const AirVantage = require("airvantage");
const config = {
serverUrl: "https://eu.airvantage.net",
credentials: {
client_id: "YOUR_CLIENT_ID",
client_secret: "YOUR_CLIENT_SECRET",
username: "you@domain.com",
password: "yOuRs3cR3t!"
}
};
const airvantage = new AirVantage(config);
airvantage
.authenticate()
.then(() => airvantage.querySystems({ labels: ["demo"] }))
.then(systems => console.log("All demo systems:", systems));
You may already have an access_token
and want to use it:
const AirVantage = require("airvantage");
const airvantage = new AirVantage({
serverUrl: "https://eu.airvantage.net",
});
function querySystems(accessToken) {
airvantage
.authenticate({token: accessToken})
.then(() => airvantage.querySystems({ labels: ["demo"] }))
.then(systems => console.log("All demo systems:", systems));
}
OR you may want to authentication multiple users with a single AirVantage instance
const AirVantage = require("airvantage");
const airvantage = new AirVantage({
serverUrl: "https://eu.airvantage.net",
});
function authenticate(username, password) {
airvantage
.authenticate({username: username, password: password})
.then(token => storeToken(username, token));
}
Available methods
Systems
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
-
deleteSystem(uid)
-
deleteSystems(options)
- options
{
"selection" : {
"label": "aLabel",
"uids" : ["uid1", ...]
},
"deleteGateway": false | true,
"deleteSubscriptions": false | true
}
-
activateSystems
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
Gateways
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
-
deleteGateway(uid)
-
deleteGateways(options)
Subscriptions
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- synchronizeSusbscriptions
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
Applications
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- editApplicationCommunication(uid, data)
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- editApplicationData(uid, data)
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- releaseApplication(filePath)
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
Alert Rules
Add a new notification hook when the given alert rule identifier is triggered. When a rule get trigged, the given callback is invoked
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
Get the list of all notification hooks configured for the given alert rule identifier.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
Operations
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
Misc
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.