How to perform HttpGet with basic authentication


(fxstein) #1

Hi,

Still new to the world of Smartthings. I am building a bridge to INSTEON/ISY and need to be able to perform basic http authentication for my RESTful calls.

Could not find an example or description of how to do that with the httpGet method.

Thanks!


(Brian Steere) #2

If it’s just basic auth, you should be able to include username/pass in the url (http://user:pass@example.com).

Otherwise you may have to build the Authorization header.


(fxstein) #3

Learning here. Did not realize at first that the Http calls are all external only and not through the hub. Was not the authorization that was the problem, but the fact that my local IPs and DNSs are not visible to the Http calls of SmartThings.

HubAction … it is. Just very painful do deal with it as the API is very much incomplete. Finally found solutions for the 10.x.x.x IP address problem, as well as the HEX conversion - none of which should be required in the first place, but it is what it is. Many thanks to @pstuart for his research and various solutions.

Also realized that I probably cannot do a custom device type for INSTEON over ISY but require a fairly elaborate and complex Service Manager. Nothing is ever as easy as it seems at first. :wink:


(Mark) #4

@fxstein Did you ever get your INSTEON/ISY bridge working?

I have figured out the authentication and I have groovy code that turns devices on and off… but still can’t get the Hubaction to actually send the HTTP request.

If the device type won’t send the command I don’t think creating the service manager will do any good.


(Geno) #5

Will they ever complete the API docs?