Trying to get data trough simple http GET. V7 changes?

Posted on
Wed Jan 04, 2017 1:05 am
superholz offline
Posts: 52
Joined: Jun 10, 2015
Location: The Netherlands

Trying to get data trough simple http GET. V7 changes?

Hi there,

has the web server of indigo been changed in indigo version 7?

I had a simple GET request implemented in a microcontroller (particle spark) but after the update to indigo 7 (I also updated my router in internal network) the GET request is not working. The microcontroller fails to connect to the indigo web server. The webserver is available within the home network with another computer.

The request is structured as such:

GET /devices/T%20Balkon.json HTTP/1.1
Host: indigoIP:8176
Authorization: Basic <password>
Connection: close

anyone an idea?

thanks in advance!

Posted on
Wed Jan 04, 2017 6:49 am
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Trying to get data trough simple http GET. V7 changes?

As far as I know, Indigo server has always used Digest authentication (not Basic). Did you have authentication turned off in your V6 install and V7 turned it back on?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Jan 04, 2017 8:54 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Trying to get data trough simple http GET. V7 changes?


Image

Posted on
Wed Jan 04, 2017 10:23 am
superholz offline
Posts: 52
Joined: Jun 10, 2015
Location: The Netherlands

Re: Trying to get data trough simple http GET. V7 changes?

Thanks for the quick replies! I did not even remember I did this step in V6 but I think that is indeed the case. :roll:

Just curious: what I had to do if I would like to prevent enabling basic authentication and still retrieving data with the micro controller?

Posted on
Wed Jan 04, 2017 5:37 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Trying to get data trough simple http GET. V7 changes?

Well, if your controller could receive pushed data that's one way (say, listen on a socket then have a script in Indigo that pushes a change to the socket). Another would be if your controller could access/read a file from a shared disk somewhere you could have a script write the data out. You could also build a simple plugin that opens a network port and listens for a request for data then sends it out (mirroring what the RESTful API does but in a much smaller and more vertical way).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Jan 05, 2017 4:11 pm
superholz offline
Posts: 52
Joined: Jun 10, 2015
Location: The Netherlands

Re: Trying to get data trough simple http GET. V7 changes?

Jay, thanks a lot for this new ideas!

At the moment I'm trying to get the old solution running. I added the webserver file as in the previous version. When starting the indigo server I indeed see in the log that basic auth is activated.
But no matter what, the micro controller does not connect to the web server with my previously working code.

I have the idea that there goes something wrong with the authentification procedure. In the previous version i used user and password encoded in base64. Is that still the right thing to do. Are there any changes in the webserver made from the last version to this version that could have effect on what I'm trying to do?

Thanks for ideas!

Posted on
Thu Jan 05, 2017 5:46 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Trying to get data trough simple http GET. V7 changes?

Um, no, base64 encoding should never have worked - perhaps you made some other changes outside the ones Matt outlined above? Anyway, you just pass the username and password on the URL:

http://username:password@hostname/

Note, if it's not https then they'll be sent in the clear.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Jan 05, 2017 8:47 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Trying to get data trough simple http GET. V7 changes?

The URL trick (putting username/password in the URL) is supported by some browsers, but for devices that are having to handle the HTTP protocol at a lower level you do base64 encode the credentials for HTTP Basic Authentication. Nothing has changed in how Indigo handles it (basic authentication) between v6 and v7 though, so I'm not sure why it isn't working if it used to work.

Image

Posted on
Fri Jan 06, 2017 11:06 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Trying to get data trough simple http GET. V7 changes?

Ah, I stand corrected! :)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Jan 09, 2017 12:45 am
superholz offline
Posts: 52
Joined: Jun 10, 2015
Location: The Netherlands

Re: Trying to get data trough simple http GET. V7 changes?

Hi, I only now saw the post about the URL encoding of the password. I'm a bit confused now. What should work URL-encoded, base64 or both. I always used base64 and that worked until the issue.

Is it possible to tell the indigo webserver to work without having to identify with user and password when the request comes from the home network 192.168.0.X?

Posted on
Mon Jan 09, 2017 8:33 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Trying to get data trough simple http GET. V7 changes?

The password is base64 encoded for HTTP basic authentication per its spec. That hasn't changed. Nothing has changed about how Indigo handles HTTP authentication, so I'm not sure why it isn't working. Are you sure you setup the IndigoWebServer.conf file correctly? Did you stop and restart the Indigo Server after making the change?

Image

Posted on
Mon Jan 09, 2017 12:03 pm
superholz offline
Posts: 52
Joined: Jun 10, 2015
Location: The Netherlands

Re: Trying to get data trough simple http GET. V7 changes?

...I copied the file I had created for V6 into the folder for V7. I stopped and started the server and also see in the log that basic auth is activated. During the same time I also implemented a new Router but I do not see how this could effect the communication.

Posted on
Mon Jan 09, 2017 1:18 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Trying to get data trough simple http GET. V7 changes?

Do you have any type of logging/results from your client/microcontroller that show exactly how it is failing?

Image

Posted on
Thu Jan 12, 2017 3:12 pm
superholz offline
Posts: 52
Joined: Jun 10, 2015
Location: The Netherlands

Re: Trying to get data trough simple http GET. V7 changes?

Matt, I worked on finding another way to get the temperature value to my microcontroller. I send the variable via a POST request from a Python script. Particle offers a cloud solution to achieve that. Advantage is that I can make the system more safe by stopping using basic auth. Would have been nicer though to send values around in the home network. Now it goes to the internet and back to my device. Well, it works. I still do not now why my first solution stopped working. Debugging capabilities are a bit limited on the microcontroller, or at least I do not know how to get to the data to find out why it failed.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests