<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[http request reolink json =&gt; login failed]]></title><description><![CDATA[<p dir="auto">Hallo zusammen,<br />
ich versuche meine Kamera direkt anzusteuern und komme nicht mehr weiter.<br />
Was habe ich gemacht (analog zu anderen Forenbeiträgen):</p>
<p dir="auto">Der Befehl auf meinem iobroker-Pi</p>
<pre><code> curl -d '[{"cmd":"Login","action":0,"param":{"User":{"userName":"admin","password":"xxx"}}}]' 192.168.178.xx/api.cgi?cmd=Login
</code></pre>
<p dir="auto">ergibt genau das, was ich als Antwort (den Token) haben möchte:</p>
<pre><code>[
   {
      "cmd" : "Login",
      "code" : 0,
      "value" : {
         "Token" : {
            "leaseTime" : 3600,
            "name" : "981a2aab3efef8f"
         }
      }
   }
]

</code></pre>
<p dir="auto">Eine Umsetzung in javascript hatte ich mir so im Forum ersucht:</p>
<pre><code>var url1="http://192.168.178.xx/cgi-bin/api.cgi?cmd=Login";
var json=[{"cmd":"Login","action":0,"param":{"User":{"userName":"admin","password":"xxx"}}}];

var request = require('request');
    var options = {
    url: url1,
    method: 'POST',
    form:json
    };

request(options,function (error, response, body){
    console.log(response); 
    console.log('error ' + error);
    console.log('body ' + body);
});
</code></pre>
<p dir="auto">Als Antwort erhalte ich einen leeren body - als Log erhalte ich:<br />
</p><section class="spoiler-wrapper"><button class="spoiler-control btn btn-default">Spoiler</button><section style="display:none" class="spoiler-content"><br />
22:38:10.985	info	javascript.0 (27545) script.js.Homedingskacke.Steuerung.ptz-test: {'statusCode':200,'body':'null\n','headers':{'date':'Sun, 04 Apr 2021 20:38:11 GMT','content-type':'text/html','transfer-encoding':'chunked','connection':'close','x-frame-options':'SAMEORIGIN','x-xss-protection':'1; mode=block','x-content-type-options':'nosniff'},'request':{'uri':{'protocol':'http:','slashes':true,'auth':null,'host':'192.168.178.xx','port':80,'hostname':'192.168.178.xx','hash':null,'search':'?cmd=Login','query':'cmd=Login','pathname':'/cgi-bin/api.cgi','path':'/cgi-bin/api.cgi?cmd=Login','href':'<a href="http://192.168.178.xx/cgi-bin/api.cgi?cmd=Login'%7D,'method':'POST','headers':%7B'content-type':'application/x-www-form-urlencoded','content-length" rel="nofollow ugc">http://192.168.178.xx/cgi-bin/api.cgi?cmd=Login'},'method':'POST','headers':{'content-type':'application/x-www-form-urlencoded','content-length</a>':124}}}<br />
22:38:10.987	info	javascript.0 (27545) script.js.Homedingskacke.Steuerung.ptz-test: error null<br />
22:38:10.987	info	javascript.0 (27545) script.js.Homedingskacke.Steuerung.ptz-test: body null<br />
</section></section><br />
Ändere ich den Code wie folgt, erhalte ich als body =&gt; json parse err.<p></p>
<pre><code>    //form:json
    formData: "{'User':{'userName':'admin','password':'xxx'}"
</code></pre>
<p dir="auto"></p><section class="spoiler-wrapper"><button class="spoiler-control btn btn-default">Spoiler</button><section style="display:none" class="spoiler-content"><br />
22:40:46.525	info	javascript.0 (27545) script.js.Homedingskacke.Steuerung.PTZ-Test-2: {'statusCode':200,'body':'json parse err\n','headers':{'date':'Sun, 04 Apr 2021 20:40:46 GMT','content-type':'text/html','transfer-encoding':'chunked','connection':'close','x-frame-options':'SAMEORIGIN','x-xss-protection':'1; mode=block','x-content-type-options':'nosniff'},'request':{'uri':{'protocol':'http:','slashes':true,'auth':null,'host':'192.168.178.xx','port':80,'hostname':'192.168.178.xx','hash':null,'search':'?cmd=Login','query':'cmd=Login','pathname':'/cgi-bin/api.cgi','path':'/cgi-bin/api.cgi?cmd=Login','href':'<a href="http://192.168.178.xx/cgi-bin/api.cgi?cmd=Login'%7D,'method':'POST','headers':%7B'content-type':'multipart/form-data" rel="nofollow ugc">http://192.168.178.xx/cgi-bin/api.cgi?cmd=Login'},'method':'POST','headers':{'content-type':'multipart/form-data</a>; boundary=--------------------------867435826479255840136804','content-length':5248}}}<br />
22:40:46.526	info	javascript.0 (27545) script.js.Homedingskacke.Steuerung.PTZ-Test-2: error null<br />
22:40:46.527	info	javascript.0 (27545) script.js.Homedingskacke.Steuerung.PTZ-Test-2: body json parse err<br />
</section></section><br />
Ändere ich den Code wie folgt, erhalte ich als body =&gt; [ { "cmd" : "Login", "code" : 1, "error" : { "detail" : "login failed", "rspCode" : -7 } } ], was ja schon einmal gut aussieht, aber auch falsch ist, denn wenn ich den username ändere, würde ich "invalid user" erwarten, wie ich es per http aus einem Browser auch bekomme.<p></p>
<pre><code>    //form:json
    //formData: "{'User':{'userName':'admin','password':'xxx'}"
        headers : {'Authorization':'"User":{"userName":"admin","password":"xxx"}'}

</code></pre>
<p dir="auto"></p><section class="spoiler-wrapper"><button class="spoiler-control btn btn-default">Spoiler</button><section style="display:none" class="spoiler-content"><br />
22:44:55.159	info	javascript.0 (27545) script.js.Homedingskacke.Steuerung.PTZ: {'statusCode':200,'body':'[\n {\n 'cmd' : 'Login',\n 'code' : 1,\n 'error' : {\n 'detail' : 'login failed',\n 'rspCode' : -7\n }\n }\n]\n','headers':{'date':'Sun, 04 Apr 2021 20:44:55 GMT','content-type':'text/html','transfer-encoding':'chunked','connection':'close','x-frame-options':'SAMEORIGIN','x-xss-protection':'1; mode=block','x-content-type-options':'nosniff'},'request':{'uri':{'protocol':'http:','slashes':true,'auth':null,'host':'192.168.178.xx','port':80,'hostname':'<a href="http://192.168.178.xxx" rel="nofollow ugc">192.168.178.xxx</a>','hash':null,'search':'?cmd=Login','query':'cmd=Login','pathname':'/cgi-bin/api.cgi','path':'/cgi-bin/api.cgi?cmd=Login','href':'<a href="http://192.168.178.xx/cgi-bin/api.cgi?cmd=Login'%7D,'method':'POST','headers':%7B'Authorization':'%5C'User%5C':%7B%5C'userName%5C':%5C'admin%5C',%5C'password%5C':%5C'xxx%5C'%7D','content-length" rel="nofollow ugc">http://192.168.178.xx/cgi-bin/api.cgi?cmd=Login'},'method':'POST','headers':{'Authorization':'\'User\':{\'userName\':\'admin\',\'password\':\'xxx\'}','content-length</a>':0}}}<br />
22:44:55.160	info	javascript.0 (27545) script.js.Homedingskacke.Steuerung.PTZ: error null<br />
22:44:55.160	info	javascript.0 (27545) script.js.Homedingskacke.Steuerung.PTZ: body [ { "cmd" : "Login", "code" : 1, "error" : { "detail" : "login failed", "rspCode" : -7 } } ]<br />
</section></section><p></p>
<p dir="auto">Jetzt bin ich ziemlich ratlos, was ich noch machen kann oder an welcher Stelle ich mich für euch "alte Hasen" ;) ungeschickt anstelle ...</p>
]]></description><link>https://forum.iobroker.net/topic/43877/http-request-reolink-json-login-failed</link><generator>RSS for Node</generator><lastBuildDate>Sat, 23 May 2026 05:56:40 GMT</lastBuildDate><atom:link href="https://forum.iobroker.net/topic/43877.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 04 Apr 2021 20:54:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to http request reolink json =&gt; login failed on Wed, 14 Apr 2021 13:53:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nukleuz" aria-label="Profile: nukleuz">@<bdi>nukleuz</bdi></a><br />
Noch ein kleines Update und ein kleines Licht am Tunnel ...<br />
Ein paar weitere Befehle funktionieren auf diese Art und Weise. Deinen "ability error" bekomme ich bspw. bei den von mir gewünschten Ptz-Positionen meiner Kamera. Die gibt es nämlich nicht ... Daher scheint der Befehl bei mir nicht möglich zu sein, also rspCode -26. Der Befehl PtzCtrl funktioniert dagegen wieder.</p>
]]></description><link>https://forum.iobroker.net/post/615020</link><guid isPermaLink="true">https://forum.iobroker.net/post/615020</guid><dc:creator><![CDATA[PeterPan]]></dc:creator><pubDate>Wed, 14 Apr 2021 13:53:26 GMT</pubDate></item><item><title><![CDATA[Reply to http request reolink json =&gt; login failed on Wed, 14 Apr 2021 12:47:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nukleuz" aria-label="Profile: nukleuz">@<bdi>nukleuz</bdi></a><br />
Ja, ich bin auch nahe am Zusammenbruch <img src="https://forum.iobroker.net/assets/plugins/nodebb-plugin-emoji/emoji/android/1f623.png?v=ba16ebd4856" class="not-responsive emoji emoji-android emoji--persevere" style="height:23px;width:auto;vertical-align:middle" title=":persevere:" alt="😣" /> . Danke für die Links, schaue ich mir noch an. Ich habe jetzt deinen Code genommen, die "\" ergänzt und einen anderen Befehl genommen:</p>
<pre><code>C();
function C(){
    exec('curl -d \'[{"cmd":"Login","action":0,"param":{"User":{"userName":"admin","password":"xxxx"}}},{"cmd":"GetDevInfo"}]\' 192.168.178.78/api.cgi?cmd=Login&amp;cmd=GetDevInfo'
    ,function (error, stdout, stderr) {
    console.log(error);
    console.log(stdout);
    console.log(stderr);
    }
    );
}
</code></pre>
<p dir="auto">Damit erhalte ich tatsächlich, ohne den token zu verwenden, die Eigenschaften der Kamera ausgelesen. Bitte versuche es bei dir einmal, bin gespannt.</p>
<p dir="auto">Ggf. könnte bei dir im Code noch der channel fehlen? ich habe als Beipsiel für POST DATA folgendes bei mir gefunden (Auto noch durch off ergänzen ;)):</p>
<pre><code>[{"cmd": "SetIrLights","action": 0,"param": {"IrLights": {"channel": 0,"state": "Auto"}}}]
</code></pre>
<p dir="auto">Ich habe zwei RLC-410W draußen, die ich über meine Synology Surveillance Station laufen lasse. Hier wird bei Bewegung (zusätzlicher Bewegungsmelder) ein Photo gemacht und via pushover versendet sowie ein kurzer Film aufgenommen und gespeichert.<br />
Meine E1 Zoom steht drinnen, hier erfolgt der Snapshot und die Weiterleitung via pushover wie bei dir, allerdings wenn die Haustüre geöffnet wird. Mein Ziel ist es, die Kamera in eine bestimmte Position verfahren zu können, wenn einer anwesend ist.</p>
]]></description><link>https://forum.iobroker.net/post/614994</link><guid isPermaLink="true">https://forum.iobroker.net/post/614994</guid><dc:creator><![CDATA[PeterPan]]></dc:creator><pubDate>Wed, 14 Apr 2021 12:47:35 GMT</pubDate></item><item><title><![CDATA[Reply to http request reolink json =&gt; login failed on Tue, 13 Apr 2021 19:37:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterpan" aria-label="Profile: peterpan">@<bdi>peterpan</bdi></a></p>
<p dir="auto">Kein Problem - bei mir sieht es ähnlich aus. Verzweifele bald <img src="https://forum.iobroker.net/assets/plugins/nodebb-plugin-emoji/emoji/android/1f635.png?v=ba16ebd4856" class="not-responsive emoji emoji-android emoji--dizzy_face" style="height:23px;width:auto;vertical-align:middle" title=":dizzy_face:" alt="😵" /></p>
<p dir="auto">Hier mal was bei mir läuft (das ist auch für mich das Wichtigste gewesen - Motion und Snapshot):<br />
Snapshot-URL:</p>
<pre><code>http://192.168.0.147/cgi-bin/api.cgi?cmd=Snap&amp;channel=0&amp;rs=wuuPhkmUCeI9WG7C&amp;user=admin&amp;password=password
</code></pre>
<p dir="auto">Motion Detection</p>
<pre><code>http://192.168.0.147/api.cgi?cmd=GetMdState&amp;user=admin&amp;password=password
</code></pre>
<p dir="auto">Mit der Motion aktualisiere ich alle 3 Sekunden einen Datenpunkt (0/1) und lasse mir mit dem Snapshot ein Bild mit Text über Telegram senden, sowie das Licht auf dem Hof einschalten bei Nacht.</p>
<hr />
<p dir="auto">Was ich versucht habe, wie du, ist es mit dem erhaltenen Token weiterzuarbeiten - bislang ohne Erfolg.<br />
Ich habe leider nur die Basics des Programmierens und heute ist so ein Abend wo unbedingt Pause sein muss :)))</p>
<p dir="auto">Wenn du da etwas fitter bist, was ich hoffe, dann kann das ja vielleicht was werden <img src="https://forum.iobroker.net/assets/plugins/nodebb-plugin-emoji/emoji/android/1f47c.png?v=ba16ebd4856" class="not-responsive emoji emoji-android emoji--angel" style="height:23px;width:auto;vertical-align:middle" title=":angel:" alt="👼" /></p>
<p dir="auto">Hier die Versuche:</p>
<pre><code>curl -d '[{"cmd":"Login","action":0,"param":{"User":{"userName":"admin","password":"password"}}},{"cmd":"SetIrLights","action":0,"param":{"IrLights":{"state":"Off"}}}]' 192.168.0.147/api.cgi?cmd=Login&amp;cmd=SetIrLights

