REOLINK - Liste de commandes via API

HOW-TO Récupération de la structure des données de commandes Getxxx via CURL

=Ne fonctionne pas avec les autres commandes (Setxxx ou autres)=
MAJ 17/02/2021 : Pour les commandes GetMdAlarm, GetEnc, GetRec, GetOsd, GetMask, GetImage et GetIsp, le fichier json a envoyé par la commande curl est différent. Celui-ci doit inclus la variable channel.

MAJ 20/07/2020 : La méthode ne fonctionne pas avec les commandes GetEnc, GetRec, GetOsd, GetMask, GetImage et GetIsp (erreur rspcode -4)

  • LINUX : sous bash, lancer la commande curl suivante :
curl -s -k -X POST -H "Content-Type : application/json" -d '[{"cmd":"#GetCommand#","action":1,"param":{}}]' "https://#IP#/cgi-bin/api.cgi?user=#username#&password=#password#"

Commande curl spécifique pour les commandes GetMdAlarm, GetEnc, GetRec, GetOsd, GetMask, GetImage et GetIsp :

curl -s -k -X POST -H "Content-Type : application/json" -d '[{"cmd":"#GetCommand#","action":1,"param":{"channel":#id#}}]' "https://#IP#/cgi-bin/api.cgi?user=#username#&password=#password#"

Remplacer #IP#, #username# et #password# par vos propres valeurs; Remplacer #GetCommand# par la commande Getxxx recherché dans le payload envoyé. Pour la valeur #id# de l’argument channel, la mettre à 0 -si vous n’avez pas de NVR-

  • WINDOWS : Telecharger CURL pour Windows (curl for Windows); dézipper l’archive; lancer interpréteur de commandes cmd.exe (dans le répertoire bin de l’archive dézippé)
curl.exe -s -k -X POST -H "Content-Type : application/json" -d "[{\"cmd\":\"#GetCommand#\",\"action\":1,\"param\":{}}]" "https://#IP#/cgi-bin/api.cgi?user=#username#&password=#password#"

Commande curl spécifique pour les commandes GetMdAlarm, GetEnc, GetRec, GetOsd, GetMask, GetImage et GetIsp :

curl.exe -s -k -X POST -H "Content-Type : application/json" -d "[{\"cmd\":\"#GetCommand#\",\"action\":1,\"param\":{\"channel\":#id#}}]" "https://#IP#/cgi-bin/api.cgi?user=#username#&password=#password#"

Remplacer #IP#, #username# et #password# par vos propres valeurs; Remplacer #GetCommand# par la commande Getxxx recherché. Pour la valeur #id# de l’argument channel, la mettre à 0 -si vous n’avez pas de NVR-

  • Exemple de commande curl pour GetNetPort, exécuté sous linux :
curl -s -k -X POST -H "Content-Type : application/json" -d '[{"cmd":"GetNetPort","action":1,"param":{}}]' "https://#IP#/cgi-bin/api.cgi?user=#username#&password=#password#"
  • Équivalent de l’exemple ci-dessus pour GetNetPort, exécuté sous Windows:
curl -s -k -X POST -H "Content-Type : application/json" -d "[{\"cmd\":\"GetNetPort\",\"action\":1,\"param\":{}}]" "https://#IP#/cgi-bin/api.cgi?user=#username#&password=#password#"

NB IMPORTANT:
Dans le payload à envoyer via Curl sous Windows, si vous basez sur la commande Linux pour générer la commande Windows, il faut, pour l’argument -d :
** dans le payload, remplacer tous les < " > par < \" >
** mettre le payload [{…}] entre guillemets et pas entre simples quotes (défini avec la commande linux)

Dans le résultat de la commande :

  • « initial » : {…} correspond aux valeurs par défaut
  • « range » : {…} à leurs définitions
  • « value » : {…} aux valeurs en cours
[
   {
      "cmd" : "GetNetPort",
      "code" : 0,
      "initial" : {
         "NetPort" : {
            "httpPort" : 80,
            "httpsPort" : 443,
            "mediaPort" : 9000,
            "onvifPort" : 8000,
            "rtmpPort" : 1935,
            "rtspPort" : 554
         }
      },
      "range" : {
         "NetPort" : {
            "httpPort" : {
               "max" : 65535,
               "min" : 1
            },
            "httpsPort" : {
               "max" : 65535,
               "min" : 1
            },
            "mediaPort" : {
               "max" : 65535,
               "min" : 1
            },
            "onvifPort" : {
               "max" : 65535,
               "min" : 1
            },
            "rtmpPort" : {
               "max" : 65535,
               "min" : 1
            },
            "rtspPort" : {
               "max" : 65535,
               "min" : 1
            }
         }
      },
      "value" : {
         "NetPort" : {
            "httpPort" : 80,
            "httpsPort" : 443,
            "mediaPort" : 9000,
            "onvifPort" : 8000,
            "rtmpPort" : 1935,
            "rtspPort" : 554
         }
      }
   }
]

