User Tools

Site Tools


api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
api [2024/10/11 17:33]
nightfly
api [2026/05/19 01:45] (current)
nightfly [Read-only clients apps API]
Line 1: Line 1:
 ====== HTTP REST API ====== ====== HTTP REST API ======
  
-====== Basics ======+====== NVR management basics ======
  
  
Line 30: Line 30:
 |            | delete | cameraid | deletes specified camera | |            | delete | cameraid | deletes specified camera |
 |            | isregistered | ip    | checks is some camera is registered by IP on NVR or not? | |            | isregistered | ip    | checks is some camera is registered by IP on NVR or not? |
 +|            | isipportfree | ip+port   | checks is some camera IP+PORT free on NVR or not? |
 | users      | getall |      | returns array of all available users data | | users      | getall |      | returns array of all available users data |
 |            | create | login + password     | creates new limited user | |            | create | login + password     | creates new limited user |
Line 213: Line 214:
                     [comment] => Here some camera description                     [comment] => Here some camera description
                     [realport] => Here is camera RTSP port that depends template or custom port if set                     [realport] => Here is camera RTSP port that depends template or custom port if set
 +                    [maxretention] => Here is maximum retention days limit or zero if no
                 )                 )
  
Line 239: Line 241:
                     [rtspport] => 666                     [rtspport] => 666
                     [keepsubalive] => 0                     [keepsubalive] => 0
 +                    [maxretdays] => 0
                     [order] =>                      [order] => 
                 )                    )   
Line 314: Line 317:
  
 We hope it is clear how it works. You can also check out a sample implementation of this API at [[https://github.com/nightflyza/Ubilling/blob/master/api/libs/api.wolfrecorder.php|this link]]. We hope it is clear how it works. You can also check out a sample implementation of this API at [[https://github.com/nightflyza/Ubilling/blob/master/api/libs/api.wolfrecorder.php|this link]].
 +
 +
 +====== Read-only clients apps API ======
 +
 +Works same way, but requires only login+password or login+authtoken(md5 hash of password) instead of WolfRecorder serial.
 +
 +You can set user credentials as raw GET variables or inside keys in "data" POST array.
 +
 +<code>
 +curl -s -X POST 'https://yourhost/wr/?module=remoteapi&action=clientrest&channels=getall' --data-urlencode 'data={"login":"admin","password":"demo"}'
 +</code>
 +
 +or
 +
 +<code>
 +curl -s -X POST 'https://yourhost/wr/?module=remoteapi&action=clientrest&channels=getall&login=admin&password=demo'
 +</code>
 +
 +
 +====== Supported objects and methods list ======
 +
 +^ Object ^ Method ^ Parameters required ^ Action/Reply ^cified user |
 +| channels   | getall |  login+password or login+authtoken   | returns array of all accessible by user channels info |
 +
 +
 +====== Usage examples ======
 +
 +===== Normal request =====
 +<code>
 +curl -s -X POST 'https://yourhost/wr/?module=remoteapi&action=clientrest&channels=getall' --data-urlencode 'data={"login":"admin","password":"demo"}'
 +</code>
 +
 +<code json>
 +{
 +
 +    "error":0,
 +    "channels":[
 +        {
 +            "id":"randomchannelid01",
 +            "comment":"Just test cam",
 +            "active":0,
 +            "recording":0,
 +            "mainstream":0,
 +            "substream":0,
 +            "screenshot":"skins/chanblock.gif"
 +        },
 +        {
 +            "id":"randomchannelid02",
 +            "comment":"Another cam",
 +            "active":1,
 +            "recording":1,
 +            "mainstream":1,
 +            "substream":0,
 +            "screenshot":"howl/chanshots/randomchannelid02.jpg"
 +        }
 +    ]
 +
 +}
 +</code>
 +
 +===== Wrong credentials =====
 +
 +<code>
 +curl -s -X POST 'https://yourhost/wr/?module=remoteapi&action=clientrest&channels=getall&login=admin&password=wrongpassword'
 +</code>
 +
 +<code>
 +{
 +
 +    "error":6,
 +    "message":"Wrong credentials"
 +
 +}
 +</code>
 +
 +
 +===== Wrong request format =====
 +
 +<code>
 +curl -s -X POST 'https://yourhost/wr/?module=remoteapi&action=clientrest&channels=getall'
 +</code>
 +
 +<code>
 +{
 +
 +    "error":3,
 +    "message":"Wrong request data"
 +
 +}
 +</code>
 +
 +
  
api.1728657193.txt.gz ยท Last modified: 2024/10/11 17:33 by nightfly