Options
Http commands with username and password
Dear All,
I need to control a system ( ZWave) through IP and http commands. I have already managed to make the command structure ( see below ) but the problem is that I have to get through a username and password for the command to be applied.
send_string dvZWave, "'POST /api/devices/15/action/turnOff HTTP/1.1',13,10"
send_string dvZWave, "'Host: 192.168.10.120',13,10"
send_string dvZWave, "'Connection: keep-alive',13,10"
send_string dvZWave, "13,10"
When sending these commands, a reply says ( on NS diagnostics ) that an unauthorized user is trying to log in.
Below you can see an http fox snap shot while log in the system with u/p admin/admin.
How can I send the username and password with a send_string command before sending the above commands ?
George
I need to control a system ( ZWave) through IP and http commands. I have already managed to make the command structure ( see below ) but the problem is that I have to get through a username and password for the command to be applied.
send_string dvZWave, "'POST /api/devices/15/action/turnOff HTTP/1.1',13,10"
send_string dvZWave, "'Host: 192.168.10.120',13,10"
send_string dvZWave, "'Connection: keep-alive',13,10"
send_string dvZWave, "13,10"
When sending these commands, a reply says ( on NS diagnostics ) that an unauthorized user is trying to log in.
Below you can see an http fox snap shot while log in the system with u/p admin/admin.
How can I send the username and password with a send_string command before sending the above commands ?
George
Comments
"Authorization: Basic root:root',13,10"
The user/password bit needs to be encoded using base 64. There is a function to do it - do a forum search and I'm sure it'll pop up.
Simon
Once the command is executed - after such a delay - I'm getting the below string:
SendString 0:0:0 too long 297 truncated to 274
I have tried many different syntax's with no success.
Any ideas of why an http command may have such a delay ?
The SendString message is just a limitation of Netlinx Studio Diagnostic printouts.
It's no indication that your code is good or bad.
It just means it can't print that much with 1 SendString 0.
I don't know if the text quoted is accurate or not... But, you don't want to make your IP device 0:0:0. That may just be a typo or whatever. the first two ports (0:1:0 and 0:2:0) are reserved for use by the Netlinx master's internal clockwork. (Technically, I think the published statement is actually just port 0:1:0 - but I've noticed over the years that there seems to be some use of port 2 on occasion. I've never confirmed it with AMX. But I just tend to start at port 3 out of habit)