peterathans Posted October 4, 2024 Posted October 4, 2024 After reading a similar thread, I've become interested in using the iOS Shortcuts support to trigger a REST command and run a program (or a Then or Else). I was able to trigger the program from a Chrome tab using the simple command http://192.168.160.31:8080/rest/programs/0009/runThen But making a shortcut for Get contents of and using the same command as above (and with a GET method), nothing happens. Possibly it's because the first time I ran this in Chrome I was prompted for a username and password, but on the iPhone I didn't get challenged. Probably a simple answer to this, but hard to find a solution online. Any help would be appreciated! Quote
Guy Lavoie Posted October 5, 2024 Posted October 5, 2024 You can encode the username and password into the http GET string, like this: http://admin:<password>@192.168.160.31:8080/rest/programs/0009/runThen replace <password> with the actual password Quote
Solution Guy Lavoie Posted October 5, 2024 Solution Posted October 5, 2024 If you can construct multiline URLs, the better way is to encode the username and password as a base 64 value, and include it as a parameter. Browsers do this internally. It looks like this: GET /rest/programs/0009/runThen HTTP/1.0 Host: 192.168.160.31:8080 Authorization: YWRtaW46YWRtaW4= That authorization value is the result of encoding "admin:admin" You can encode your own userid:password here https://www.base64encode.net/ Quote
maxnorth Posted October 5, 2024 Posted October 5, 2024 See the screenshot. This updates the value of a variable. Slightly different than the "run" command you want, but the principles are the same. The last bit is the trickiest. Add a header, type "Authorization" and then type "Basic" and then add your encoded password by inserting the variable. Quote
wrj0 Posted October 6, 2024 Posted October 6, 2024 @maxnorth Many thanks for providing this shortcut; something I'd really like to get it to work for me. I've implemented the shortcut on my iPhone as shown in your screenshot. It seems that I have the Authorization set correctly, since if I change my portal username or password by 1 character in the Userpw key, the shortcut returns: "user authorization not valid." With the correct portal username and password the shortcut returns: "Requested ISY not found in the user's domain." I've compared the BaseURL encoded value generated by the shortcut and it is identical to that provided by https://www.base64encode.net/ using the format myportalusername:myportalpassword I do have two devices configured in the portal, an eisy and a Polisy. How do I specify the desired device in the shortcut BaseURL dictionary key? My entry for that key is: https://my.isy.io/isy/ Quote
wrj0 Posted October 6, 2024 Posted October 6, 2024 Figured it out. The BaseURL to specify the device is: BaseURL https://my.isy.io/isy/longkeyfromtheportal/ Shortcut works after adding the long portal key for the specific device to the BaseURL. Thanks again @maxnorth for the shortcut. Quote
peterathans Posted October 7, 2024 Author Posted October 7, 2024 (edited) Thanks for the help, got it working! Edited October 7, 2024 by peterathans Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.