[SOLVED] Use URL to manipulate items in OH2?

> http://<openhab-host>:8080/CMD?<item>=<state>

This URL is not working on OH2. Is there something similar?

Thanks

Sending commands via GET request doesn’t work in OH2. I believe that GET was intended only for updating the status of an item, but somehow also worked for commands in OH1. You will need to send commands using a POST to the rest api.

Relevant section from the wiki:

“In order to send a command to an item, you would use the item uri (http://localhost:8080/rest/items/Temperature_FF_Office) and send an HTTP POST with the according command in the request body as text/plain.”

1 Like

Bummer.
Is it possible to send commands to multiple items at once using HTTP POST method?

I’m used to send commands like this…
> http://<openhab-host>:8080/CMD?<item1>=<state>&<item2>=<state>

The CMD servlet and REST API are different. The CMD servlet lets you send GET requests of the form <itemName>=<command> in order to send commands to items.

Under OH2, have you tried http://host:port/classicui/CMD?itemName=command

2 Likes

Bingo!

thanks @watou, it works.

3 Likes

Classicui works! Nice to know it’s still there. I couldn’t find a reference to that change anywhere.

Yes, it looks like isn’t mentioned here. Could you submit a pull request on that document, or would you like me to?

Well, it mentions that “the Classic UI URL has changed from /openhab.app to /classicui/app”.

Note that the CMD servlet is an internal part of the Classic UI that is NOT meant to be used by anybody else (although it is of course possible). But as it is not an official feature, I would claim it should also not be documented.

The way to interact with external systems is clearly the REST API.

Makes sense.

I am trying to use this url. Has this been removed when releasing OH2 recently.

It worked for me.

doesn’t work for me on openHAB 2.1.0-1
has the url changed?

That´s a pity - ie Grandstream phones like the GXV3240 are able to send HTTP-GET commands.
To trigger an action in OH i need to send the request to the CCU, the CCU tells OH that someone is calling, OH is muting my Squeezebox…

I don´t know if i should use the Classic-UI for this - who knows how long it is supported!?

Hi as a GET Request it works for me. I have te Problem that the Geofency App only supports Post Requests. The Locative App suppots GET Requests but the IBeacon trigger does not work.

Any Ideas?

Hi Matthias,

I installed the “REST API” UI with this you can see all possible commands for the RestApi is a really pretty way.

This should show you a solution.

Hello,

Thought this is an old thread but I thought I can share a new approach for this case.

With this binding [httplistener] New, very simple binding for listening incomming http requests you can create some webhooks straight in openhab for your third party tools and devices.

Regards
Piotr

1 Like