Exec binding: "curl post with message body" need help formatting

hi all,

i need to send a HTTP POST request with message body to an ip in my local network and i don’t know how to do that.

the http-binding can’t do that as mentioned in the http binding documentation:

It is currently not possible to send a message body, as one might do typically with the POST HTTP method. An alternative solution, in the case where the receiving web server requires a message body, might be to execute curl … -d using the exec binding.

so i need to use the exec binding…

the message body that has to be sent is this one:

{“communication_base_params”:{“type”:“Message”,“fallback”:false,“via”:“OH”},“sender”:“PRiVATE_KEY”,“ttl”:0,“message”:“wakeup”,“version”:“1.63”}

i tried the following:
Switch tabletdisplay "Tablet Displaysteuerung" { exec=">[curl -XPOST http://192.168.178.29:1817 -d '{\"communication_base_params\":{\"type\":\"Message\",\"fallback\":false,\"via\":\"OH\"},\"sender\":\"PRIVATE_KEY\",\"ttl\":0,\"message\":\"hello\",\"version\":\"1.63\"}']"}

can somebody with “curl knowledge” show me how the request should be defined?

thx,
stefan

Seems that the call is malformed, looking at cURL-Tutorial there is no -XPOST and the URL should be the last parameter.

looking at the tutorial you mentioned i changed my curl command but could’nt get it to work.

not using exec binding and just using “executeCommandLine” in a rule did the trick;

this works for me:
executeCommandLine("curl@@-H@@Content-Type: application/json@@-d@@{\'communication_base_params\':{\'type\':\'Message\',\'fallback\':false,\'via\':\'OH\'},\'sender\':\'PRIVATE_KEY\',\'ttl\':0,\'message\':\'wakeup\',\'version\':\'1.63\'}@@http://192.168.178.29:1817")