script-server icon indicating copy to clipboard operation
script-server copied to clipboard

Feature request : initiate a script from url

Open Mrdindon opened this issue 3 years ago • 3 comments

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

Mrdindon avatar Jun 15 '22 13:06 Mrdindon

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?

bugy avatar Jun 15 '22 19:06 bugy

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 ?

Mrdindon avatar Jun 15 '22 19:06 Mrdindon

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

bugy avatar Jun 16 '22 12:06 bugy