[SOLVED] Update Item through REST API

My Vivotek NVR has the ability to send an HTTP request in response to an alarm, such as motion detected. See screen shot:

My Item:
Switch CameraGarageMotion

When I type this into a browser:

I get:

So REST is functioning and finds the Item. The question is, what do I put into the NVR’s URL field to change the item to ON?

Something like this??

Have you installed restdocs and looked? You can even test things out through the web interface.

Spent a good hour reading OpenHAB docs and googling. Can’t figure it out.

You need to use POST instead of GET requests:

 /usr/bin/curl  -q --user  '<your user account>:<your password>' --header "Content-Type: text/plain" --request POST --data "ON"

Restdocs is a user interface addon that lets you navigate the API and get answers back to help you determine the URL and parameters needed for your devices. You see the results in real time.

At https://github.com/openhab/openhab1-addons/wiki/Samples-REST you find a list of commands for different programming languages.

That’s a really old resource that is not complete nor completely accurate for OH 2. The REST API Docs add-on (installable from the UIs tab in PaperUI) will be the correct and up to date docs. It includes the curl command for each endpoint which one should be able to use to generate the rest.

This is where I am getting confused. I am not sending it though any code, just a field in the NVR that takes a URL. Is it not possible to do what I want with REST?


This is not official but it is running, maybe in OH3 this will not run anymore.
1 Like

Classic UI is already slated to be removed from OH3 when the new UI is included.

That worked!!

1 Like

Would be happy if someone could provide a solution that will work with OH3.

Here we help people develop their own solutions. I have led you to where I would find the answer. If you are not motivated enough to try I cannot help further.

Hey Buddy, I don’t appreciate that response. And yes, I did install the REST doc and spent almost an hour playing around. I hit a wall, so I thought ask for help. Is this not why the forums exist?

In OH3 it requires a PUT or a POST. You can’t do it with a GET. Not directly at least. You might be able to put together an HTML page that converts a GET to a PUT/POST. See OAuth2 using just OH Rules and myopenhab.org for an example doing something like that.

1 Like

Thanks. I was just taking a look at this:

I also applied to Vivotek to get access to their SDK. We sell their cameras, so they should approve me!! :slight_smile:

So I went a completely different route. The camera has the ability to send an image to an FTP server when motion is detected. I then used the ftp binding:

Now OpenHAB gets notification when there is motion, and gets an image :slight_smile:

That only works if the FTP server can be reached. If interested there is a way to do this with the ipcamera binding, by entering the right URL in to your NVR it will trigger the alarm channel you can trigger the INSTAR alarm server and from memory that is with get requests. Can provide info if interested.

Very interested. Will read through:

Then setup the camera as a INSTAR thing type and override all the urls so they match your cameras.

Then do a get request, you can easily test it by entering it into any browser.


That will make the motion alarm get triggered.