Jump to content

iOS shortcut support to trigger a program


Go to solution Solved by Guy Lavoie,

Recommended Posts

Posted

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!

Posted

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

  • Solution
Posted

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/

Posted

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.

Screenshot 2024-10-04 at 8.12.57 PM_001.jpg

 

Posted

@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/  

Posted

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.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...