Reading the documentation I understand that the body needs to be a map but the server requires the following JSON to correctly process the request:
{
"attrs": {
"heat_power": 0
}
}
Can the httpPost function handle a nested body? I have tried many many different way to get the above JSON into a map version that works but I just keep getting the following error:
groovyx.net.http.HttpResponseException: status code: 400, reason phrase: Bad Request on line 24 (method on)
I am sure this should be simple to-do but I am pulling my hair out and I am now questioning whether the built in function will process a nested body request
Thanks @thebearmay but this doesn't seem to be working. If a debug the created string I get the following:
{"attrs":[{"heat_power":"0"}]}
modifying the code slightly I managed to get the following string:
{"attrs":{"heat_power":0}}
However I am assuming this is because although I want the body request to the server to be the exac string that we have created the function needs that passed as a mapped parameter and therefore the httpPost request is not correct.
Please forgive me if my understanding is not correct as I am still trying to get my head around hubitat syntax