-
Notifications
You must be signed in to change notification settings - Fork 3
/
bulk-signage-config-example.js
65 lines (60 loc) · 1.34 KB
/
bulk-signage-config-example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const axios = require("axios");
const ACCESS_TOKEN =
"enter your access token here";
const searchConfig = {
headers: {
"User-Agent": "Mozilla/5.0",
"Authorization": `Bearer ${ACCESS_TOKEN}`,
"Content-Type": "application/json",
},
};
const patchConfig = {
headers: {
"User-Agent": "Mozilla/5.0",
"Authorization": `Bearer ${ACCESS_TOKEN}`,
"Content-Type": "application/json-patch+json",
},
};
const signageData = JSON.stringify([
{
op: "replace",
path: "Standby.Signage.Url/sources/configured/value",
value: "nrk.no",
},
{
op: "replace",
path: "Standby.Signage.Mode/sources/configured/value",
value: "On",
},
{
op: "replace",
path: "WebEngine.Mode/sources/configured/value",
value: "On",
},
{
op: "replace",
path: "Standby.Delay/sources/configured/value",
value: 120,
},
]);
axios
.get("https://webexapis.com/v1/devices?tag=signage", searchConfig)
.then((result) => {
for (let device of result.data.items) {
axios
.patch(
`https://webexapis.com/v1/deviceConfigurations?deviceId=${device.id}`,
signageData,
patchConfig
)
.then((result) => {
console.log(result);
}),
(error) => {
console.log(error);
};
}
}),
(error) => {
console.log(error);
};