HTTP PUT request fails

I want to send a simple PUT request to Fibaro.
In Fibaro i am using this simple formula

api.put (baseURL, { properties = { mode = “Cool” }})…and this works

but when i am trying this in HR it fails.

     http.put (baseURL , 
{ properties: {mode:'Cool'} }, 
{ auth: credentials});

i am getting erro 400 bad request.

I am probably wrongly formatting the body or something…

Can you assist a bit please?

(baseURL, and credantials are correct. I am using them in other GET request wihout any problems)

Thanks

Tough to say. Maybe you’re missing a header or something. I would probably take a look at the raw requests in a network analyzer like Wireshark. Compare the data Home Remote is sending vs your other tool. If you are new to plugins, here’s a Fibaro example you can use to study.

Following your example, and grinding through all Fibaro forum topics unfirtunatelly still didn’t help me out of this maze. The PUT requests, are not working. The only thing i know, how ti works in Fibaro. That’s what i have shown above. In that way it works in Fibaro, so i think the problem must be in the HTTP request forming in my HR code. Do you think that the syntax in HR in my example, matches the syntax of Fibaro’s request? Did I create that HTTP call properly formatted in HR?

In my experience with HR put/post errors, it’s usually a header issue. Try this:

http.put (baseURL, 
{ properties: {mode:'Cool'} }, 
{ auth: credentials, headers: { 'content-type': 'application/json' }});