Reolink updates Learn More
Meet Reolink at IFA 2024! Learn More
Reolink Q&A Learn More
Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
PS I think I got it. Played around with the quotation and
pi@raspberrypi:~ $ curl -s -k -X POST -H 'Content-Type : application/json' -d '[{"cmd": "Search", "action":0, "param": { "Search": { "channel": 1, "onlyStatus": 0, "streamType": "main", "StartTime": { "year": 2023, "mon": 04, "day": 25, "hour": 0, "min": 26, "sec": 1},"EndTime": { "year": 2023,"mon": 04, "day": 25, "hour": 21, "min": 34, "sec": 1}}}}]' 'https://ip/cgi-bin/api.cgi?cmd=Search&user=xxx&password=yyy'
seems to be working. Thanks for your patience
I get the same response with plain curl from my Raspberry Pi. I issued the exact command as suggested. It does not work with http or https and also I get the same result with onlyStatus = 0 or 1
pi@raspberrypi:~ $ curl -s -k -X POST -H "Content-Type : application/json" -d "[{"cmd": "Search", "action":0, "param": { "Search": { "channel": 0, "onlyStatus": 1, "streamType": "main", "StartTime": { "year": 2023, "mon": 04, "day": 21, "hour": 12, "min": 26, "sec": 1},"EndTime": { "year": 2023,"mon": 04, "day": 21, "hour": 21, "min": 34, "sec": 1}}}}]" "https://ip/cgi-bin/api.cgi?user=xxx&password=yyy" [ { "cmd" : "Unknown", "code" : 1, "error" : { "detail" : "please login first", "rspCode" : -6 } } ]
@joseph-chircop_497308027822318 so do you think using a token is not supported? It is described in the API spec, though.
I am trying to implement the "search" call in PHP. My quick hack code is:
<?php // Login ============================== $ch = curl_init(); curl_setopt($ch, CURLOPT_POSTFIELDS, '[{"cmd":"Login","param":{"User":{"userName":"admin","password":"password"}}}]' ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, "http://192.168.1.1/cgi-bin/api.cgi?cmd=Login"); $output = curl_exec($ch); $jsonobj = substr($output,1,-2); $obj = json_decode($jsonobj); echo "Token: ".$obj->value->Token->name."<br>"; $tokenName = $obj->value->Token->name; // Login ============================== $toSearch = '[{ "cmd": "Search", "action":0, "param": { "Search": { "channel": 0, "onlyStatus": 1, "streamType": "main", "StartTime": { "year": 2023, "mon": 04, "day": 21, "hour": 12, "min": 26, "sec": 1 }, "EndTime": { "year": 2023, "mon": 04, "day": 24, "hour": 12, "min": 34, "sec": 1 }]'; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, "http://192.168.1.1/api.cgi?cmd=Search&token=".$tokenName); curl_setopt($ch, CURLOPT_POSTFIELDS, $toSearch ); $output = curl_exec($ch); echo $output; ?>
Response is:
Token: 423e78c93350582 [ { "cmd" : "Search", "code" : 1, "error" : { "detail" : "please login first", "rspCode" : -6 } } ]
Other calls seem to work fine.Any Ideas?Cam is a Reolink TrackMix WiFi with latest firmware.
Welcome Back!
Hi there! Join the Commnunity to get all the latest news, tips and more!