Response:
   {
      "cmd" : "Login",
      "code" : 0,
      "value" : {
         "Token" : {
            "leaseTime" : 3600,
            "name" : "44aecc633acd413"
         }
      }
   },
   {
      "cmd" : "SetIrLights",
      "code" : 1,
      "error" : {
         "detail" : "ability error",
         "rspCode" : -26
      }
   }
]
</code></pre>
<p dir="auto">Hier noch ein paar sehr interessante Links:</p>
<p dir="auto"><a href="https://community.jeedom.com/t/reolink-liste-de-commandes-via-api/25565" rel="nofollow ugc">https://community.jeedom.com/t/reolink-liste-de-commandes-via-api/25565</a><br />
<a href="https://github.com/ReolinkCameraAPI/reolinkapipy" rel="nofollow ugc">https://github.com/ReolinkCameraAPI/reolinkapipy</a><br />
<a href="https://forums.zoneminder.com/viewtopic.php?t=27185" rel="nofollow ugc">https://forums.zoneminder.com/viewtopic.php?t=27185</a></p>
<p dir="auto"><a href="/assets/uploads/files/1618342668740-cgi-jsonv1.1-2.pdf">cgi-jsonv1.1 (2).pdf</a></p>
<p dir="auto">Bei Fragen oder Tests einfach her damit!</p>
<p dir="auto">PS: Ich nutze eine <strong>RLC-410W</strong></p>
]]></description><link>https://forum.iobroker.net/post/614787</link><guid isPermaLink="true">https://forum.iobroker.net/post/614787</guid><dc:creator><![CDATA[nukleuz]]></dc:creator><pubDate>Tue, 13 Apr 2021 19:37:56 GMT</pubDate></item><item><title><![CDATA[Reply to http request reolink json =&gt; login failed on Mon, 12 Apr 2021 20:48:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nukleuz" aria-label="Profile: nukleuz">@<bdi>nukleuz</bdi></a><br />
Vielen Dank. Ich hatte mich an dem Blocky von MCU versucht, bin da aber nicht weitergekommen. Erst das Umschalten von meinen Blocky-Resten mit dem Befehl auf JS hatte mir den Hinweis gegeben, dass die "\" im Code gefehlt haben. Ich hatte das hier offen gelassen, damit vielleicht doch jemand das mit request hinbekommt.<br />
Was allerdings jetzt ist, dass ich mich mit exec zwar einloggen kann, den token bekomme, aber keine weiteren Befehle mit dem erhaltenen token absetzen kann. Hier kommt der Hinweis, dass ich mich erst einloggen soll. Bspw. sollte nach dem erfolgreichen Login ein http://IPC_IP/api.cgi?cmd=Format&amp;token=TOKEN mit den POST data [{"cmd": "Format", "param": {"HddInfo": {"id": [0]}}}] und dem token aus dem Login möglich sein. Natürlich auch andere Befehle. Hast du das geschafft, nach dem Login noch irgendetwas an die Kamera zu senden oder hast du ggf. einen Hinweis wie ich das bewerkstellen könnte? Wenn ich das schaffen sollte, könnte ich schauen, welche GETs und SETs ich ans Laufen bekomme, aber im Moment scheitert es an den Basics <img src="https://forum.iobroker.net/assets/plugins/nodebb-plugin-emoji/emoji/android/1f615.png?v=ba16ebd4856" class="not-responsive emoji emoji-android emoji--confused" style="height:23px;width:auto;vertical-align:middle" title=":confused:" alt="😕" /><br />
Ich benutze die E1 Zoom.</p>
]]></description><link>https://forum.iobroker.net/post/614388</link><guid isPermaLink="true">https://forum.iobroker.net/post/614388</guid><dc:creator><![CDATA[PeterPan]]></dc:creator><pubDate>Mon, 12 Apr 2021 20:48:51 GMT</pubDate></item><item><title><![CDATA[Reply to http request reolink json =&gt; login failed on Mon, 12 Apr 2021 19:40:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterpan" aria-label="Profile: peterpan">@<bdi>peterpan</bdi></a></p>
<p dir="auto">Damit klappt es (exec):</p>
<pre><code>exec('curl -d \'[{"cmd":"Login","action":0,"param":{"User":{"userName":"admin","password":"xxxxx"}}}]\' 192.168.0.147/api.cgi?cmd=Login', async function (error, result, stderr) {
    console.log(result);
    json = JSON.parse(result.toString());
    token = json[0].value.Token.name;
    console.log(token);
});
</code></pre>
<p dir="auto">Mit request habe ich es auch nicht hinbekommen. Du mittlerweile?</p>
<p dir="auto">Kannst mich ja mal auf dem Laufenden halten, welche GETs und SETs du zum Laufen bekommen hast.</p>
<p dir="auto">Welche Cam nutzt du?</p>
]]></description><link>https://forum.iobroker.net/post/614343</link><guid isPermaLink="true">https://forum.iobroker.net/post/614343</guid><dc:creator><![CDATA[nukleuz]]></dc:creator><pubDate>Mon, 12 Apr 2021 19:40:19 GMT</pubDate></item><item><title><![CDATA[Reply to http request reolink json =&gt; login failed on Mon, 05 Apr 2021 06:47:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mcu" aria-label="Profile: mcu">@<bdi>mcu</bdi></a> sagte in <a href="/post/609991">http request reolink json =&gt; login failed</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterpan" aria-label="Profile: peterpan">@<bdi>peterpan</bdi></a> Kompletten curl in ein Exec:</p>
</blockquote>
<p dir="auto">Danke für den Tipp, leider verwende ich kein Blocky, aber wenn ich es so umsetze, erhalte ich " json parse err", obwohl der curl-Befehl so in der Shell funktioniert.</p>
<pre><code>exec("curl -d '[{'cmd':'Login','action':0,'param':{'User':{'userName':'admin','password':'xxx'}}}]' 192.168.178.xx/api.cgi?cmd=Login"
, function (error, stdout, stderr) {
    console.log(error);
    console.log(stdout);
    console.log(stderr);
}); 
</code></pre>
<p dir="auto">Ändere ich "-d" jetzt in "-s -H", so erhalte ich als Antwort "[ { "cmd" : "Login", "code" : 1, "error" : { "detail" : "login failed", "rspCode" : -7 } } ]".</p>
<p dir="auto">Hast du ggf. noch eine Idee?</p>
]]></description><link>https://forum.iobroker.net/post/610009</link><guid isPermaLink="true">https://forum.iobroker.net/post/610009</guid><dc:creator><![CDATA[PeterPan]]></dc:creator><pubDate>Mon, 05 Apr 2021 06:47:15 GMT</pubDate></item><item><title><![CDATA[Reply to http request reolink json =&gt; login failed on Sun, 04 Apr 2021 22:51:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterpan" aria-label="Profile: peterpan">@<bdi>peterpan</bdi></a> Kompletten curl in ein Exec:<br />
<img src="/assets/uploads/files/1617576665657-d2a20a91-52d3-44dc-8fc9-ab8d136a8f72-image.png" alt="d2a20a91-52d3-44dc-8fc9-ab8d136a8f72-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.iobroker.net/post/609991</link><guid isPermaLink="true">https://forum.iobroker.net/post/609991</guid><dc:creator><![CDATA[MCU]]></dc:creator><pubDate>Sun, 04 Apr 2021 22:51:10 GMT</pubDate></item></channel></rss>