I ended up using BAT file and send the text as paramater INside I have curl command. Also one critical thing in each BAT including the one for starting OH is to have
chcp 65001
at the start. This force unicode and I can send Cyrilic now.
Your curl example strips the " but maybe the server does not care, I tested lot of combination using a small http server for debugging the requests and it was not working.
I think you cannot add the HTTP header when using item configuration/HTTP binding
(anyone to prove me wrong is welcome, it’s long ago I tried so things may well have changed).
Here’s an example to do it with a rule:
rule "Landroid command"
when
Item Landroid_Command received command
then
val String URL = "http://admin:0000@landroid/jsondata.cgi"
var String jsondata = 'data=[[\"settaggi\",' + Landroid_Command.state.toString + ',1]]'
logInfo("rules", "Sending Command " + Landroid_Command.state + " to Landroid.")
sendHttpPostRequest(URL, "application/x-www-form-urlencoded", jsondata)
end
rule "Turn Kodi Subtitle Off"
when
Item myKodi_subtitle_off received command OFF
then
val String URL = "http://192.168.0.12:8080/jsonrpc"
var String contenttype = "application/json"
var String jsondata = '{"jsonrpc":"2.0","id":1,"method":"Player.SetSubtitle","params":{"playerid":1,"subtitle":"off"}}'
logInfo("Kodi subtitle", "Sending Command " + myKodi_subtitle_off.state + " to myKodi_subtitle_off.")
sendHttpPostRequest(URL, contenttype, jsondata)
end
rule "Turn Kodi Subtitle On"
when
Item myKodi_subtitle_on received command ON
then
val String URL = "http://192.168.0.12:8080/jsonrpc"
var String contenttype = "application/json"
var String jsondata = '{"jsonrpc":"2.0","id":1,"method":"Player.SetSubtitle","params":{"playerid":1,"subtitle":"on"}}'
logInfo("Kodi subtitle", "Sending Command " + myKodi_subtitle_on.state + " to myKodi_subtitle_on.")
sendHttpPostRequest(URL, contenttype, jsondata)
end