Restful API / Plugin

Posted on
Thu Sep 03, 2015 3:42 am
Roland offline
Posts: 11
Joined: Mar 24, 2015

Restful API / Plugin

I have a plugin controlling light scenes. In addition, I want to set up an iOS app to configure the different scenes / lights (40+ Hue, 10 Fibaro RGBW, 16 Z-Wave switches, etc.). I would like to use the Restful Api for communication between the iOS app and the plugin. What do I have to do in the plugin, so that it can send and receive HTTP messages via Indigo? I couldn't find anything in the Restful API document or in the forums.

Or is there any better / easier way?

Posted on
Thu Sep 03, 2015 10:11 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Restful API / Plugin

Server plugins don't have (direct) access to the incoming RESTful API, or any incoming network information on the standard port (8176 by default). We have an old mechanism, IWS plugins, which allows one to write a plugin that can have methods called via the Indigo Web Server (which is what Indigo Touch and the RESTful APIs use). That API predates the current plugins and Indigo Touch iOS client and we don't recommend that since it will definitely change in an upcoming version (maybe not 7, but soon after probably).

Your plugin, of course, can create it's own network listener of course, but then you can't access it via a Reflector (since it's a different port).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Sep 04, 2015 10:29 pm
Roland offline
Posts: 11
Joined: Mar 24, 2015

Re: Restful API / Plugin

Jay, thanks for your quick reply. Then I will try my luck with Twisted and a WSGI framework.

Posted on
Mon Sep 28, 2015 9:40 am
geoffsharris offline
Posts: 45
Joined: Nov 26, 2012

Re: Restful API / Plugin

Trying to find the best place to put this. If using cURL and using auth digest to interact with the RESTful API, you would use something like:

curl -u user:password --digest -X GET http://10.0.1.1:8176/variables/somevariable

If you are getting "access denied", but have no problem using a web browser to access the URL, it is likely that your password has a control character. For example:

curl -u Admin$1:pa$$word --digest -X GET http://10.0.1.1:8176/variables/somevariable
will lead to access denied. :cry: However:

curl -u Admin\$1:pa\$\$word --digest -X GET http://10.0.1.1:8176/variables/somevariable

will work just fine :D . This drove me nuts for a couple of hours. :evil: Hope this saves someone.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 9 guests

cron