===== COMMANDES =====

L’ensemble des commandes décrites ci-dessous fonctionnent avec les 2 URLs suivantes (hormis celles utilisation l’argument channel):

  • https://#IP#/cgi-bin/api.cgi?cmd=Getxxx&rs=#value#&user=#username#&password=#password#
  • https://#IP#//foobar.cgi?cmd=Getxxx&rs=#value#&user=#username#&password=#password#

Cas d’une commande utilisant l’argument channel :

  • https://#IP#/cgi-bin/api.cgi?cmd=Getxxx&channel=0&rs=#value#&user=#username#&password=#password#
  • https://#IP#//foobar.cgi?cmd=Getxxx&channel=0&rs=#value#&user=#username#&password=#password#

Dans la documentation des commandes, les exemples se baseront qu’à partir de la 1ere URL (celle cgi-bin/api.cgi?).

NB: les URLs peuvent être en https mais aussi en http


====Détails des commandes====

  • Cfg Device HDD URL : GetHddInfo
    https://#IP#/cgi-bin/api.cgi?cmd=GetHddInfo&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetHdInfo

Commande en écriture : Format (POST)
cf https://github.com/ReolinkCameraAPI/reolinkapipy/tree/master/reolinkapi/mixins/device.py


  • Cfg Online User URL : GetOnline
    https://#IP#/cgi-bin/api.cgi?cmd=GetOnline&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetOnline


  • Cfg User Manager URL : GetUser
    https://#IP#/cgi-bin/api.cgi?cmd=GetUser&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetUser

Commandes en écriture : AddUser, ModifyUser, DelUser (POST)
cf https://github.com/ReolinkCameraAPI/reolinkapipy/tree/master/reolinkapi/mixins/user.py


  • Cfg System General Dst Settings URL : GetTime
    https://#IP#/cgi-bin/api.cgi?cmd=GetTime&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :

Commande en écriture : SetTime (POST)


  • Cfg System Information URL : GetDevInfo
    https://#IP#/cgi-bin/api.cgi?cmd=GetDevInfo&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetDevInfo


  • Cfg System Information URL : GetDevName
    https://#IP#/cgi-bin/api.cgi?cmd=GetDevName&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
image

Commande en écriture : SetDevName (POST)


  • Cfg System Export Config URL : ExportCfg
    https://#IP#/cgi-bin/api.cgi?cmd=ExportCfg&user=#username#&password=#password#
----> Fichier config.tgz

  • Cfg System Maintenance URL : GetAutoUpgrade
    https://#IP#/cgi-bin/api.cgi?cmd=GetAutoUpgrade&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetAutoUpgrade

Commande en écriture : SetAutoUpgrade (POST)


  • Cfg System Performance URL : GetPerformance
    https://#IP#/cgi-bin/api.cgi?cmd=GetPerformance&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetPerformance


  • Cfg System Reboot URL : GetAutoMaint
    https://#IP#/cgi-bin/api.cgi?cmd=GetAutoMaint&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetAutoMaint

Commande en écriture : SetAutoMaint (POST)


  • Reboot URL (POST) : Reboot
    https://#IP#/cgi-bin/api.cgi?cmd=Reboot&rs=#value#&user=#username#&password=#password#

  • Cfg Alarm URL : GetAlarm ==CHANNEL==
    https://#IP#/cgi-bin/api.cgi?cmd=GetAlarm&channel=0&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :

