Java Runtime Environment: which java platform is used and what version
openHAB version: Openhabian 2.5
I am trying to use the “sendHttpGetRequest” but unfortunately that is not yet supported in openhab2.5.
my original rule was:
var url = “http://xx.xx.xx.xx/YamahaExtendedControl/v1/dist/startDistribution?num=0”
var contenttype = “application/json”
var POSTrequest ={“group_id”:“6315c19889f14ac78ce799b77b5eca9f”,“type”:“add”,“zone”:“main”,“client_list”:[“xx.xx.xx.xx”]}’
result = sendHttpGetRequest(url, contenttype, POSTrequest)
but that doesnt seem to work. i get an {“response_code”:4} as result. ( supposed to be 0)
2020-03-23 20:23:35.690 [WARN ] [lipse.smarthome.io.net.exec.ExecUtil] - Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program “/etc/openhab2/SHscripts/MusiccastON.sh” (in directory “.”): error=2, No such file or directory)
If i run the sh script from the command line it works awesome.
Is it a user right issue? is it trying to run as user openab and it cant execute curl?
what am i missing?
First, if you’re trying to send JSON, this isn’t going to work, as it isn’t JSON. Perhaps there’s a copy/paste error here in the forum and your actual code is fine, but you need to verify.
Second, it looks like you’re trying to execute a POST, but calling GET instead. You perhaps should be calling sendHttpPostRequest ?
Thanks. Yes the goal is a Get request, but i used the variable from ‘POSTrequest’
you are right I’m missing a piece here, sorry.
var url = “http://xx.xx.xx.xx/YamahaExtendedControl/v1/dist/startDistribution?num=0”
var contenttype = “application/json”
var POSTrequest = ‘{“group_id”:“6315c19889f14ac78ce799b77b5eca9f”,“type”:“add”,“zone”:“main”,“client_list”:[“xx.xx.xx.xx”]}’
result = sendHttpGetRequest(url, contenttype, POSTrequest)