Start a new topic
Answered

LaMetric Sky how to turn on/off via API?

API documentation doesn't make reference to   "on" : true  or   "on" : false which presumably is how you get LaMetric Sky tiles to turn on???


I'm using the same curl code to send a .json to the sky (as works on the lametric time) but I'm getting an error when sending to sky.  (already updated my code to use the correct API key and IP address of the sky)


turnon.bat ...


C:\lametric\curl.exe -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic my_api_key_here" -H "Cache-Control: no-cache" --data-ascii "@C:\lametric\skyon.json" http://192.168.xx.xx:8080/api/v2/device/display


(also tried the URL of "api/v2/device" but same problem


skyon.json ...


{
  "on" : true
}


always results in a response of...


{ "errors" : [ { "message" : "Not allowed" }


Best Answer

Hi,


This one work for me ; 

 

curl --location --request PUT 'https://[IP]:4343/api/v2/device/display' \
  -u "dev:[API KEY]" -k \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  -d '{ "on": "false" }'

 You have to put [API KEY] et [IP]


Answer

Hi,


This one work for me ; 

 

curl --location --request PUT 'https://[IP]:4343/api/v2/device/display' \
  -u "dev:[API KEY]" -k \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  -d '{ "on": "false" }'

 You have to put [API KEY] et [IP]

Thank you, that helped me get it working...


turnon.bat =

curl.exe --location --request PUT "http://192.168.xx.xx:8080/api/v2/device/display" -u "dev:[my_api_key]" -k --header "Accept: application/json" --header "Content-Type: application/json" --data-ascii "@C:\lametric\skyfoxon.json"

skyfoxon.json =

{
  "on" : true
}

1 person likes this
Login or Signup to post a comment