@russ,
I did try it after you asked and yes, it working even though there are CORS errors in the console. Once I saw those, I quit troubleshooting, but it appears it is working. Thanks again for your efforts and a great app!
Posts made by Insaneoctane
-
RE: Pass parameters when using bookmark URLs?
-
RE: Pass parameters when using bookmark URLs?
@russ
I can't thank you enough for your time on this issue!
I ran the snippet from the W3 site you linked to, clicked the button and got nothing. To see what was happening (I'm in Chrome) I hit F12 and opened up the developers console and saw CORS errors. Here's a snip from the console:Access to XMLHttpRequest at 'https://www.triggercmd.com/trigger/bookmark?token=(youBookmarktoken)¶ms=Donald Duck' from origin 'https://tryit.w3schools.com' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains the invalid value ''.
VM38:1 Cross-Origin Read Blocking (CORB) blocked cross-origin response https://www.triggercmd.com/trigger/bookmark?token=(youBookmarktoken)¶ms=Donald Duck with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details.
(anonymous) @ VM38:1
send @ jquery.min.js:2
ajax @ jquery.min.js:2
w.(anonymous function) @ jquery.min.js:2
(anonymous) @ tryit_view.php?x=0.3774193121824916:8
dispatch @ jquery.min.js:2
y.handle @ jquery.min.js:2 -
RE: Pass parameters when using bookmark URLs?
@Russ,
Just curious if you ran your script from triggercmd.com domain? -
RE: Pass parameters when using bookmark URLs?
@russ said in Pass parameters when using bookmark URLs?:
https://www.triggercmd.com/trigger/bookmark?token=bookmarktoken¶ms=foo
Russ, that is fantastic that you could add that capability so quickly! I tried the API too and I'm getting the same CORS error. I'm SO not that knowledgeable with CORS/networks stuff, but I think the CORS error is because my javascript isn't being allowed to GET the bookmark (or API) without a proper header from triggercmd.com domain???? Have you seen or dealt with this before?
Here's the errors I'm seeing in the dev console from chrome:
Access to fetch at 'https://www.triggercmd.com/trigger/bookmark?token=XXXXX¶ms=75' from origin 'http://127.0.0.1' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains the invalid value ''. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
XXXX.html:74 Cross-Origin Read Blocking (CORB) blocked cross-origin response https://www.triggercmd.com/trigger/bookmark?token=XXXXX¶ms=75 with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details.
-
Pass parameters when using bookmark URLs?
I have a powershell script that I want to activate via an html button. I have seen an example on this but need to figure out how to pass a parameter via the button to my powershell script via TC. Specifically, I will build the html page that prompts for an integer between 50 and 100 and sends the bookmark URL with this parameter to TC which launches my powershell script passing the parameter. My powershell script is already complete and expects to be launched with a command line parameter. I also have it listed as an action in TC... I just need some help putting these pieces together!
-
RE: Can't make GET API work?
Ok, I solved it but I made 3 changes and am not sure which it was:
- Got rid of parenthesis in token (obviously this is a must)
- Renamed trigger without underscore "_"
- Changed trigger to foreground from background so that it showed on the webpage
-
Can't make GET API work?
So I'm new to triggercmd. Here's what I'm trying to do (and failing at). I want to verify that my GET command works before using smartthings to do the same. I'm just pasting this into my browser and it's returning that the token is invalid. So then I went to the instructions page and I noticed that the token changes every time I refresh??? What am I missing?
Here's my command pasted into browser:
Result:
{"err":"Invalid Token!"}I tried both with and without the parenthesis "(" and ")" around the token...same result.