User Tools

Site Tools


api

HTTP REST API

Basics

http://yourhost.com/wr/?module=remoteapi&key=WRxxxxxxxxxxxx&action=rest&object=method

Where:

  • http://yourhost.com/wr/ - full URL of your working WolfRecorder instance
  • WRxxxxxxxxxxxx - your WolfRecorder serial key used for authorization
  • object - some object to do something with some method
  • method - method name to perform actions with an specified object

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.

Supported objects and methods list

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?
isipportfree ip+port checks is some camera IP+PORT free 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

Usage examples

Models list

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
        )
....

Wrong object or method

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"
)

Storages list

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
        )

)

Storages states

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
        )

)

Existing cameras list

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
        (
        ....

User creation

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
)

Attempt to create existing user

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.

api.txt · Last modified: 2024/10/11 17:47 by nightfly