This is an old revision of the document!
http://yourhost.com/wr/?module=remoteapi&key=WRxxxxxxxxxxxx&action=rest&object=method
Where:
Parameters to methods may be specified as POST variable with name “data”, that contains JSON array as key⇒value inside. All request results will be returned as JSON too.
| Object | Method | Parameters required | Action/Reply |
|---|---|---|---|
| models | getall | array of all existing camera models | |
| storages | getall | array of available storages | |
| getstates | array of all storages states | ||
| cameras | getall | returs array of all available cameras data | |
| create | modelid + ip + login + password + active + storageid + description | creates new camera | |
| activate | cameraid | sets some camera as active | |
| deactivate | cameraid | deactivates specified camera | |
| setdescription | cameraid + description | sets description for specified camera | |
| delete | cameraid | deletes specified camera | |
| isregistered | ip | checks is some camera is registered by IP on NVR or not? | |
| users | getall | returns array of all available users data | |
| create | login + password | creates new limited user | |
| changepassword login + password | changes password for some user | ||
| delete | login | deletes existing user | |
| isregistered | login | checks is user registered or not | |
| checkauth | login + password | checks user credentials | |
| acls | getall | returns array of all available ACLs | |
| getallcameras | returns array of all cameras ACLs | ||
| getallchannels | returns array of all per-channel ACLs | ||
| getchannels | login | returns array of all channels available for user | |
| getcameras | login | returns array of all cameras available for user | |
| assignchannel | login + channelid | assigns some channel to user with ACL | |
| assigncamera | login + cameraid | assigns camera to user with ACL | |
| deassignchannel | login + channelid | deletes channel ACL for some user | |
| deassigncamera | login + cameraid | deletes camera ACL for specified user | |
| channels | getall | returns array of all available channels | |
| getscreenshotsall | returns array of all available channel screenshots | ||
| getscreenshot | channelid | returns specified channel screenshot path | |
| getlivestream | channelid | returns live preview stream URL | |
| recorders | getall | returns array of all running cameras recorders processes | |
| isrunning | cameraid | check is recorder running for some camera or not | |
| system | gethealth | returns array of basic system health parameters |
Request
http://yourhost.com/wr/?module=remoteapi&key=WRxxxxxxxxxxxx&action=rest&models=getall
Reply
Array
(
[12] => Array
(
[id] => 12
[modelname] => Unv
[template] => UNV_IPC2122LB-SF28-A
)
[11] => Array
(
[id] => 11
[modelname] => Hikvision DS-2CD1023G0E-I
[template] => Hikvision_DS-2CD1023G0E-I
)
[10] => Array
(
[id] => 10
[modelname] => Tyto IPC-5D28-KS-30
[template] => Tyto_IPC-5D28-KS-30
)
....
Request
http://yourhost.com/wr/?module=remoteapi&key=WRxxxxxxxxxxxx&action=rest&wrongobject=getall
Reply
Array
(
[error] => 1
[message] => "No object specified"
)
Request
http://yourhost.com/wr/?module=remoteapi&key=WRxxxxxxxxxxxx&action=rest&users=wrongmethod
Reply
Array
(
[error] => 2
[message] => "Method not exists"
)
Request
http://yourhost.com/wr/?module=remoteapi&key=WRxxxxxxxxxxxx&action=rest&storages=getall
Reply
Array
(
[13] => Array
(
[id] => 13
[path] => /mnt/nfs_disk3/wrstorage2
[name] => NFS mounted storage
)
[1] => Array
(
[id] => 1
[path] => /wrstorage
[name] => Default
)
)
Request
http://yourhost.com/wr/?module=remoteapi&key=WRxxxxxxxxxxxx&action=rest&storages=getstates
Reply
Array
(
[13] => Array
(
[state] => 1
[total] => 968792403968
[used] => 639428460544
[free] => 329363943424
)
[1] => Array
(
[state] => 1
[total] => 31183237120
[used] => 28042903552
[free] => 3140333568
)
)
Request
http://yourhost.com/wr/?module=remoteapi&key=WRxxxxxxxxxxxx&action=rest&cameras=getall
Reply
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
[realport] => Here is camera RTSP port that depends template or custom port if set
)
[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
)
[OPTS] => Array
(
[id] => 1
[cameraid] => 57
[rtspport] => 666
[keepsubalive] => 0
[order] =>
)
)
[33] => Array
(
....
Request
http://yourhost.com/wr/?module=remoteapi&key=WRxxxxxxxxxxxx&action=rest&users=create
Request data
$requestData=array( 'login'=>'view666', 'password'=>'PasswordHere' );
POST variable 'data'
{"login":"view666","password":"PasswordHere"}
Reply
Array
(
[error] => 0
[message] => Success
)
Request
http://yourhost.com/wr/?module=remoteapi&key=WRxxxxxxxxxxxx&action=rest&users=create
Request data
$requestData=array( 'login'=>'view666', 'password'=>'PasswordHere' );
POST variable 'data'
{"login":"view666","password":"PasswordHere"}
Reply
Array
(
[error] => 7
[message] => User already exists
)
We hope it is clear how it works. You can also check out a sample implementation of this API at this link.