Error 400 when getting Item State in browser or with python requests

curl

sudo docker run --rm curlimages/curl:8.00.1 https://demo.openhab.org/rest/items/Temperature_FF_Daughter/state

Output: 19.1 °C

browser

when I enter this URL:

https://demo.openhab.org/rest/items/Temperature_FF_Daughter/state

I get a 400 with no further information:


Why is this? I can’t figure out the difference between curl and the browser. The problem is the same on my own instance.

The problem in the browser is the Accept header.
While curl sets it to Accept:*/* the browser uses text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8.
Using an extension like tamper data you can modify the header that is being send by the browser. Doing so will return the state and display it in the browser.