REST API error after updating to Indigo 2022.2.0

Posted on
Fri Jul 14, 2023 7:33 pm
Accularian offline
Posts: 8
Joined: Dec 03, 2011

New HTTP API Syntax for Non-Coders

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.

Enjoy,

Image

Dana Haynes
MacHelp Global
http://www.machelpglobal.com

Posted on
Sat Jul 15, 2023 5:24 am
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: REST API error after updating to Indigo 2022.2.0

Thanks for taking the time to post this. There's no single convention (that I'm aware of) for using all caps or other marks to indicate items to be replaced in a code sample. However, it sounds like there may be an opportunity for additional clarity in the documentation. I'll take a look at that and see what can be done to make the examples clearer.

EDIT:
...and Us are your user name at the reflector.

This would be better described as your server's reflector name. That can be found by logging into your account at https://www.indigodomo.com

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Fri Dec 01, 2023 10:10 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: REST API error after updating to Indigo 2022.2.0

jay (support) wrote:
berkinet wrote:
Code: Select all
Web Server                      HTTP API command call received from 127.0.0.1
   Web Server                      API v2 command received, id: '- no message id -' from '127.0.0.1'
We have an enhancement request to think about various message suppression options.The old web server always logged API commands to the event log as a security measure.
Any progress on this?

Posted on
Fri Dec 01, 2023 11:53 am
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: REST API error after updating to Indigo 2022.2.0

berkinet wrote:
Any progress on this?


It was addressed in the 2023.1 release.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Dec 01, 2023 12:46 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: REST API error after updating to Indigo 2022.2.0

jay (support) wrote:
berkinet wrote:
Any progress on this?


It was addressed in the 2023.1 release.
Excellent. Thanks.

Who is online

Users browsing this forum: No registered users and 7 guests