Get Devices Status

Endpoint: /cloud-service-devices/accounts/${lmcApi.accountId}/devices?type=all5

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

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}

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

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
    ]);