I have read in the documentation
Does this mean that my XML is converted to JSONpostData: Optional. When doing a POST this data will be the payload of the request (body). If you provide a Lua table then this will automatically be converted to json and the request-header application/json is set. So no need to do that manually.
Code: Select all
local function url_encode(str)
if (str) then
str = string.gsub (str, "\n", "\r\n")
str = string.gsub (str, "([^%w %-%_%.%~])",
function (c) return string.format ("%%%02X", string.byte(c)) end)
str = string.gsub (str, " ", "+")
end
return str
end
local press = '<key state="press" sender="Gabbo">PRESET_4</key>';
press = url_encode(press)
domoticz.openURL({
url = 'http://192.168.***.***:8090/key',
method = 'POST',
callback = 'Retrieved',
postData = press
})
I want to use this to start my Bose Soundtouch (I am not able to get the library that is available working)