Problems with square brackets on a URL (Dahua TiOC API)

Avatar
  • updated

Hello!

I've recently testing out TiOC cameras from Dahua, where I need to use their TiOC API. I've tested some of the URLs on the browser, and with curl, and even though they work, I have a small problem with bOS.

The url itself is this one (just for now):


http://192.168.1.108/cgi-bin/coaxialControlIO.cgi?action=control&channel=1&info[0].Type=1&info[0].IO=1

On the browser, I just have to past the url, enter the username and password and that's it. Testing done.

With curl, as I have square brackets, either I use the --globoff option or I have to change the [ ] with %5B and %5D respectively. Otherwise the curl command gives error.

So, I'm trying to use this url on bOS and it simply doesn't work.


If I use the [ ] I don't get anything. If I use the %, it will conflict in the string editor, as %5... will expect the pointer. I've tried almost everything I can remember, 

I know some guy that will probably figure this out, as I know that he probably uses TiOC cameras...


Yes Jürgen, this message is for you :P

Help!

Best regards

Avatar
Ricardo Pinto

Ah ok...

I thought that you already used digest on bOS, so that's why I was hoping for some help :)

Oh well...I guess I'll have to wait then for eventually some news.

Thanks!

Best regards

Avatar
Jürgen Jürgenson
Quote from Ricardo Pinto

Convert?

I don't want to convert, I have to work with Digest.

I was saying, that on older IP Door Lock units, I still had to chance to go to the web interface and change Digest to Basic, so I could use it on bOS.

In this case, this new IP Cameras, apparently they removed the option to use Basic, so I have to use Digest.

As I saw something on an older post, of you saying that you we're using digest on other equipment, that's why I asked.

Http digest authentication / ComfortClick / ComfortClick

Yep I was wrong thinking it was digest auth what they use. It's just api key authentication with hashed passwords, all the comparing is done on their side. With digest auth it works differently It involves a challenge-response mechanism where the server sends a challenge to the client, and the client responds with a hashed version of the challenge, along with other information.

Avatar
Ricardo Pinto

Convert?

I don't want to convert, I have to work with Digest.

I was saying, that on older IP Door Lock units, I still had to chance to go to the web interface and change Digest to Basic, so I could use it on bOS.

In this case, this new IP Cameras, apparently they removed the option to use Basic, so I have to use Digest.

As I saw something on an older post, of you saying that you we're using digest on other equipment, that's why I asked.

Http digest authentication / ComfortClick / ComfortClick

Avatar
Jürgen Jürgenson
Quote from Ricardo Pinto

Update: I think that the problem might not be from the url, but because of the authentication... it looks like this cameras don't accept basic authentication anymore, I've tried to use the curl with basic authentication and it doesn't pass, it keeps saying unauthorized. So it might only accept digest authentication...

Now I remember, that I don't have any problems with the Dahua VTO, because I'm almost sure that I was allowed to change digest to basic. But I'm not finding that option in this new camera.

Do you have any example I can take to use the GET with digest authentication? I'm using simple login for testing. Username: teste Password: teste123

I dont think its possible to convert basic auth to digest like that. We need CC support input on this.

Avatar
Ricardo Pinto

Update: I think that the problem might not be from the url, but because of the authentication... it looks like this cameras don't accept basic authentication anymore, I've tried to use the curl with basic authentication and it doesn't pass, it keeps saying unauthorized. So it might only accept digest authentication...

Now I remember, that I don't have any problems with the Dahua VTO, because I'm almost sure that I was allowed to change digest to basic. But I'm not finding that option in this new camera.

Do you have any example I can take to use the GET with digest authentication? I'm using simple login for testing. Username: teste Password: teste123

Avatar
Ricardo Pinto

Didn't had any luck with that. It even gives error in curl.

I've tried even simple things like just escaping the bracket with a \ before que bracket, which works in curl, but didn't had any luck on bOS

Avatar
Jürgen Jürgenson
Quote from Jürgen Jürgenson

I've reported the missing index too, it will be restored in the next update. But they do still work like before.

So about the brackets error - you have to wait for the CC supports input as how to escape it.

Maybe also try this as the command: cgi-bin/coaxialControlIO.cgi?action=control&channel=1&info[0].Type=1&info[0].IO=1

Oh and also try with ['0'] or '[0]' i've seen this when parsing some api values. After adding the ' marks they parsed correctly. example: .Array[999]['.id'] does not work without ' marks tho they are not shown in the original response data.

Avatar
Jürgen Jürgenson
Quote from Ricardo Pinto

Didn't had any luck, just tried the end of the command as a string and it also doesn't do anything...

I also noticed (I already submitted a ticket) that the Properties menu on the String editor is missing the properties indexes. Like, when we place on the text %0 %1 %2 etc, below, we have to link the property, and you can add them, but they are not showing the index like 0: 1: 2: so now I don't know if my url is ok, or if the properties are kind of broken...

Probably not broken, because I still have some stuff using different values, and they are working...

So I assume that the problem is still on the square brackets

I've reported the missing index too, it will be restored in the next update. But they do still work like before.

So about the brackets error - you have to wait for the CC supports input as how to escape it.

Maybe also try this as the command: cgi-bin/coaxialControlIO.cgi?action=control&channel=1&info[0].Type=1&info[0].IO=1

Avatar
Ricardo Pinto

Didn't had any luck, just tried the end of the command as a string and it also doesn't do anything...

I also noticed (I already submitted a ticket) that the Properties menu on the String editor is missing the properties indexes. Like, when we place on the text %0 %1 %2 etc, below, we have to link the property, and you can add them, but they are not showing the index like 0: 1: 2: so now I don't know if my url is ok, or if the properties are kind of broken...

Probably not broken, because I still have some stuff using different values, and they are working...

So I assume that the problem is still on the square brackets

Avatar
Jürgen Jürgenson
Quote from Ricardo Pinto


Oh, you mean the end the command as string... Well haven't thought of that, I was trying several string variations but not that way.

I can surely try!

bOS team can also try to give any hint on how to escape the url correctly.

I will try your suggestion tomorrow morning, thanks.


Best regards

Yep the last part of the command/link try to send it as a string. I've had this problem before and got around it with the same trick. I also have similar problem with ajax template. Its event picture links are generated by aws and they also use %x values in their links so i've made a ticket about it - hoping there will be a way to change the %x formatter or even disable it if not needed on some commands. With static links its possible to get around it but with generated links I haven't found a good way to do it.