Seiteneigenschaften |
---|
Deutsch |
---|
Seiteneigenschaften |
---|
Auslesen des Geräte-Status
Endpunkt: /cloud-service-devices/accounts/${lmcApi.accountId}/devices?type=all5
Codeblock |
---|
const util = require("./util.js");
if (!util.checkParams(["account-uuid"])) {
return;
}
// Create an API object, to query the given account
const lmcApi = util.getApi(process.argv[2]);
lmcApi.fetch(`/cloud-service-devices/accounts/${lmcApi.accountId}/devices?type=all5`)
.then(devices => {
devices
.forEach(device => console.log([
device.id,
device.status.heartbeatState,
device.status.lastHeartbeatDate,
device.status.name,
device.alerting.hasAlert,
device.alerting.isMuted,
device.offlineOnHold
].join(",")));
}); |
Auslesen von Geräte-Variablen
Endpunkt: /cloud-service-config/configvariable/accounts/${lmcApi.accountId}/devices/${device}/variables
Codeblock |
---|
const util = require("./util.js");
if (!util.checkParams(["account-uuid", "device-uuid"])) {
return;
}
// Create an API object, to query the given account
const lmcApi = util.getApi(process.argv[2]);
const device = process.argv[3];
lmcApi.fetch(`/cloud-service-config/configvariable/accounts/${lmcApi.accountId}/devices/${device}/variables`, "GET")
.then(json => json.forEach(v => console.log(v.variableId, v.name, v.value))); |
Geräte-Variablen setzen
Endpunkt: /cloud-service-config/configvariable/accounts/${lmcApi.accountId}/devices/${device}/variables/${variable}
Codeblock |
---|
const util = require("./util.js");
if (!util.checkParams(["account-uuid", "device-uuid", "variable-id", "value"])) {
return;
}
// Create an API object, to query the given account
const lmcApi = util.getApi(process.argv[2]);
const device = process.argv[3];
const variable = process.argv[4];
const value = process.argv[5];
lmcApi.fetch(`/cloud-service-config/configvariable/accounts/${lmcApi.accountId}/devices/${device}/variables/${variable}`, "PUT", {
value: "" + value
}); |
Konfigurations-Upload anstoßen
Endpunkt: /cloud-service-config/configdevice/accounts/${lmcApi.accountId}/rollout?forceRollout=true&addDependentCentralSites=false
Codeblock |
---|
const util = require("./util.js");
if (!util.checkParams(["account-uuid", "device-uuid"])) {
return;
};
const args = process.argv;
// Create an API object, to query the given account
const lmcApi = util.getApi(process.argv[2]);
const deviceId = args[3];
// force rollout, check api doc for query params
lmcApi.fetch(`/cloud-service-config/configdevice/accounts/${lmcApi.accountId}/rollout?forceRollout=true&addDependentCentralSites=false`, "POST",
[
deviceId // you can add more deviceIDs here
]); |
Englisch |
---|
|
Get Devices Status
Endpoint: /cloud-service-devices/accounts/${lmcApi.accountId}/devices?type=all5
Codeblock |
---|
const util = require("./util.js");
if (!util.checkParams(["account-uuid"])) {
return;
}
// Create an API object, to query the given account
const lmcApi = util.getApi(process.argv[2]);
lmcApi.fetch(`/cloud-service-devices/accounts/${lmcApi.accountId}/devices?type=all5`)
.then(devices => {
devices
.forEach(device => console.log([
device.id,
device.status.heartbeatState,
device.status.lastHeartbeatDate,
device.status.name,
device.alerting.hasAlert,
device.alerting.isMuted,
device.offlineOnHold
].join(",")));
}); |
Get Device Variables
Endpoint: /cloud-service-config/configvariable/accounts/${lmcApi.accountId}/devices/${device}/variables
Codeblock |
---|
const util = require("./util.js");
if (!util.checkParams(["account-uuid", "device-uuid"])) {
return;
}
// Create an API object, to query the given account
const lmcApi = util.getApi(process.argv[2]);
const device = process.argv[3];
lmcApi.fetch(`/cloud-service-config/configvariable/accounts/${lmcApi.accountId}/devices/${device}/variables`, "GET")
.then(json => json.forEach(v => console.log(v.variableId, v.name, v.value))); |
Set Device Variable
Endpoint: /cloud-service-config/configvariable/accounts/${lmcApi.accountId}/devices/${device}/variables/${variable}
Codeblock |
---|
const util = require("./util.js");
if (!util.checkParams(["account-uuid", "device-uuid", "variable-id", "value"])) {
return;
}
// Create an API object, to query the given account
const lmcApi = util.getApi(process.argv[2]);
const device = process.argv[3];
const variable = process.argv[4];
const value = process.argv[5];
lmcApi.fetch(`/cloud-service-config/configvariable/accounts/${lmcApi.accountId}/devices/${device}/variables/${variable}`, "PUT", {
value: "" + value
}); |
Trigger Config Upload
Endpoint: /cloud-service-config/configdevice/accounts/${lmcApi.accountId}/rollout?forceRollout=true&addDependentCentralSites=false
Codeblock |
---|
const util = require("./util.js");
if (!util.checkParams(["account-uuid", "device-uuid"])) {
return;
};
const args = process.argv;
// Create an API object, to query the given account
const lmcApi = util.getApi(process.argv[2]);
const deviceId = args[3];
// force rollout, check api doc for query params
lmcApi.fetch(`/cloud-service-config/configdevice/accounts/${lmcApi.accountId}/rollout?forceRollout=true&addDependentCentralSites=false`, "POST",
[
deviceId // you can add more deviceIDs here
]); |