[ANSWERED]RestFull URL by device id instead of device name ?

Posted on
Mon Jul 13, 2015 2:00 am
PeteVis offline
Posts: 180
Joined: Jun 19, 2015

[ANSWERED]RestFull URL by device id instead of device name ?

Is there a way to address a device by id number instead of it's device name ?

The reason I ask is that when I move stuff arount in my network, they are likely to be renamed... and this would break any restfull url that is pointing at that device.
If I could get the restfull url's to work by id number, that would never break.

i.e. this works :
http://10.0.1.10:8176/devices/Power%20S ... method=put

but this does not :
http://10.0.1.10:8176/devices/717928476 ... method=put


Question 2:
Is it possible to tell Indigo server to trust certain IP numbers from my local network ?
Since it seems not possible to put digest authentication inside a http url, it would be nice if I could tell Indigo which local computers to trust so no authentication is needed for these IP numbers.

I can trigger actions with the curl command inside a shell script like this:
curl -u user:password --digest -X PUT -d isOn=1 http://10.0.1.10:8176/devices/Power%20Switch%20Bedroom

... but it would be so much more convenient if I could just use the URL's like mentioned above.

Posted on
Mon Jul 13, 2015 10:07 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: RestFull URL by device id instead of device name ?

PeteVis wrote:
Is there a way to address a device by id number instead of it's device name ?


No, the RESTful API predates the Python API (which is when we introduced object IDs). We have a task to update that API so that it uses the more modern Python APIs (which will add object ID's) but we don't have a ETA for that.

PeteVis wrote:
Is it possible to tell Indigo server to trust certain IP numbers from my local network ?
Since it seems not possible to put digest authentication inside a http url, it would be nice if I could tell Indigo which local computers to trust so no authentication is needed for these IP numbers.


There's no built-in way, though some users are using Apache reverse proxies to perform some extra authentication.

I have to say, though, I'm not understanding the convenience difference, aside from some extra keystrokes when creating your script (or whatever you're using the commands from), between using the direct URL and curl... :?:

[MODERATOR NOTE] moved to the client API forum.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Jul 13, 2015 12:31 pm
PeteVis offline
Posts: 180
Joined: Jun 19, 2015

Re: [ANSWERED]RestFull URL by device id instead of device na

Hi Jay,
About my question 2, it's just lazyness on my part.

I have a remote part out in the garden that I cannot possible extend my zwave network to.
So I am experimenting with cheap raspberries and Domoticz....
Aside from lot's of hair pulling, the concept and theory work. I can set up a remote zwave network and have it perform actions in Indigo.
Domoticz has a simple interface where you can perform actions, either via a http url, or a script function.

i.e. when a remote pir sensor is tripped, I can have it trigger an action either with a URL or a script to set a variable in Indigo for example.

However the script function takes a few extra steps to perform. I need to create different shell script files for each action I would like to trigger, whereas when I could just use a simple URL command, I would never have to create external script files.

I'm not sure I'm explaining this well, but in short, the restful url's really facilitate remote zwave networks.
But the curl command works and I'll go that route.

Addressing devices by ID rather than by name is much more important, so if you ever get that working, that would be really nice.

Posted on
Mon Jul 13, 2015 11:05 pm
lalisingh offline
Posts: 166
Joined: Mar 27, 2007

Re: [ANSWERED]RestFull URL by device id instead of device na

PeteVis wrote:
Question 2:
Is it possible to tell Indigo server to trust certain IP numbers from my local network ?
Since it seems not possible to put digest authentication inside a http url, it would be nice if I could tell Indigo which local computers to trust so no authentication is needed for these IP numbers.

I can trigger actions with the curl command inside a shell script like this:
curl -u user:password --digest -X PUT -d isOn=1 http://10.0.1.10:8176/devices/Power%20Switch%20Bedroom

... but it would be so much more convenient if I could just use the URL's like mentioned above.



Cool question:

I am currently experimenting putting of critical home automation devices behind a small router and using firewall rules and intelligent routing to restrict access. So in this scenario I see creating an address list of IP's that would be allowed access while all other traffic would be blocked and all failed attempts would be logged. To be clear if I have 10 critical devices I would end up with 10 routers. The plummeting cost of this hardware is making this possible.

Having the correct network topology with VLANs is another way of achieving this goal. The decision are made at the router in either case.

[url]https://www.VillageWorker.com[/url]
Extreme data analytics, Sensing, Control integration work.
Indigo • Barix • Kentix • Mobotix • Mikrotik • Apple

Posted on
Tue Jul 14, 2015 12:25 am
PeteVis offline
Posts: 180
Joined: Jun 19, 2015

Re: [ANSWERED]RestFull URL by device id instead of device na

What is strange in my situation (or maybe it was by design), is that these are all local computers.

My Indigo Mac is running at 10.0.1.10, while the raspberry is in the same network at 10.0.1.25, yet the raspberry needs to authenticate with the Indigo Mac before it can do anything.
It would be cool for the less experienced if there was just a preference that said "allow local traffic without authenticating", or something like that, without the need to go into firewall or proxy configurations.

Posted on
Tue Jul 14, 2015 12:33 am
lalisingh offline
Posts: 166
Joined: Mar 27, 2007

Re: [ANSWERED]RestFull URL by device id instead of device na

PeteVis wrote:
What is strange in my situation (or maybe it was by design), is that these are all local computers.

My Indigo Mac is running at 10.0.1.10, while the raspberry is in the same network at 10.0.1.25, yet the raspberry needs to authenticate with the Indigo Mac before it can do anything.
It would be cool for the less experienced if there was just a preference that said "allow local traffic without authenticating", or something like that, without the need to go into firewall or proxy configurations.



You have that choice today. Turn off ' requiring a password' on the Indigo server. Move all your security to the border/edge router and stop using any access other than VPN from the internet. No GoPrizm for instance.

If you go this way I would suggest knowing very well who gets onto your local network.

[url]https://www.VillageWorker.com[/url]
Extreme data analytics, Sensing, Control integration work.
Indigo • Barix • Kentix • Mobotix • Mikrotik • Apple

Posted on
Tue Jul 14, 2015 8:13 am
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: [ANSWERED]RestFull URL by device id instead of device na

You have that choice today. Turn off ' requiring a password' on the Indigo server. Move all your security to the border/edge router and stop using any access other than VPN from the internet. No GoPrizm for instance.

That's fairly dangerous advice from a security standpoint... I grant you that a target attack on an individual is not highly likely, but that makes for a very easy targeted attack. Not to mention the bored teenager down the street with too much summer time on his hand who decides to see what he can see on your WiFi! Its virtually impossible to keep someone off your WiFi.

Adam

Posted on
Tue Jul 14, 2015 12:49 pm
PeteVis offline
Posts: 180
Joined: Jun 19, 2015

Re: [ANSWERED]RestFull URL by device id instead of device na

Ok, I understand now.. so basically no traffic is to be trusted.

I've gone ahead and set up different curl scripts for my scenario.. seems to be working fine.
Thanks for all the info and insight.

Posted on
Sat Jan 23, 2016 7:15 am
davinci offline

Re: [ANSWERED]RestFull URL by device id instead of device na

Will support for ID in the API ever be available for Indigo 6??

This would be much more safe!
http://127.0.0.1:8176/devices/101410280 ... method=put

Posted on
Sat Jan 23, 2016 12:35 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: [ANSWERED]RestFull URL by device id instead of device na

Not in version 6, but lots of improvements to the RESTful API are definitely on our feature request / ToDo list further out.

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest