I’m quite new with using OH and I’m lost with using the HTTP binding. I do have a small Z-Wave network with 7 nodes. All connected to a Razberry board placed on a RasperryPi. Now I would like to add some commands on my second Raspberry where openHAB is running (without using the Z-Wave binding). Now my problem:
If I’m using the command directly in the web browser:
The major difference I see is when you use the URL in your web browser it is doing a GET but in your OH Items it is doing a POST which are two different things.
I don’t have much experience with the HTTP Binding but try changing your http=">[ON:POST: to http=">[ON:GET:
The wiki page for the binding implies that it might support HTTP commands other than POST.
If that isn’t it I don’t know what the problem is.
And now it works! But I still would like to know what I’m doing wrong with the HTTP-Binding! I thought, that is the reason why having this kind of binding at all!?! Or is it quite common to use “curl” commands to the different devices?
Cheers
-Prom
PS.
Maybe that is peanuts for most of the people here but this is my shell-script that I’m using:
Like I said, I don’t have much experience with the HTTP binding. Perhaps the binding doesn’t support GET and only supports POST.
A lot of web based APIs use a REST type interface which supports HTTP POST and HTTP PUT commands for interaction with them. This appears to be what the HTTP Binding was created for. However, for APIs that are just based on the HTTP GET command, it would appear the HTTP Binding is not suitable and you have to use CURL. At least for now.
You can also send GET commands using the sendHttpGetRequest(String url) in a rule as yet another way to activate your devices.
I see that the closing ] is missing in the binding strings before the double quote mark at the end of each line. Also Richard’s point about using the correct GET vs. POST method is important.