Trigger HTTP call with @ sign in the url

  • Platform information: Ubuntu 18.04
    • OS:Ubuntu
    • Java Runtime Environment: openjdk version “11.0.3”
    • openHAB version:2.4.0
  • Issue of the topic: trying to trigger a HTTP call

Hi everybody,

I’m getting back on track with OpenHAB. I’m trying to link a Doorbird to my OH2.4.
I’ve searched the posts in this community but everything is related to pre 2.x and not working correctly.

I have a “doorbird.items”

Switch doorbird {http=“>[*:GET:http://192.168.1.x/bha-api/open-door.cgi?r=xxxxxx@1?&http-user=xxxxx0001&http-password=yyyyyyy]”}

and a “default.sitemap”

sitemap default label=“My First Sitemap”
{ Switch item=doorbird label=“Doorbird Switch”
}

And this shows the sitemap with a switch.
But, when I push the button, OH does trigger the API but the API returns

{
"BHA": {
"RETURNCODE": "0"
 }

This means authentication is ok but nothing has happened.
I’m using a Doorbird I/O controller, so to trigger the external relays that are linked to the doorbird I have to add “?r=xxxxxx@1” to my call.
When I leave this part out of my call, the API returns

{
“BHA”: {
“RETURNCODE”: “1”
}

So for some reason, the “?r=xxxxxx@1” isn’t sent correctly to the doorbird API. If I do “?r=pepepexx@1” it also returns “0”. So it’s a kind of 404 not found error.

It works in a browser, so I’m sure the url works.
I have the same issue when I try to curl to my doorbird, so I have the idea that something is wrong with the encoding. Does anybody have the same issue?

Try to replace the @ with %40 in your URL (URL encoding).

In addition to what bbock wrote, there should not be a second question mark in the query string:

?r=xxxxxx%401&http-user=xxxxx0001&http-password=yyyyyyy

You should be able to do this with the ipcamera binding as I added the ability to open doors via one of the channels. It may have been an alarm channel I re-used. By using the ipcamera binding you should be able to stream the video to multiple devices as normally the cameras are limited to a single stream.

Also there is also a new Doorbird binding here…

@bbock Already tried the %40 encoding, didn’t work.
But the question mark that @namraccr saw was the issue.
Thanks for the reply, the problem is fixed now.

My items file now contains this.
Switch doorbirdvisitorgate {http=">[*:GET:http://192.168.1.10/bha-api/open-door.cgi?r=xxxxxxx@3&http-user=uuuuuuuuuu&http-password=pppppppppp]"}

Going to try the suggestions from @matt1