Can't set state of item through REST url call

I’m trying to set the state of a few items from a browser window (eventually a script) with the address:

http://ohip:8080/CMD?itemname=xx

All i get from the browser is:

HTTP ERROR 404
Problem accessing /CMD.
Reason: Not Found
Powered by Jetty://

Anyone know what’s going on? I can’t see any specific requirements so figured it’d ‘just work’. If I check http://ohip:8080/rest/items/itemname I get the full rundown of the item, and adding /state show’s me only the state.

I’m running the latest snapshot of OH2.

I think the REST API has had a major overhaul in OH2 - sorry I am not running that version so can’t confirm. It is possible this CMD? endpoint has been removed/renamed.

Yeah, I just had a brain wave and just had a look through the rest interface and I can’t see it mentioned there as an option.

Indeed, CMD had been removed. You need to use a POST or PUT with the new state in the body (I.e. you can’t do it from a browser).

Not really removed, but it has never really been a part of the public API - see here.

1 Like

OK, thanks. That’s a bit of a shame. The api I’m using (wireless sensor tags) to call the state change doesn’t seem to be sending the right data. I’ll need to dig a little deeper.

@Kai There are references to this method in the wikis so could do with removal or a caveat note on the viability of its use for future users.