Logic Machine Forum
Reolink Cam help - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Reolink Cam help (/showthread.php?tid=2873)



Reolink Cam help - esteve.budia - 29.09.2020

I'm trying to obtain the token of my cam, but I'm not success.

This is the help that I've found..

I'm not able to build the POST sentence with username payload.

to get your token for the URL above, you need to post here:
http://192.168.AAA.BBB/cgi-bin/api.cgi?cmd=Login&token=null

with this payload (substituted in your username and password)
[{"cmd":"Login","action":0,"param":{"User":{"userName":"admin","password":"abcdefg"}}}]

the response that comes back has the token in the name field
[
{
"cmd" : "Login",
"code" : 0,
"value" : {
"Token" : {
"leaseTime" : 3600,
"name" : "75a35d0a5a30680"
}
}
}
]





Does anyone can help me?


RE: Reolink Cam help - admin - 29.09.2020

Try this:
Code:
http = require('socket.http')
url = 'http://192.168.AAA.BBB/cgi-bin/api.cgi?cmd=Login&token=null'
data = '[{"cmd":"Login","action":0,"param":{"User":{"userName":"admin","password":"abcdefg"}}}]'
res, err = http.request(url, data)
log(res, err)



RE: Reolink Cam help - esteve.budia - 29.09.2020

Perfect!!!

thx

Reolink test 29.09.2020 14:26:04
* arg: 1
* string: [
{
"cmd" : "Login",
"code" : 0,
"value" : {
"Token" : {
"leaseTime" : 3600,
"name" : "cajksdhfk js6d58"
}
}
}
]

* arg: 2
* number: 200