New HTTP API Syntax for Non-Coders
Posted: Fri Jul 14, 2023 7:33 pm
For those of us who don't speak code, here is the syntax that worked for me to trigger actions and toggle devices with CURL commands from a terminal window.
Please feel free to adjust my understanding.
To use the new HTTP API via the CURL command in a terminal to toggle a device:
Indigo Documentation Reads...
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message": "indigo.actionGroup.execute", "objectId": 123456789}' https://your-reflector-name.indigodomo. ... pi/command
Your edit of that code should look like this...
curl -X POST -H "Authorization: Bearer XXX" -d '{"message": "indigo.device.toggle", "objectId": DDD}' https://UUU.indigodomo.net/v2/api/command
XXX are your API key. DDD is your device ID. YYY is your username at the Indigo reflector.
I think it is an understood concept in coding that we replace CAPS in some bit of sample code with our actual keys and ids but keep the lower case and Camel Case thingys as is. I was replacing all of the Authorization... stuff which did not work. Am I right? Is that common practice. Teach me.
Here then is the syntax to fire an Action Group using a CURL command in the terminal...
curl -X POST -H "Authorization: Bearer XXX" -d '{"message": "indigo.actionGroup.execute", "objectId": DDD}' https://UUU.indigodomo.net/v2/api/command
Xs is your API key, Ds are the Action Group ID and Us are your user name at the reflector.
How am I using this?
For years I have used the REST APIs to send commands to the Indigo server from my desktop computer using Keyboard Maestro which has the ability to trigger all sorts of events on my Mac including CURL commands by using keystrokes. I have a bunch of things I do in Indigo right from my keyboard such as toggling the space heater at my feet to setting lighting scenes for Zoom calls. I began replacing those depreciated REST calls with the new HTTP API calls and all is working well.... and surprisingly fast.
I sure hope this helps some one else who is not a coder.
Jay please dust off my rough edges and put this post where it really ought to go.
Please feel free to adjust my understanding.
To use the new HTTP API via the CURL command in a terminal to toggle a device:
Indigo Documentation Reads...
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message": "indigo.actionGroup.execute", "objectId": 123456789}' https://your-reflector-name.indigodomo. ... pi/command
Your edit of that code should look like this...
curl -X POST -H "Authorization: Bearer XXX" -d '{"message": "indigo.device.toggle", "objectId": DDD}' https://UUU.indigodomo.net/v2/api/command
XXX are your API key. DDD is your device ID. YYY is your username at the Indigo reflector.
I think it is an understood concept in coding that we replace CAPS in some bit of sample code with our actual keys and ids but keep the lower case and Camel Case thingys as is. I was replacing all of the Authorization... stuff which did not work. Am I right? Is that common practice. Teach me.
Here then is the syntax to fire an Action Group using a CURL command in the terminal...
curl -X POST -H "Authorization: Bearer XXX" -d '{"message": "indigo.actionGroup.execute", "objectId": DDD}' https://UUU.indigodomo.net/v2/api/command
Xs is your API key, Ds are the Action Group ID and Us are your user name at the reflector.
How am I using this?
For years I have used the REST APIs to send commands to the Indigo server from my desktop computer using Keyboard Maestro which has the ability to trigger all sorts of events on my Mac including CURL commands by using keystrokes. I have a bunch of things I do in Indigo right from my keyboard such as toggling the space heater at my feet to setting lighting scenes for Zoom calls. I began replacing those depreciated REST calls with the new HTTP API calls and all is working well.... and surprisingly fast.
I sure hope this helps some one else who is not a coder.
Jay please dust off my rough edges and put this post where it really ought to go.