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 [2023/05/08 17:30]
nightfly
api [2023/07/22 12:19] (current)
nightfly
Line 22: Line 22:
 | models     | getall       | array of all existing camera models  | | models     | getall       | array of all existing camera models  |
 | storages   | getall       | array of available storages  | | storages   | getall       | array of available storages  |
-|            | getstate |     | array of all storages states |+|            | getstates |     | array of all storages states |
 | cameras    | getall |     | returs array of all available cameras data | | cameras    | getall |     | returs array of all available cameras data |
 |            | create | modelid + ip + login + password + active + storageid + description     | creates new camera | |            | create | modelid + ip + login + password + active + storageid + description     | creates new camera |
Line 48: Line 48:
 |            | getscreenshotsall |      | returns array of all available channel screenshots | |            | getscreenshotsall |      | returns array of all available channel screenshots |
 |            | getscreenshot | channelid     | returns specified channel screenshot path | |            | getscreenshot | channelid     | returns specified channel screenshot path |
-|            | getlivestream | channelid     | returns live preview stream URL (not implemented yet) |+|            | getlivestream | channelid     | returns live preview stream URL |
 | recorders  | getall |      | returns array of all running cameras recorders processes | | recorders  | getall |      | returns array of all running cameras recorders processes |
 |            | isrunning | cameraid      | check is recorder running for some camera or not | |            | isrunning | cameraid      | check is recorder running for some camera or not |
Line 134: Line 134:
 **Reply** **Reply**
 <code> <code>
-DEBUG 
- 
- 
 Array Array
 ( (
Line 155: Line 152:
 ) )
 </code> </code>
 +
 +
 +===== Storages states =====
 +
 +**Request**
 +<code>
 +http://yourhost.com/wr/?module=remoteapi&key=WRxxxxxxxxxxxx&action=rest&storages=getstates
 +</code>
 +
 +**Reply**
 +<code>
 +Array
 +(
 +    [13] => Array
 +        (
 +            [state] => 1
 +            [total] => 968792403968
 +            [used] => 639428460544
 +            [free] => 329363943424
 +        )
 +
 +    [1] => Array
 +        (
 +            [state] => 1
 +            [total] => 31183237120
 +            [used] => 28042903552
 +            [free] => 3140333568
 +        )
 +
 +)
 +
 +</code>
 +
 +
 +
 +===== Existing cameras list =====
 +
 +
 +**Request**
 +<code>
 +http://yourhost.com/wr/?module=remoteapi&key=WRxxxxxxxxxxxx&action=rest&cameras=getall
 +</code>
 +
 +**Reply**
 +<code>
 +Array
 +(
 +    [54] => Array
 +        (
 +            [CAMERA] => Array
 +                (
 +                    [id] => 54
 +                    [modelid] => 11
 +                    [ip] => 172.30.1.92
 +                    [login] => admin
 +                    [password] => SomePassword
 +                    [active] => 1
 +                    [storageid] => 1
 +                    [channel] => kiqgdmrbma1
 +                    [comment] => Here some camera description
 +                )
 +
 +            [TEMPLATE] => Array
 +                (
 +                    [DEVICE] => Hikvision DS-2CD1023G0E-I
 +                    [PROTO] => rtsp
 +                    [MAIN_STREAM] => /h264
 +                    [SUB_STREAM] => /h264
 +                    [RTSP_PORT] => 554
 +                    [HTTP_PORT] => 80
 +                    [SOUND] => 0
 +                )
 +
 +            [STORAGE] => Array
 +                (
 +                    [id] => 1
 +                    [path] => /wrstorage
 +                    [name] => Default
 +                )
 +
 +        )
 +
 +    [33] => Array
 +        (
 +        ....
 +</code>
 +
 +
 +===== User creation =====
 +
 +**Request**
 +<code>
 +http://yourhost.com/wr/?module=remoteapi&key=WRxxxxxxxxxxxx&action=rest&users=create
 +</code>
 +
 +**Request data**
 +<code>
 +$requestData=array(
 + 'login'=>'view666',
 + 'password'=>'PasswordHere'
 + );
 +</code>
 +
 +**POST variable 'data'**
 +<code>
 +
 +{"login":"view666","password":"PasswordHere"}
 +</code>
 +
 +**Reply**
 +<code>
 +
 +
 +Array
 +(
 +    [error] => 0
 +    [message] => Success
 +)
 +</code>
 +
 +===== Attempt to create existing user =====
 +
 +**Request**
 +<code>
 +http://yourhost.com/wr/?module=remoteapi&key=WRxxxxxxxxxxxx&action=rest&users=create
 +</code>
 +
 +**Request data**
 +<code>
 +$requestData=array(
 + 'login'=>'view666',
 + 'password'=>'PasswordHere'
 + );
 +</code>
 +
 +**POST variable 'data'**
 +<code>
 +
 +{"login":"view666","password":"PasswordHere"}
 +</code>
 +
 +**Reply**
 +<code>
 +Array
 +(
 +    [error] => 7
 +    [message] => User already exists
 +)
 +</code>
 +
 +
 +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]].
  
api.1683556206.txt.gz · Last modified: 2023/05/08 17:30 by nightfly