Adding Thing (with Channels) via API

  • Platform information:
    • Hardware: raspberry 4B
    • openHAB version: 4.0.2

I’m trying to use the REST API (through execute actions.HTTP… also tried through REST API Explorer) in order to add/update a Thing with Channels.

Using the things endopoint, I can get it to work without Channels.

{
  "UID": "mqtt:topic:_:F",
  "thingTypeUID": "mqtt:topic",
  "bridgeUID": "mqtt:broker:_",
  "label": "Aperture MQTT",
}

As soon as I am trying to add a channel

{
  "UID": "mqtt:topic:_:F",
  "thingTypeUID": "mqtt:topic",
  "bridgeUID": "mqtt:broker:_",
  "label": "Aperture MQTT",
  "channels": [
    {
      "id": "MAW3",
      "channelTypeUID": "mqtt:contact",
      "label": "DiningRoom_Window Contact",
      "configuration": {
        "transformationPattern": "JSONPATH:$.contact",
        "off": "true",
        "on": "false"
      }
    }
  ]
}

I get a 501 Server Error response:

"{\"error\":{\"message\":\"Cannot invoke \\\"String.split(String)\\\" because \\\"id\\\" is null\",\"http-code\":500,\"exception\":{\"class\":\"java.lang.NullPointerException\",\"message\":\"Cannot invoke \\\"String.split(String)\\\" because \\\"id\\\" is null\",\"localized-message\":\"Cannot invoke \\\"String.split(String)\\\" because \\\"id\\\" is null\"}}}"

I cannot make any sense of it.

Any help is, as always so much appreciated.