Nodejs AirVantage API client
Full AirVantage API documentation: https://doc.airvantage.net/av/reference/cloud/API/
$ npm install --save airvantage
const AirVantage = require("airvantage");
const config = {
serverUrl: "https://eu.airvantage.net", // or https://na.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", // or https://na.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", // or https://na.airvantage.net
});
function authenticate(username, password) {
airvantage
.authenticate({username: username, password: password})
.then(token => storeToken(username, token));
}
- querySystems
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- getDetailsSystem
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- createSystem
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- editSystem
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
-
deleteSystem(uid)
- uid
- Required
- Type:
string
- uid
-
deleteSystems(options)
- options
- Type:
object
{ "selection" : { "label": "aLabel", // Or "uids" : ["uid1", ...] }, "deleteGateway": false | true, "deleteSubscriptions": false | true }
- Type:
- options
-
activateSystems
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- suspendSystems
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- resumeSystems
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- terminateSystems
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- queryMultiRawDataPoints
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- queryGateways
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- getDetailsGateway
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- createGateway
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- editGateway
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
-
deleteGateway(uid)
- uid
- Required
- Type:
string
- uid
-
deleteGateways(options)
- options
- Type:
object
{ "selection" : { "label": "aLabel", // Or "uids" : ["uid1", ...] } }
- Type:
- options
- querySusbscriptions
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- getDetailsSubscription
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- createSusbscription
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- editSusbscription
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
-
deleteSusbscription(uid)
- uid
- Required
- Type:
string
- uid
-
deleteSusbscription(options)
- options
- Type:
object
{ "selection" : { "label": "aLabel", // Or "uids" : ["uid1", ...] } }
- Type:
- options
-
activateSusbscriptions
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.
- suspendSusbscriptions
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- restoreSusbscriptions
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- terminateSusbscriptions
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- queryApplications
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- getDetailsApplication
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- createApplication
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- editApplication
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.
- publishApplication(uid)
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- addApplication(uid)
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
-
deleteApplication(uid)
- uid
- Required
- Type:
string
- uid
-
deleteApplications(options)
- options
- Type:
object
{ "selection" : { "label": "aLabel", // Or "uids" : ["uid1", ...] } }
- Type:
- options
-
createAlertRule(data)
-
editAlertRule(uid, data)
-
deleteAlertRule(uid)
-
deleteAlertRules(params)
-
queryAlertRules(params)
-
getDetailsAlertRule(id)
-
createNotificationHook(id, callback)
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.
- getNotificationHooks(id)
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.
- queryOperations
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- getDetailsOperation
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.
- currentUser
See https://doc.airvantage.net/av/reference/cloud/API/ for the methods arguments.