[ { "cmd" : "GetAlarm", "code" : 0, "value" : { "Alarm" : { "action" : { "mail" : 1, "push" : 1, "recChannel" : [ 0 ] }, "channel" : 0, "enable" : 1, "schedule" : { "table" : "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" }, "scope" : { "cols" : 80, "rows" : 60, "table" : "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111100000000000000000000000000000000000000000000000000000111111111111111111111111111111111111110000000000000000000000000000000000000000001111111111111111111111111111111111111111111111110000000000000000000000000000000011111111111111111111111111111111111111111111111111111110000000000000000000000001111111111111111111111111111111111111111111111111111111100001000000000000000000111111111111111111111111111111111111111111111111111111111111111000000000111100001111111111111111111111111111111111111111111111111111111111111111100000001111111111111111111111111111111111111111111111111111111111111111111111111110001111111111111111111111111111111111111111111111111111111111111111111111111111100011111111111111111111111111111111111111111111111111111111111111111111111111111011111111111111111111111111111111111111111111111111111111111111111111111111111110111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101111111111111111111111111111111111111111111111111111111111111111111111111111111011111111111111111111111111111111111111111111111111111111111111111111111111111110011111111111111111111111111111111111111111111111111111111111111111111111111111100111111111111111111111111111111111111111111111111111111111111111111111111111111001111111111111111111111111111111111111111111111111111111111111111111111111111110011111111111111111111111111111111111111111111111111111111111111111111111111111100011111111111111111111111111111111111111111111111111111111111111111111111111111000111111111111111111111111111111111111111111111111111111111111111111111111111110000111111111111111111111111111111111111111111111111111111111111111111111111111100001111111111111111111111111111111111111111111111111111111111111111111111111111000011111111111111111111111111111111111111111111111111111111111111111111111111110000111111111111111111111111111111111111111111111111111111111111111111111111111100000111111111111111111111111111111111111111111111111111111111111111111111111000000001111111111111111111111111111111111111111111111111111111111111111111111100000000011111111111111111111111111111111111111111111111111111111111111111111111000000000011111111111111111111111111111111111111111111111111111111111111111111000000000000111111111111111111111111111111111111111111111111111111111111111111110000000000000111111111111111111111111111111111111111111111111111111111111111110000000000000001111111111111111111111111111111111111111111111111111111111111111100000000000000011111111111111111111111111111111111111111111111111111111111111110000000000000000011111111111111111111111111111111111111111111111111111111111110000000000000000000111111111111111111111111111111111111111111111111111111111111100000000000000000000111111111111111111111111111111111111111111111111111111111100000000000000000000001111111111111111111111111111111111111111111111111111111111000000000000000000000001111111111111111111111111111111111111111111111111111111100000000000000000000000011111111111111111111111111111111111111111111111111111111000000000000000000000000011111111111111111111111111111111111111111111111111111000000000000000000000000000111111111111111111111111111111111111111111111111111110000000000000000" }, "sens" : [ { "beginHour" : 0, "beginMin" : 0, "endHour" : 6, "endMin" : 0, "id" : 0, "sensitivity" : 10 }, { "beginHour" : 6, "beginMin" : 0, "endHour" : 12, "endMin" : 0, "id" : 1, "sensitivity" : 10 }, { "beginHour" : 12, "beginMin" : 0, "endHour" : 18, "endMin" : 0, "id" : 2, "sensitivity" : 10 }, { "beginHour" : 18, "beginMin" : 0, "endHour" : 23, "endMin" : 59, "id" : 3, "sensitivity" : 10 } ], "type" : "md" } } } ]

Commandes en écriture : SetAlarm (POST) ==CHANNEL==

NOUVELLES COMMANDES (commandes venant en remplacement des commandes GetAlarm/SetAlarm)

Commandes en écriture : SetMdAlarm (POST) ==CHANNEL==


  • Motion Detector Status URL (Etat de la detection de mouvement) : GetMdState
    https://#IP#/cgi-bin/api.cgi?cmd=GetMdState&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetMdState


  • Cfg Network General URL / Cfg Network Status URL : GetLocalLink
    https://#IP#/cgi-bin/api.cgi?cmd=GetLocalLink&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetLocalLink

Commande en écriture : SetLocalLink (POST)


  • Cfg Network Advanced DDNS URL : GetDdns
    https://#IP#/cgi-bin/api.cgi?cmd=GetDdns&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetDdns

Commande en écriture : SetDdns (POST)


  • Cfg Network Advanced NTP URL : GetNtp
    https://#IP#/cgi-bin/api.cgi?cmd=GetNtp&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetNtp

Commande en écriture : SetNtp (POST)


  • Cfg Network Advanced Email URL : GetEmail
    https://#IP#/cgi-bin/api.cgi?cmd=GetEmail&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :

[ { "cmd" : "GetEmail", "code" : 0, "value" : { "Email" : { "addr1" : "", "addr2" : "", "addr3" : "", "attachment" : "picture", "interval" : "5 Minutes", "nickName" : "", "password" : "", "schedule" : { "enable" : 1, "table" : "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" }, "smtpPort" : 465, "smtpServer" : "smtp.gmail.com", "ssl" : 1, "userName" : "" } } } ]

Commande en écriture : SetEmail (POST)

Autre commande Email : TestEmail (POST)


  • Cfg Network Advanced FTP URL : GetFtp
    https://#IP#/cgi-bin/api.cgi?cmd=GetFtp&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :

[ { "cmd" : "GetFtp", "code" : 0, "value" : { "Ftp" : { "anonymous" : 0, "interval" : 30, "maxSize" : 100, "mode" : 0, "password" : "", "port" : 21, "remoteDir" : "", "schedule" : { "enable" : 1, "table" : "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" }, "server" : "", "streamType" : 0, "userName" : "" } } } ]

Commande en écriture : SetFtp (POST)

Autre commande FTP : TestFtp (POST)
NB : si test de connexion ftp en anonyme, mettre « anonymous » : 1


  • Cfg Network Advanced Push URL : GetPush
    https://#IP#/cgi-bin/api.cgi?cmd=GetPush&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :

