bugy / script-server

Web UI for your scripts with execution management
Other
1.55k stars 246 forks source link

Feature request : initiate a script from url #556

Open Mrdindon opened 2 years ago

Mrdindon commented 2 years ago

I've made a few scripts available anonymously in my setup but I would need to find a way on how to trigger them directly from the url. Is it possible ?

ie.: http://xxx.xxx.xxx.xxx:5000/script1 or http://xxx.xxx.xxx.xxx:5000/index.html#/scripts/script1 So basically just a way to generate a url that would do the same as pressing the execute button. Maybe that shortcut url could be customized when adding the script itself ? Is this feasible ?

The reason is that I use small esp8266 devices that have small memory capacity to trigger some actions based on rules. ie, if temperature goes up, send a web query. That would be nice to have my esp8266 devices to talk with script-server :)

I use shell2http for now but it is complicate to add / modify scripts shortcut on the fly like in script-server : https://github.com/msoap/shell2http

bugy commented 2 years ago

Hi @Mrdindon you can call it using POST method. Please check this comment (and comments below): https://github.com/bugy/script-server/issues/138#issuecomment-461331583

Would that work for you?

Mrdindon commented 2 years ago

Hi @Mrdindon you can call it using POST method. Please check this comment (and comments below): #138 (comment)

Would that work for you?

Thanks, yes I saw that. sadly my devices doesn't support that. I have to enter a full url for the request (and that url needs to be short enough). This is why I was using shell2http but it is painful to add / update links where scripts-server makes that part so easy ! Would it be hard to add something so that we could specify an url in each command config ?

bugy commented 2 years ago

Unfortunately I have no plan for implementing this API as GET. As I quickly found in google, there should be a possibility to send POST requests from esp8266