· 4 years ago · Jun 16, 2021, 12:52 PM
1// JSON / API til at tænde / Slukke for Nanoleaf Elements indtil de opdaterer deres APP
2
3const APIKEY = '<indsæt API KEY>';
4const URL = "http://<indsæt IP>:16021/api/v1/" + APIKEY + "/state";
5
6let param = true;
7if (args[0] != "true")
8{
9 param = false;
10}
11
12const response = await fetch(URL, {
13 method : 'PUT',
14 headers: { 'content-type' : 'application/json' },
15 body: JSON.stringify({"on": {"value": param}})
16});