RESTFUL Api Issues

Posted on
Sat Nov 14, 2015 3:58 pm
nanobots offline
Posts: 43
Joined: Apr 28, 2015

RESTFUL Api Issues

Hello,

Are there any known bugs with the current version of the Indigo 6.1.4 and the RESTFUL apis? I'm having several issues and can't figure out what's going on.

1. Indigo Touch reports all devices are either "Plugin not installed" or "interface disabled" even though things are working fine through the remote connection on my laptop
2. When I visit the RESTFUL apis (http://<IP>/devices/X.json), I'm not being prompted for credentials, even after clearing saved creds out, using an incognito window, using CURL from the command line etc.
3. The device list (http://10.0.0.7:8176/controlpage?name=_ ... useJS=True)/control pages aren't working. They display the status of things fine, but if I click any links to change the status of a devices (i.e. turn a lamp off) it doesn't work. Looking at the server response, I'm getting redirected:

Code: Select all
HTTP/1.1 303 See Other
Content-Length: 124
Vary: Accept-Encoding
Server: IndigoWebServer/5.0
Location: http://10.0.0.6:8176/devices/Hall Light
Allow: GET, HEAD, POST, PUT
Date: Sat, 14 Nov 2015 21:54:40 GMT
Content-Type: text/html;charset=utf-8

This resource can be found at <a href='http://10.0.0.6:8176/devices/Hall Light'>http://10.0.0.6:8176/devices/Hall Light</a>.


4. A script that I've used in the past to authenticate to the server and update devices using the restful urls is no longer working. Specifically it's failing when attempting to authenticate using digest authentication saying the server is not returning the authentication header. It appears I'm getting the same redirect response as above.
5. Also have tried the curl commands from the wiki. Example:

Code: Select all
curl -u user:password --digest -X PUT -d isOn=0 "http://10.0.0.6:8176/devices/Hall%20KPL"


This is also causing a redirection:

Code: Select all
This resource can be found at <a href='http://10.0.0.6:8176/devices/Hall KPL'>http://10.0.0.6:8176/devices/Hall KPL</a>.


I've tried restarting the server several times. Also tried removing the authentication credentials, putting them back in, and restarting the server again. Hasn't seemed to do anything.

Thanks

Posted on
Sat Nov 14, 2015 4:16 pm
webdeck offline
Posts: 436
Joined: May 07, 2005

Re: RESTFUL Api Issues

Sorry to jump onboard your thread, but there's another issue with the RESTful API I wanted to add, as I had to work around it for my Amazon Echo integration. It doesn't support the standard URL encoding of using a plus sign to replace a space. So, even though "http://xxx.xxx.xxx.xxx/devices/Kitchen+Light.json" is a valid URL encoding , it doesn't work. You have to use %20 to represent spaces ("http://xxx.xxx.xxx.xxx/devices/Kitchen%20Light.json") It would be nice if they both worked.

-Mike

Posted on
Mon Nov 16, 2015 11:49 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: RESTFUL Api Issues

nanobots wrote:
Are there any known bugs with the current version of the Indigo 6.1.4 and the RESTFUL apis? I'm having several issues and can't figure out what's going on.


There are a few JSON encoding bugs, but other than that none that we know of.

nanobots wrote:
1. Indigo Touch reports all devices are either "Plugin not installed" or "interface disabled" even though things are working fine through the remote connection on my laptop


Are you sure Indigo Touch isn't connecting to a different Indigo Server on a different Mac? If Indigo Touch is showing those two things, that's what the Indigo Server it's connected to is telling it. In the Mac client, they would also show up in red with the same error in the status column. If not, then the only explanation I can think of is that Indigo Touch is connecting to a different server. Remember that Indigo is a client-server app, so the server can be running as a background process without the UI.

nanobots wrote:
2. When I visit the RESTFUL apis (http://<IP>/devices/X.json), I'm not being prompted for credentials, even after clearing saved creds out, using an incognito window, using CURL from the command line etc.


Again, make sure you're connecting to the right server. If you have authentication turned on in the Start Local Server dialog, then it will always perform digest authentication.

nanobots wrote:
3. The device list (http://10.0.0.7:8176/controlpage?name=_ ... useJS=True)/control pages aren't working. They display the status of things fine, but if I click any links to change the status of a devices (i.e. turn a lamp off) it doesn't work. Looking at the server response, I'm getting redirected:


Yet another clue that you're pointing to the wrong server somehow.

nanobots wrote:
4. A script that I've used in the past to authenticate to the server and update devices using the restful urls is no longer working. Specifically it's failing when attempting to authenticate using digest authentication saying the server is not returning the authentication header. It appears I'm getting the same redirect response as above.


Ditto. I'm pretty sure multiple servers is your issue.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Nov 16, 2015 11:58 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: RESTFUL Api Issues

webdeck wrote:
Sorry to jump onboard your thread, but there's another issue with the RESTful API I wanted to add, as I had to work around it for my Amazon Echo integration. It doesn't support the standard URL encoding of using a plus sign to replace a space. So, even though "http://xxx.xxx.xxx.xxx/devices/Kitchen+Light.json" is a valid URL encoding , it doesn't work. You have to use %20 to represent spaces ("http://xxx.xxx.xxx.xxx/devices/Kitchen%20Light.json") It would be nice if they both worked.

-Mike

The general rule is that form data is encoded using either %20 or "+" and URLs (as specified in RFC 1738) are encoded with %20. The query component of a URL (after the ?) can contain either as it's analogous to form data but technically the path portion should use %20.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Nov 16, 2015 11:52 pm
webdeck offline
Posts: 436
Joined: May 07, 2005

Re: RESTFUL Api Issues

jay (support) wrote:
webdeck wrote:
Sorry to jump onboard your thread, but there's another issue with the RESTful API I wanted to add, as I had to work around it for my Amazon Echo integration. It doesn't support the standard URL encoding of using a plus sign to replace a space. So, even though "http://xxx.xxx.xxx.xxx/devices/Kitchen+Light.json" is a valid URL encoding , it doesn't work. You have to use %20 to represent spaces ("http://xxx.xxx.xxx.xxx/devices/Kitchen%20Light.json") It would be nice if they both worked.

-Mike

The general rule is that form data is encoded using either %20 or "+" and URLs (as specified in RFC 1738) are encoded with %20. The query component of a URL (after the ?) can contain either as it's analogous to form data but technically the path portion should use %20.


I learned something new! I didn't realize that the plus sign convention was specific to application/x-www-form-urlencoded. Thanks!

-Mike

Posted on
Tue Nov 17, 2015 12:36 pm
nanobots offline
Posts: 43
Joined: Apr 28, 2015

Re: RESTFUL Api Issues

Thanks Jay, totally right. Somehow I got a server started on my laptop and was pointing to that.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest

cron