Parameters are now supported via IFTTT, Tasker, and curl API's
-
Now you can send parameters to your commands via the API's.
You'll need to upgrade your agent, then enable parameters on each command you want to be able to send parameters to. For security, it's turned off by default.
Here's the format on a Linux box or Mac (uses single-quotes):
curl -X POST https://www.triggercmd.com/api/run/triggerSave -H 'authorization: Bearer (insert token here)' -H 'content-type: application/json' -d '{"computer":"(insert computer name here)","trigger":"notepad","params":"russ.txt"}'
Here's an actual command I tested on my Windows box. Notice 2 things:
- Curl on Windows uses double quotes
- Because the body of this POST is in JSON format, you have to use backslashes (\'s) to "escape" some characters including backslashes and quotes.
curl -X POST https://www.triggercmd.com/api/run/triggerSave -H "authorization: Bearer (token from instructions page)" -H "content-type: application/json" -d "{\"computer\":\"DS\",\"trigger\":\"notepad\",\"params\":\"c:\\users\\Russ\\.TRIGGERcmdData\\commands.json\"}"
You can also pass the "param" value as a URL parameter like this:
curl -X POST https://www.triggercmd.com/api/run/triggerSave?params=russ.txt -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjU4NzczYTE5NzFiMThlMGIwYmZjMDM3NiIsImlhdCI6MTUwNDM4MDcyMX0.KO9o8UZz3NX_8y0EcTNrX9LPz819WRHtMP3qrshA6hY" -H "content-type: application/json" -d "{\"computer\":\"DS\",\"trigger\":\"notepad\"}"
-