[ { "cmd" : "GetPush", "code" : 0, "value" : { "Push" : { "schedule" : { "enable" : 1, "table" : "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" } } } } ]

Commande en écriture : SetPush (POST)


  • cfg Network Ports URL : GetNetPort
    https://#IP#/cgi-bin/api.cgi?cmd=GetNetPort&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetNetPort

Commande en écriture : SetNetPort (POST)
https://github.com/ReolinkCameraAPI/reolinkapipy/tree/master/reolinkapi/mixins/network.py


  • cfg Network Upnp URL : GetUpnp
    https://#IP#/cgi-bin/api.cgi?cmd=GetUpnp&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetUpnp

Commande en écriture : SetUpnp (POST)


  • cfg Network P2p URL : GetP2p
    https://#IP#/cgi-bin/api.cgi?cmd=GetP2p&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetP2p
Commande en écriture : SetP2p (POST)


  • Cfg Record Encode URL : GetEnc ==CHANNEL==
    https://#IP#/cgi-bin/api.cgi?cmd=GetEnc&channel=0&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetEnc

Commande en écriture : SetEnc (POST) ==CHANNEL==


  • Cfg Record Advance URL : GetRec ==CHANNEL==
    https://#IP#/cgi-bin/api.cgi?cmd=GetRec&channel=0&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :

[ { "cmd" : "GetRec", "code" : 0, "value" : { "Rec" : { "channel" : 0, "overwrite" : 1, "postRec" : "15 Seconds", "preRec" : 1, "schedule" : { "enable" : 1, "table" : "111111110000000000000111111111110000000000000111111111110000000000000111111111110000000000000111111111110000000000000111111111110000000000000111111111110000000000000111" } } } } ]

Commande en écriture : SetRec (POST) ==CHANNEL==


  • Cfg Display Camera Snapshot URL : Snap ==CHANNEL==
    https://#IP#/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=#value#&user=#username#&password=#password#
----> Image

NB : Dimensionnement possible de l’image de capture avec les options : &width=xxx et &height=yyy
(xxx et yyy sont des valeurs en pixels)
Exemple :
https://#IP#/cgi-bin/api.cgi?cmd=Snap&width=320&height=240&channel=0&rs=#value#&user=#username#&password=#password#

----> Image en 320x240

  • Cfg Video Norm URL : GetNorm (==CHANNEL== : fonctionne aussi avec argument channel)
    https://#IP#/cgi-bin/api.cgi?cmd=GetNorm&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetNorm

Commande en écriture : SetNorm (POST) (==CHANNEL== : fonctionne aussi avec argument channel)


  • Cfg Display Camera OSD URL : GetOsd ==CHANNEL==
    https://#IP#/cgi-bin/api.cgi?cmd=GetOsd&channel=0&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetOsd

Commande en écriture : SetOsd (POST) ==CHANNEL==
Réferences :
++ reolinkapipy (fichier display.py)


  • Mask OSD URL : GetMask ==CHANNEL==
    https://#IP#/cgi-bin/api.cgi?cmd=GetMask&channel=0&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetMask
Commandes en écriture : SetMask (POST) ==CHANNEL==


json à envoyer

[{"cmd":"GetAbility","action":0,"param":{"User":{"userName":"admin"}}}]

  • Cfg IrLights URL : GetIrLights
    https://#IP#/cgi-bin/api.cgi?cmd=GetIrLights&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetIrLights

Commande en écriture : SetIrLights (POST)


  • Cfg Video Clip Crop URL : GetCrop (==CHANNEL== : fonctionne aussi avec argument channel)
    https://#IP#/cgi-bin/api.cgi?cmd=GetCrop&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetCrop

Commande en écriture : SetCrop (POST)


  • Cfg Image URL : GetImage ==CHANNEL==
    https://#IP#/cgi-bin/api.cgi?cmd=GetImage&channel=0&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :
GetImage

Commande en écriture : SetImage (POST) ==CHANNEL==


  • Cfg Isp URL : GetIsp ==CHANNEL==
    https://#IP#/cgi-bin/api.cgi?cmd=GetIsp&channel=0&rs=#value#&user=#username#&password=#password#

exemple de fichier json récupéré :

[ { "cmd" : "GetIsp", "code" : 0, "value" : { "Isp" : { "antiFlicker" : "Outdoor", "backLight" : "Off", "blc" : 128, "blueGain" : 128, "channel" : 0, "dayNight" : "Auto", "drc" : 128, "exposure" : "Auto", "gain" : { "max" : 62, "min" : 1 }, "mirroring" : 0, "nr3d" : 1, "redGain" : 128, "rotation" : 0, "shutter" : { "max" : 125, "min" : 0 }, "whiteBalance" : "Auto" } } } ]

Commande en écriture : SetIsp (POST) ==CHANNEL==