Bad request 400 - while create Item

  • Platform information:
    • Hardware: PI 4
    • OS: openHABian v1.7.4
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version: openHAB 3.4.0 and openHAB 3.3.0

Try to crearte Item from Things menu (ZWave things):
Things-> Select for example 003: FGS223 Double Switch 2 → Channels → Select Switch 1 → Select “Add link to Item…” → “Create a new Item” → Click “Link”

Nothing happend.
Debug web browser: Network PUT /rest/items/003FGS223DoubleSwitch2_Switch1 response : HTTP 400 Bad Request

Payload:

{“name”:“003FGS223DoubleSwitch2_Switch1”,“label”:“Switch 1”,“category”:“Switch”,“groupNames”:[],“type”:“Switch”,“tags”:[“Point”]}

When I choose Existing Item no problem, assign as expected.

I debug manually “Add Item” and discover that using not documented field create:false (working correct)

Example:
{“name”:“NewItem”,“label”:“New Item”,“category”:“”,“type”:“String”,“groupNames”:[],“tags”:[],“created”:false}

Does the problem persist when you restart OH and force a reload of MainUI in the browser?

Yes, no matter restarts OH, another browser or laptop.

But for example for Denon/Maratz Binding there is no problem with creating item.

So I thing problem is only in ZWave Binding

Ok, I know where is the problem. When I add things from Inbox, and change name for thing starting from number like “003ExampleName”, then problem exist, as I explained at the beginning.
Maybe solution would be some validation while adding things to avoid such problem

There is no restriction in using a number to start the Thing ID portion of a Things UID. In fact the docs show examples that do this.

But there is a restriction in creating an Item that starts with a number. This has always been the case but in OH 3.3 it’s now enforced. That 400 error is the validation that the Item name is not proper, though I would have expected something meaningful to be printed to openhab.log explaining why the Item creation request was refused. You didn’t mention any logs.

If you “create equipment from thing” or “create points from thing” or otherwise create an Item when creating the link, the default name for the Item will come from the Thing ID. Since the Thing ID starts with a number, the Items will start with a number in that case too which will be forbidden when you submit.

Just ran into this issue as well. The error message (“Bad request.”) really is not very informative, had to find this thread to solve the issue - so that was really helpfull, just a few minutes lost. Would neverthelss be great to have input validation on the item ID or a more informative error message.