HTTP Post using blockly

Dear all, i am searching for a way to post http requests directly from a blockly rule.
I am using fully kiosk browser on my wall tablet, for this i can set all setting with the http rest api. But i dont want to create a http binding channel and thing for every setting (screen on off, screensaver on off, brightness value, etc).
I created a string channel with a %2$s placeholder, but sending the required string to the linked string item doesn’t work. Is there a way to do this?

Thank you :blush:

use the custom javascript block?

image

This block can be found in Run & Processes

Didnt know that this is possible. I tried it but didnt work. Made a blockly script with inline script. This is how the code tab looks like:

actions.sendHttpPostRequest("http://192.168.0.223:2323/?cmd=screenOn&password=123")

Also tried with a timeout parameter

actions.sendHttpPostRequest("http://192.168.0.223:2323/?cmd=screenOn&password=123", 1000)

But i am getting this in the log

2023-11-19 07:03:14.941 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID '73f0495ef3' failed: org.graalvm.polyglot.PolyglotException: TypeError: (intermediate value).sendHttpPostRequest is not a function

Maybe i am missing something?

Edit: forgot the HTTP after action. Now its working, thank you for your help! :slight_smile:

Which actually has now inspired me to provide blocklies for that. I already started it and the first POC is working well … Coming soon…

Hi stefan, that would be great :smiley:
I was actually searching for a post of you where you maybe already did this :smiley:

Maybe as a request: i do have some lights where i can put on / off (1 / 0), RGB color (0…255,0…255,0…255) and intensity (0…100) in the url. Would be cool if this url can be build up by different separate variables somehow.

The http block won’t help you in building the URL. That is something you need to do yourself by concatenating Strings.

Yes, i think thats fine :slightly_smiling_face: