ziocan Posted August 24, 2016 Share Posted August 24, 2016 Hi there, I am trying to write a small driver that allows me to call the LIFX smart bulbs API to activate/deactivate light scenes. Unfortunately, the damn API wants to receive PUT requests. In the driverworks documentation I only see support for GET and POST. Does anybody know if there's a way to send a PUT request from LUA code in a driver? Maybe someone has some code to share? :-) Other than invoking curl on the controller, of course... Thanks in advance, Rick Quote Link to comment Share on other sites More sharing options...
alanchow Posted August 24, 2016 Share Posted August 24, 2016 PUT is available. Download the latest driverworks documentation from the dealer website. Quote Link to comment Share on other sites More sharing options...
alanchow Posted August 24, 2016 Share Posted August 24, 2016 Alternatively write your own HTTP requests thats what i do. Quote Link to comment Share on other sites More sharing options...
ziocan Posted August 24, 2016 Author Share Posted August 24, 2016 Thanks Alan, I'll check it out! Quote Link to comment Share on other sites More sharing options...
ziocan Posted August 24, 2016 Author Share Posted August 24, 2016 Thanks, this was easier than expected! function ActivateScene (Scene) local http_headers = {} http_headers["Authorization"] = "Bearer " .. Properties["LIFX Cloud token"] URL = "https://api.lifx.com/v1/scenes/scene_id:" .. Scene .. "/activate" C4:urlPut(URL, "", http_headers) end lukas.polivka and South Africa C4 user 2 Quote Link to comment Share on other sites More sharing options...
Sree Ram Posted August 14, 2018 Share Posted August 14, 2018 Please Explain me? Quote Link to comment Share on other sites More sharing options...
lukas.polivka Posted March 25, 2019 Share Posted March 25, 2019 BTW from the DriverWorks SDK 2.10.5: Quote The following APIs have been deprecated due to the introduction of the C4:url Interface: urlGet() urlPost() urlPut() urlDelete urlCustom() Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.