HTTP binding - set payload/body

I have a post request which is working fine in postman and even in a rule with sendHttpPostRequest

val url = ""
val token = "oxoxoxoxox"  
val content = '{"deviceSn": "serialnr"}'
val headers = newHashMap("Authorization" -> "Bearer " + token)
var String request = sendHttpPostRequest(url, "application/json", content, headers, 3000)

Now I’m trying to convert this to the http bindng, but I don’t understand where I need to put the content part. (this is the same as body or payload, correct?)
Do I need to put this in the stateContent param in the channel?
If I don’t fill in this param I get

2021-12-22 01:24:19.451 [WARN ] [p.internal.http.HttpResponseListener] - Requesting '' (method='POST', content='null') failed: 500 null

and when I enter my content value, I also get a 500 error

2021-12-22 01:25:23.974 [WARN ] [p.internal.http.HttpResponseListener] - Requesting '' (method='POST', content='org.eclipse.jetty.client.util.StringContentProvider@75c2a206') failed: 500 null

Full thing

UID: http:url:solarman_currentData
label: Solarman currentData
thingTypeUID: http:url
  authMode: BASIC
    - Authorization = Bearer oxoxoxoxox
  ignoreSSLErrors: false
  delay: 0
  stateMethod: POST
  refresh: 30
  commandMethod: GET
  contentType: application/json
  timeout: 3000
  bufferSize: 2048
  - id: SOC_BAP1
    channelTypeUID: http:string
    label: SoC- Battery Pack 1
    description: ""
      stateContent: "deviceSn=serialnr"

What am I missing?

This is usually used to set up a periodic retrieval of data from some remote service, i.e. to update an OH Item’s state.
It’s not like your on-demand sendHttpPostRequest,

is related to you sending a command to an OH ltem, which triggers the HTTP sending.

You might look here -

So are you saying I can’t use the http binding for this purpose?

What does org.eclipse.jetty.client.util.StringContentProvider@3dd04500 actually mean?

What exactly is your purpose, sending a POST when you command an Item? (Having to guess because you didn’t tell us when your rule version runs.)
Then you do not want any stateMethod or refresh, but do need to fix commandMethod

It’s the unique identity of the little job the binding runs to carry out the requested tasks. In this case I think that’s the “every 30 seconds POST” that you set up.

This post request is actualy grabbing data from my solarpanel cloud. So I wanted to trigger this every 5 minutes (now setup every 30s indeed). This post request returns a json offcourse which I wanted to transform into some items.

I already changed commandMethod to POST, but same message.

And to be clear, everything works in a rule, but I thought the HTTP binding is more suiteable for this.

Okay, I did not understand that at all.
Maybe all you need to do is send valid JSON with your request

Needs some quotes in the payload

Tried al kind of possibilities, but can’t figure it out. Will stick with my rule or use another approach


If I understood right, you want to send a HTTP request with a body part. I did something similar, in my case I sent a PUT request containing a JSON payload.

There is no openHAB transformation that allows to send a HTTP body, you need to create a map. To do so place a file in your transformations folder (usually /etc/openhab/transformations) with the name of your choice and the .map extension. As an example let’s use Then put some content where you map the command to an output. i.e.:

ON: { LIGHT=1 }
OFF: { LIGHT=0 }

In the command transformation put the value
Once your channel gets the command ON, the HTTP call with body { LIGHT=1 } will be sent to your device. If the command is OFF, the body will contain { LIGHT=0 }