0% found this document useful (0 votes)
1K views81 pages

Dahua HTTP Api For DVR V1.29

This document details the API for accessing and configuring Dahua video products. It provides an overview and catalog of the API, describes HTTP transactions and authentication. It then details APIs for camera functions like streams, video/audio encoding, snapshots, and other settings.

Uploaded by

zedator
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views81 pages

Dahua HTTP Api For DVR V1.29

This document details the API for accessing and configuring Dahua video products. It provides an overview and catalog of the API, describes HTTP transactions and authentication. It then details APIs for camera functions like streams, video/audio encoding, snapshots, and other settings.

Uploaded by

zedator
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 81

DAHUA HTTP API FOR DVR

Version 1.29

1
Document History
No Release Notes Date Version Author
1 draft 2007-1-18 1.10 Haifeng Wang

2 Add alarm push and version description 2012-8-18 1.20 Weijun Li

3 Add ptz control description 2012-9-11 1.21 Weijun Li


Add Playback,download file in rtsp description in character 2012-9-29 1.22 Mingwei Zhou
4 4.1.5,4.1.6 and monitor and playback in http in character 4.1.7
and 4.1.8.
Delete 4.3VideoInOptions,10.2.1GetStorageDeviceCollect, 2012-10-26 1.23 Chenglei Tang
10.3.1GetWorkGroupCollect,10.4.1GetWorkDirectoryCollect
5
Add 10.2.1 GetStorageDevicePortInfo
Add 9.8.8 GetVendor
Add firmware version description in chapter 1.Add motion data 2012-10-29 1.24 Wei Chen
7
description in chapter 6.9.
8 Add chapter 15 PositionManager. 2013-1-18 1.25 WeiChen
9 Add stream type description in chapter 4.1.4. 2013-3-22 1.26 WeiChen
Modify some descprition error. Modify MotionDetect to 2013-4-2 1.27 WeiChen
10 LossDetect in chapter 6.5.1 .Modify audio bitrate and
compression range description in chapter 4.4.3.
Add 9.8.9 GetSoftWareVersion 2013-4-2 1.28 Chenglei Tang
11
Add 9.8.10 GetBuildDate
Modify descprition error in chapter 14.1.The stream format is 2013-6-7 1.29 WeiChen
12
used in 4.1.9 and 4.1.10.

2
1. Preface
This document details the API of Dahua video products. Programmers can access and configure Dahua video products follows the API. This
document with version 1.10 is available with firmware version 2.608, 2.610 and above. This document with version 1.20, 1.21, 1.22, 1.23, 1.24
is available with firmware 2.616 and above.

2. Catalog
Document History ......................................................................................................................................................................................................2
1. Preface..............................................................................................................................................................................................................3
2. Catalog..............................................................................................................................................................................................................3
3. HTTP API Transaction ........................................................................................................................................................................................8
3.1Transaction ...................................................................................................................................................................................................8
3.2Authentication ..............................................................................................................................................................................................9
4. Camera .............................................................................................................................................................................................................9
4.1Stream ........................................................................................................................................................................................................10
4.1.1 GetStream .......................................................................................................................................................................................10
4.1.2 GetMaxExtraStreamCounts .............................................................................................................................................................10
4.1.3 GetSnapshot ...................................................................................................................................................................................10
4.1.4 GetVideo .........................................................................................................................................................................................10
4.1.5 Playback ..........................................................................................................................................................................................11
4.1.6 Download ........................................................................................................................................................................................11
4.1.7 PlayBack By Filename .....................................................................................................................................................................11
4.1.8 LoadFile By Filename ......................................................................................................................................................................12
4.1.9 GetStream By Http ..........................................................................................................................................................................12
4.1.10 Playback By Http ...........................................................................................................................................................................12
4.2VideoColor ..................................................................................................................................................................................................13
4.2.1 GetVideoColorConfig ......................................................................................................................................................................13
4.2.2 SetVideoColorConfig .......................................................................................................................................................................13
4.3VideoEncode...............................................................................................................................................................................................14
4.3.1 GetVideoConfigCaps .......................................................................................................................................................................14
4.3.2 Resolution .......................................................................................................................................................................................15
4.3.3 GetVideoEncodeConfig ...................................................................................................................................................................16
4.3.4 SetVideoEncodeConfig ................................................................................................................................................................... 17
4.4AudioEncode ...............................................................................................................................................................................................18
4.4.1 GetAudioConfigCaps .......................................................................................................................................................................18
4.4.2 GetAudioEncodeConfig ...................................................................................................................................................................18
4.4.3 SetAudioEncodeConfig....................................................................................................................................................................19
4.5 SnapEncode ...............................................................................................................................................................................................20
4.5.1 GetSnapConfigCaps .........................................................................................................................................................................20
4.5.2 GetSnapEncodeConfig ....................................................................................................................................................................21

3
4.5.3 SetSnapEncodeConfig .....................................................................................................................................................................21
4.6ChannelTitle ...............................................................................................................................................................................................22
4.6.1 GetChannelTitleConfig ....................................................................................................................................................................22
4.6.2 SetChannelTitleConfig ....................................................................................................................................................................22
4.7VideoStandard ............................................................................................................................................................................................23
4.7.1 GetVideoStandardConfig ................................................................................................................................................................23
4.7.2 SetVideoStandardConfig .................................................................................................................................................................23
4.8VideoWidget...............................................................................................................................................................................................23
4.8.1 GetVideoWidgetConfig ...................................................................................................................................................................23
4.8.2 SetVideoWidgetConfig ...................................................................................................................................................................24
4.9VideoOut ....................................................................................................................................................................................................25
4.9.1 GetVideoOutConfig.........................................................................................................................................................................25
4.9.2 SetVideoOutConfig .........................................................................................................................................................................26
5. NetWork ......................................................................................................................................................................................................... 27
5.1NetInterfaces .............................................................................................................................................................................................. 27
5.1.1 GetInterfaces................................................................................................................................................................................... 27
5.2BasicConfig.................................................................................................................................................................................................. 27
5.2.1 GetBasicConfig ................................................................................................................................................................................ 27
5.2.2 SetBasicConfig .................................................................................................................................................................................28
5.3PPPoE ..........................................................................................................................................................................................................28
5.3.1 GetPPPoEConfig ..............................................................................................................................................................................28
5.3.2 SetPPPoEConfig ...............................................................................................................................................................................29
5.4DDNS ...........................................................................................................................................................................................................29
5.4.1 GetDDNSConfig ...............................................................................................................................................................................29
5.4.2 SetDDNSConfig................................................................................................................................................................................29
5.5Email ...........................................................................................................................................................................................................30
5.5.1 GetEmailConfig ...............................................................................................................................................................................30
5.5.2 SetEmailConfig ................................................................................................................................................................................31
5.6Wlan ...........................................................................................................................................................................................................31
5.6.1 GetWlanConfig ................................................................................................................................................................................31
5.6.2 SetWlanConfig ................................................................................................................................................................................32
5.7UPnP ...........................................................................................................................................................................................................33
5.7.1 GetUPnPConfig ...............................................................................................................................................................................33
5.7.2 SetUPnPConfig ................................................................................................................................................................................33
5.7.3 GetUPnPStatus ................................................................................................................................................................................33
5.8NTP .............................................................................................................................................................................................................34
5.8.1 GetNTPConfig..................................................................................................................................................................................34
5.8.2 SetNTPConfig ..................................................................................................................................................................................34
5.9AlarmServer ................................................................................................................................................................................................35
5.9.1 GetAlarmServerConfig ....................................................................................................................................................................35
5.9.2 SetAlarmServerConfig .....................................................................................................................................................................35
6. Events .............................................................................................................................................................................................................36
6.1EventHandler ..............................................................................................................................................................................................36
6.1.1 GetEventHandler.............................................................................................................................................................................36
6.1.2 SetEventHandler ............................................................................................................................................................................. 37

4
6.2Alarm ..........................................................................................................................................................................................................39
6.2.1 GetAlarmConfig ..............................................................................................................................................................................39
6.2.2 SetAlarmConfig ...............................................................................................................................................................................39
6.2.3 GetAlarmOutConfig ........................................................................................................................................................................39
6.2.4 SetAlarmOutConfig .........................................................................................................................................................................40
6.2.5 GetInSlots ........................................................................................................................................................................................40
6.2.6 GetOutSlots .....................................................................................................................................................................................40
6.2.7 GetInState .......................................................................................................................................................................................40
6.2.8 GetOutState ....................................................................................................................................................................................41
6.2.9 GetChannelInState ..........................................................................................................................................................................41
6.2.10 GetChannelOutState .....................................................................................................................................................................41
6.3MotionDetect .............................................................................................................................................................................................41
6.3.1 GetMotionDetectConfig ..................................................................................................................................................................41
6.3.2 SetMotionDetectConfig ..................................................................................................................................................................42
6.4BlindDetect .................................................................................................................................................................................................42
6.4.1 GetBlindDetectConfig .....................................................................................................................................................................42
6.4.2 SetBlindDetectConfig ......................................................................................................................................................................43
6.5LossDetect ..................................................................................................................................................................................................43
6.5.1 GetLossDetectConfig .......................................................................................................................................................................43
6.5.2 SetLossDetectConfig .......................................................................................................................................................................43
6.6 StorageAbnormal .......................................................................................................................................................................................44
6.6.1 GetStorageNotExistConfig ...............................................................................................................................................................44
6.6.2 SetStorageNotExistConfig ...............................................................................................................................................................44
6.6.3 Get StorageFailureConfig ................................................................................................................................................................44
6.6.4 Set StorageFailureConfig .................................................................................................................................................................44
6.6.5 GetStorageLowSpaceConfig ............................................................................................................................................................45
6.6.6 SetStorageLowSpaceConfig .............................................................................................................................................................45
6.7 NetAbnormal .............................................................................................................................................................................................45
6.7.1 GetNetAbortConfig .........................................................................................................................................................................45
6.7.2 SetNetAbortConfig ..........................................................................................................................................................................45
6.7.3 GetIPConflictConfig .........................................................................................................................................................................46
6.7.4 SetIPConflictConfig .........................................................................................................................................................................46
6.8 GetEventIndexes ........................................................................................................................................................................................46
6.9 Attach.........................................................................................................................................................................................................46
7.PTZ ........................................................................................................................................................................................................................48
7.1PTZConfig ....................................................................................................................................................................................................48
7.1.1 GetPTZConfig ..................................................................................................................................................................................48
7.1.2 SetPTZConfig ...................................................................................................................................................................................48
7.2PTZControl ..................................................................................................................................................................................................49
7.2.1 GetProtocolList................................................................................................................................................................................49
7.2.2 GetCurrentProtocolCaps .................................................................................................................................................................49
7.2.3 PTZ control commands ...................................................................................................................................................................50
7.3PTZStatus ....................................................................................................................................................................................................53
7.3.1 PTZ GetStatus ..................................................................................................................................................................................53
7. Record&Snap ..................................................................................................................................................................................................53

5
8.1Record .........................................................................................................................................................................................................53
8.1.1 GetRecordConfig .............................................................................................................................................................................53
8.1.2 SetRecordConfig..............................................................................................................................................................................54
8.1.3 GetRecordModeConfig ...................................................................................................................................................................54
8.1.4 SetRecordModeConfig ....................................................................................................................................................................55
8.2Snap ............................................................................................................................................................................................................55
8.2.1 GetSnapConfig ................................................................................................................................................................................55
8.2.2 SetSnapConfig .................................................................................................................................................................................55
8. System ............................................................................................................................................................................................................56
9.1General .......................................................................................................................................................................................................56
9.1.1 GetGeneralConfig............................................................................................................................................................................56
9.1.2 SetGeneralConfig ............................................................................................................................................................................56
9.2SystemTime ................................................................................................................................................................................................ 57
9.2.1 GetCurrentTime .............................................................................................................................................................................. 57
9.2.2 SetCurrentTime............................................................................................................................................................................... 57
9.3Locales ........................................................................................................................................................................................................ 57
9.3.1 GetLocalesConfig ............................................................................................................................................................................ 57
9.3.2 SetLocalesConfig .............................................................................................................................................................................58
9.4Language .....................................................................................................................................................................................................59
9.4.1 GetLanguageCaps ...........................................................................................................................................................................59
9.4.2 GetLanguageConfig .........................................................................................................................................................................59
9.4.3 SetLanguageConfig..........................................................................................................................................................................59
9.5AccessFilter .................................................................................................................................................................................................60
9.5.1 GetAccessFilterConfig .....................................................................................................................................................................60
9.5.2 SetAccessFilterConfig ......................................................................................................................................................................60
9.6AutoMaintain ..............................................................................................................................................................................................60
9.6.1 GetAutoMaintainConfig ..................................................................................................................................................................60
9.6.2 SetAutoMaintainConfig ...................................................................................................................................................................61
9.7UserManager ..............................................................................................................................................................................................61
9.7.1 Group ..............................................................................................................................................................................................61
9.7.2 GetGroupInfo .................................................................................................................................................................................. 62
9.7.3 GetGroupInfoAll .............................................................................................................................................................................. 62
9.7.4 AddUser .......................................................................................................................................................................................... 62
9.7.5 DeleteUser ......................................................................................................................................................................................63
9.7.6 ModifyUser .....................................................................................................................................................................................63
9.7.7 ModifyPassword .............................................................................................................................................................................63
9.7.8 GetUserInfo .....................................................................................................................................................................................63
9.7.9 GetUserInfoAll.................................................................................................................................................................................64
9.7.10 GetActiveUserInfoAll .....................................................................................................................................................................64
9.8System Operation .......................................................................................................................................................................................64
9.8.1 Reboot ............................................................................................................................................................................................64
9.8.2 Shutdown ........................................................................................................................................................................................64
9.8.3 GetDeviceType ................................................................................................................................................................................65
9.8.4 GetHardwareVersion .......................................................................................................................................................................65
9.8.5 GetSerialNo .....................................................................................................................................................................................65

6
9.8.6 GetMachineName ...........................................................................................................................................................................65
9.8.7 GetSystemInfo .................................................................................................................................................................................65
9.8.8 GetVendor .......................................................................................................................................................................................65
9.8.9 GetSoftWareVersion .......................................................................................................................................................................66
9.8.10 GetBuildDate .................................................................................................................................................................................66
9.9 Log .............................................................................................................................................................................................................66
9.9.1 StartFind .........................................................................................................................................................................................66
9.9.2 DoFind.............................................................................................................................................................................................66
9.9.3 StopFind .......................................................................................................................................................................................... 67
9.9.4 Clear ................................................................................................................................................................................................ 67
10. Storage ....................................................................................................................................................................................................... 67
10.1 File Finding ...................................................................................................................................................................................... 67
10.1.1 Create............................................................................................................................................................................................ 67
10.1.2 StartFind .......................................................................................................................................................................................68
10.1.3 FindNextFile ..................................................................................................................................................................................68
10.1.4 Close .............................................................................................................................................................................................69
10.1.5 Destroy ..........................................................................................................................................................................................69
10.2 Storage Device .................................................................................................................................................................................69
10.2.1 GetStorageDevicePortInfo ............................................................................................................................................................69
10.3 NAS .................................................................................................................................................................................................. 70
10.3.1 GetNASConfig ............................................................................................................................................................................... 70
10.3.2 SetNASConfig ................................................................................................................................................................................ 70
10.4 Storage Point ....................................................................................................................................................................................71
10.4.1 GetRecordStoragePointConfig ......................................................................................................................................................71
10.4.2 SetRecordStoragePointConfig .......................................................................................................................................................71
10.4.3 GetStorageGroupConfig ................................................................................................................................................................71
10.4.4 SetStorageGroupConfig................................................................................................................................................................. 72
11. GUI ............................................................................................................................................................................................................. 72
11.1.1 GetGUIConfig ................................................................................................................................................................................ 72
11.1.2 SetGUIConfig .................................................................................................................................................................................73
12. Display .......................................................................................................................................................................................................73
12.1 Split ..................................................................................................................................................................................................73
12.1.1 GetSplitMode ................................................................................................................................................................................73
12.1.2 SetSplitMode ................................................................................................................................................................................ 74
12.2 Monitor Tour .................................................................................................................................................................................... 74
12.2.1 EnableMonitorTour ....................................................................................................................................................................... 74
12.2.2 GetMonitorTourConfig .................................................................................................................................................................. 74
12.2.3 SetMonitorTourConfig .................................................................................................................................................................. 74
12.3 Monitor Collect ................................................................................................................................................................................75
12.3.1 GetMonitorCollectionConfig .........................................................................................................................................................75
12.3.2 SetMonitorCollectionConfig..........................................................................................................................................................75
13. Audio.......................................................................................................................................................................................................... 76
13.1 Audio MIME type ............................................................................................................................................................................. 76
13.2 Post Audio ........................................................................................................................................................................................ 76
13.2.1 Example for singlepart .................................................................................................................................................................. 76

7
13.3.2 Example for multipart ...................................................................................................................................................................77
13.3 Get Audio .........................................................................................................................................................................................77
13.3.1 Example for singlepart ..................................................................................................................................................................77
13.3.2 Example for multipart ................................................................................................................................................................... 78
14. Appendix .................................................................................................................................................................................................... 78
14.1 Stream Format ................................................................................................................................................................................. 78
15 PositionManager .........................................................................................................................................................................................80
15.1 GetStatus .........................................................................................................................................................................................80

3. HTTP API Transaction

3.1Transaction

The HTTP API Transaction starts from a request from a client Application, usually a web browser. The request is processed by the web
server on the Dahua video products, then send the response back to the client application. The HTTP request is taken in GET form. If the
request is successful, the Dahua video product will return a HTTP header contains 200 OK. The HTTP Body will contain actual data or error
message if an error occurs.
For describe convenience, we use some short words to instead the long expressions. The follows are several regulations:
1. The italics and bold will be replaced by the value behind the symbol “=”.
2. The URL must follow the standard way of writing a URL.(RFC_3986:Uniform Resource Identifiers (URI) Generic Syntax);that is ,spaces
and other reserved characters (“;”, “/”, “?”, “:”, “@”, “=”, “+”, “,” and “$”) within a <paramName> or a <paramValue> must be replaced
with %<ASCII hex>.For example ,the blank must be instead with %20.
3. To describe the range of the configuration, we use some symbols such as “[]”, “{}” and so on. For example :”[0-100]” denotes a
integer not less than 0 and not larger than 100. “{0,1,2,3}” denotes the valid value of a integer among 0,1,2 and 3.
4. In the request and response, we use “[]” to denote an array. The index is usually a integer and start form 0.
5. The parameter value has several types: string, integer, bool and float.Integer is 32 bits.The range of bool is “true” and “false”.
The below is an example of a transaction:
Request GET http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=VideoColor
Description Get VideoColor configuration.
Response HTTP/1.1 200 OK
Content-Type:text/plain
head.Brightness=50
head.Contrast=50
head.Hue=50
head.Saturation=50
head.TimeSection=1 00:00:00-24:00:00

8
Comment In above table, head= table.VideoColor[ChannelNo][ColorConfigNo]
ChannelNo = video channel index,
colorConfigNo = color config index.
0 = Color Config 1
1 = Color Config 2

We can also request the single config.
For example:
Request :
GET http://10.7.2.4/cgi-bin/configManager.cgi?action=getConfig&name=VideoColor[0][0].Brightness
Response:
HTTP/1.1 200 OK
Content-Type:text/plain
table.VideoColor[0][0].Brightness=50

3.2Authentication

The Dahua video product supplies two authentication ways: basic authentication and digest authentication. If the http request does not
have “Authorization” , the Dahua video product returns 401, utill the http request has a legal authentication .
For example:
1. When basic authentication, the Dahua video product response:
401 Unauthorized
WWW-Authenticate: Basic realm=”XXXXXX”
Then the client encode the username and password with base64, send the following request:
Authorization: Basic VXZVXZ.
2. When digest authentication, the Dahua video product response:
WWW-Authenticate: Digest realm="DH_00408CA5EA04", nonce="000562fdY631973ef04f77a3ede7c1832ff48720ef95ad",
stale=FALSE, qop="auth";
The client calculates the digest using username, password, nonce, realm and URI with MD5, then send the following request:
Authorization: Digest username="admin", realm="DH_00408CA5EA04", nc=00000001,cnonce="0a4f113b",qop="auth"
nonce="000562fdY631973ef04f77a3ede7c1832ff48720ef95ad",uri="cgi-bin/global.login?userName=admin",
response="65002de02df697e946b750590b44f8bf"

4. Camera
Camera API allows application to configure and view Dahua video product settings.

9
4.1Stream

4.1.1 GetStream

URL Syntax rtsp://<username>:<password>@<ip>:<port>/cam/realmonitor?channel=<channelNo>&subtype=<typeNo>


Comment <username>: a valid user’s username.
<password> :user’s password.
<ip> :the IP address of the Dahua video product.
<port >:the default port is 554. It can be omitted.
<channelNo> :the channel number. It starts from 1.
<typeNo> :the stream type. The <typeNo> of main stream is 0, extra stream 1 is 1, extra stream 2 is 2.The extra stream
counts can be obtained in 4.1.2 GetMaxStreamCounts. The stream must be enabled by setting head.VideoEnable to
true in 4.4.4 SetVideoEncodeConfig.
For example, we request the extra stream 1 of channel 1, the URL is:
rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=1.
The IP Camera supports both TCP and UDP transmission forms.
It also supplies basic authentication and digest authentication ways. The authentication process is similar with 3.2
Authentication.

4.1.2 GetMaxExtraStreamCounts

URL Syntax http://<ip>/cgi-bin/magicBox.cgi?action=getProductDefinition&name=MaxExtraStream


Response table.MaxExtraStream=1
Comment In above table, the range of table.MaxExtraStream is {1,2,3}

4.1.3 GetSnapshot

URL Syntax http://<ip>/cgi-bin/snapshot.cgi? [channel=<channelNo>]


Response A picture encoded by jpg
Comment The channel number is default 0 if the request is not carried the param.

4.1.4 GetVideo

URL Syntax http://<ip>/cgi-bin/mjpg/video.cgi?[channel=<channelNo>&subtype=<typeNo>]


Response video stream encoded by mjpg
Return:
HTTP Code:200 OK
Content-Type:multipart/x-mixed-replace;boundary=<boundary>
Body:

10
--<boundary>
Content-Type:image/jpeg
Content-Length:<image size>

<JPEG image data>


--<boundary>
Comment The channel number is default 0 if the request is not carried the param.
Subtype: the stream type. The <typeNo> of main stream is 0, extra stream 1 is 1, extra stream 2 is 2.

4.1.5 Playback

URL rtsp://<username>:<password>@<ip>:<port>/cam/
Syntax playback?channel=<channelNo>&starttime=<starttime>&endtime=<endtime>
Comme It’s similar with 4.1.1 GetStream. Except there is parameter starttime and endtime.
nt For example:
rtsp://admin:[email protected]:554/cam/playback?channel=1&starttime=2012_09_15_12_37_05&endtime=2012_
09_15_18_34_14

4.1.6 Download
URL http://<ip>/cgi-bin/loadfile.cgi?action=startLoad&channel=<channelNo>&subtype=<typeNo>startTime=<starttime>&
Syntax endTime=<endtime>
Respons HTTP Code: 200 OK
e Content-Type: Application/octet-stream
Content-Length:<fileLength>
Body:
<data>
<data>
Comme The channel number starts from 0.
nt Subtype default 0.
For example:
http://10.61.200.14/cgi-bin/loadfile.cgi?action=startLoad&channel=0&subtype=0&startTime=2012-10-8%2013:00:01
& endTime=2012-10-8%2014:00:01

4.1.7 PlayBack By Filename

URL Syntax rtsp://<username>:<password>@<ip>:<port>/<filename>


Response It’s similar with 4.1.1 GetStream.
For example:
rtsp://admin:[email protected]:554/2012_09_15_12_37_05:2012_09_15_18_34_14[0][0].dav

11
4.1.8 LoadFile By Filename

URL Syntax http://<ip>/cgi-bin/RPC_Loadfile/<filename>


Response HTTP Code: 200 OK
Content-Type: Application/octet-stream
Content-Length:<fileLength>
Body:
<data>
<data>
For example:
http://10.61.5.117/cgi-bin/RPC_Loadfile/2012_09_15_12_37_05:2012_09_15_18_34_14[0][0].dav

4.1.9 GetStream By Http

URL Syntax http://<ip>/cgi-bin/realmonitor.cgi?action=getStream&channel=<channelNo>&subtype=<typeNo>


Response HTTP Code: 200 OK
Content-Type: Application/octet-stream
Body:
<data>
<data>

Comment Compared to 4.1.1 GetStream using RTSP, it is another way of get stream. This is a way to use http
protocol to get realmonitor stream. The data format is shown in appendix.

4.1.10 Playback By Http

URL Syntax http://<ip>/cgi-bin/playBack.cgi?action=getStream&channel=<channelNo>&subtype=<typeNo>&startTime=<startTime>&


endTime=<endTime>
Response HTTP Code: 200 OK
Content-Type: Application/octet-stream
Body:
streamId=<streamId>\r\n
<data>
<data>

Comment Compared to 4.1.5 Playback using RTSP, it is another way of get playback stream. This is a way to use
http protocol to get playback stream. The data format is shown in appendix.

URL Syntax http://<ip>/cgi-bin/playBack.cgi?action=control&streamId=<streamId>&cmd=<cmd>&<paramName>=<paramValue>[&<


paramName>=<paramValue>...]
Response OK or ERROR
Comment Control the playback stream
12
cmd=play
speed=<speed> optional, default speed=1,if speed > 0, play back forward, else if speed < 0, playback
backward(param iframe is ignored, only support iframe playback backward);
Iframe=<iframe> optional, default iframe=0, if iframe=1, playback I frame only;
seekTime=<seekTime> seek time, optional, default playback from the stream current point;

cmd=pause
pause the playback stream;

cmd=cancel
cancel the playback stream, and destroy the streamed;
This is the cgi to control playback stream, used to control the stream which built by “action=getStream”.

4.2VideoColor

4.2.1 GetVideoColorConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=VideoColor


Response head.Brightness=50
head.Contrast=50
head.Hue=50
head.Saturation=50
head.TimeSection=1 00:00:00-24:00:00
Comment In above table, head= table.VideoColor[ChannelNo][ColorConfigNo]
ChannelNo = video channel index,
colorConfigNo = color config index.
0 = Color Config 1
1 = Color Config 2

4.2.2 SetVideoColorConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Response OK or ERROR
Comment In below table, head=VideoColor[ChannelNo][ColorConfigNo]
ChannelNo = video channel index,
colorConfigNo = color config index,
0 = Color Config 1
1 = Color Config 2

13
ParamName ParamValue type Description
head.Brightness integer Brightness, range is [0-100]
head.Contrast integer Contrast, range is [0-100]
head.Hue integer Hue
head.Saturation integer Saturation
head.TimeSection string Effective time for this video color config.
Format is: mask starttime endtime
Mask range is {0, 1}.
Mask 0 – this video config is not effective
Mask 1 - this config is effective
Starttime/Endtime format like 11:00:00.

Example:
0 01:00:00-02:00:00, means this config is not effective.
1 01:00:00-02:00:00, means this config is effective between 01:00:00 and 02:00:00

head.NightOptions.ExposureValue1 float
head.NightOptions.ExposureValue2 float
head.NightOptions.Gain integer
head.NightOptions.GainAuto bool
head.NightOptions.GainBlue integer
head.NightOptions.GainGreen integer
head.NightOptions.GainRed integer
head.NightOptions.WhiteBalance String
head.NightOptions. ReferenceLevel integer
head.NightOptions. ExternalSyncPhase integer

4.3VideoEncode

4.3.1 GetVideoConfigCaps

URL Syntax http://<ip>/cgi-bin/encode.cgi?action=getConfigCaps


Description Get video config capibilities.
Response headMain.Video.BitRateOptions=448,2560
headMain.Video.CompressionTypes=H.264,MJPG
headMain.Video.FPSMax=25
headMain.Video.ResolutionTypes=2048 x 1536,1080,SXGA, 1280 x 960,720,D1,CIF
headExtra.Video.BitRateOptions=80,448
headExtra.Video.CompressionTypes=H.264,MJPG
headExtra.Video.FPSMax=25
headExtra.Video.ResolutionTypes=D1,CIF
headSnap.Video.CompressionTypes=H.264,MJPG
headSnap.Video.ResolutionTypes=2048 x 1536,1080,SXGA, 1280 x 960,720,D1,CIF

14
Comment In above table:
Channel: video channel index
RecordType:
0 = regular record
1 = motion detection record
2 = alarm record
ExtraStream:
0 = extra stream 1
1 = extra stream 2
2 = extra stream 3
SnapType:
0 = regular snapshot
1 = motion detection snapshot
2 = alarm snapshot

Abbreviations in below table:


headMain= caps[Channel].MainFormat[RecordType]
headExtra = caps[Channel].ExtraFormat[ExtraStream]
headSnap = caps[Channel].SnapFormat[SnapType]

Field in respons Value range Description


BitRateOptions string Before comma is minimum bit rate. (kbps), after comma is maximum bit rate.(kbps)
BitRateOptions=80,448
80 is minimum bitrate, 448 is maximum.
CompressionTypes It contains all supported video compression types separated by comma.
string
Range is {MPEG4, MPEG2, MPEG1, MJPG, H.263, H.264}
FPSMax integer Maximum FPS.
ResolutionTypes It contains all supported video resolutions.
string
Range is in 4.4.2 Resolution.

4.3.2 Resolution

Fixed Resolution Name Size in PAL Size in NTSC


"D1" 704 x 576 704 x 480
"HD1" 352 x 576 352 x 480
"BCIF" 704 x 288 704 x 240
"CIF" 352 x 288 352 x 240
"QCIF" 176 x 144 176 x 120
"VGA" 640 x 480
"QVGA" 320 x 240
"SVCD" 480 x 480
"QQVGA" 160 x 128

15
"SVGA" 800 x 592
"XVGA" 1024 x 768
"WXGA" 1280 x 800
"SXGA" 1280 x 1024
"WSXGA" 1600 x 1024
"UXGA" 1600 x 1200
"WUXGA" 1920 x 1200
"ND1" 240 x 192
"720" 1280 x 720
"1080" 1920 x 1080
"1280x960" 1280 x 960 (1.3 Mega Pixels)
"1872x1408" 1872 x 1408 (2.5 Mega Pixels)
"3744x1408" 3744 x 1408 (5 Mega Pixels)
"2048x1536" 2048 x 1536 (3 Mega Pixels)
"2432x2048" 2432 x 2048 (5 Mega Pixels)
"1216x1024" 1216 x 1024 (1.2 Mega Pixels)
"1408x1024" 1408 x 1024 (1.5 Mega Pixels)
"3296x2472" 3296 x 2472 (8 Mega Pixels)
"2560x1920" 2560 x 1920 (5 Mega Pixels)
"960H", 960 x 576 960 x 480
"DV720P" 960 x 720

4.3.3 GetVideoEncodeConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=Encode


Response headMain.Video.BitRate=8192
headMain.Video.BitRateControl=CBR
headMain.Video.Compression=H.264
headMain.Video.FPS=25
headMain.Video.GOP=50
headMain.Video.Height=1200
headMain.Video.Profile=Main
headMain.Video.Quality=4
headMain.Video.Width=1600
headMain.VideoEnable=true
headExtra.Video.BitRate=8192
headExtra.Video.BitRateControl=CBR
headExtra.Video.Compression=H.264
headExtra.Video.FPS=25
headExtra.Video.GOP=50
headExtra.Video.Height=1200
headExtra.Video.Profile=Main
headExtra.Video.Quality=4

16
headExtra.Video.Width=1600
headExtra.VideoEnable=true
Comment Channel: video channel index
RecordType:
0 = regular record
1 = motion detection record
2 = alarm record
ExtraStream:
0 = extra stream 1
1 = extra stream 2
2 = extra stream 3

Abbreviations in above table:


headMain= table.Encode[Channel].MainFormat[RecordType]
headExtra =table.Encode[Channel].ExtraFormat[ExtraStream]

4.3.4 SetVideoEncodeConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment Channel: video channel index
RecordType:
0 = regular record
1 = motion detection record
2 = alarm record
ExtraStream:
0 = extra stream 1
1 = extra stream 2
2 = extra stream 3

Abbreviation in below table:


head=Encode[Channel].MainFormat[RecordType] (or)
Encode[Channel].ExtraFormat[ExtraStream]
Response OK or ERROR

ParamName ParamValue type Description


head.Video.BitRate integer Unit is Kbps
Range depends on capability in 4.4.1 GetVideoConfigCaps
head.Video.BitRateControl string Range is {CBR,VBR}
CBR: constant bitrate
VBR: variable bitrate
head.Video.Compression String Range is {MPEG4,MPEG2, MPEG1,MJPG,H.263,H.264}
Depends on capacity in 4.4.1 GetVideoConfigCaps

17
head.Video.FPS float Range is [0.2-30].
Frames per second.
< 1.0: several seconds/frame, FPS=0.3333: 3 seconds per frame.
>1.0: several frames/second. FPS=3: 3 frames per second.
head.Video.GOP integer Range is [1-100].
Group of picture, it’s the interval of I Frame,
Example: GOP=50, means there is one I frame every 49 P or B frames
head.Video.Height integer Video height
head.Video.Width integer Video Width
head.Video.Profile String Range is { Baseline, Main , Extended , High }
Only when video compression is H.264, it’s effective.
head.Video.Quality integer Range is [1-6].
Image Quality, available when Video.BitRateControl=VBR
1: worst quality
6: best quality
head.VideoEnable bool True: enable video

4.4AudioEncode

4.4.1 GetAudioConfigCaps

URL Syntax http://<ip>/cgi-bin/encode.cgi?action=getConfigCaps


Comment The angle brackets below denotes a array
Response caps[0].ExtraFormat[0].Audio.CompressionTypes=PCM,G.711A,G.711Mu
caps[0].ExtraFormat[1]….

caps[0].MainFormat[0].Audio.CompressionTypes=PCM,G.711A,G.711Mu
caps[0].MainFormat[1]…

Field in respons Value range Description


CompressionTypes It contains all supported audio compression types, separated by comma.
string
Range is {PCM, ADPCM, G.711A, G.711Mu, G.726, G.729, MPEG2, AMR}

4.4.2 GetAudioEncodeConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=Encode


Response headMain.Audio.Bitrate=64
headMain.Audio.Compression=G.711A
headMain.Audio.Depth=16
headMain.Audio.Frequency=44000
18
headMain.Audio.Mode=0
headMain.AudioEnable=false
headExtra.Audio.Bitrate=64
headExtra.Audio.Compression=G.711A
headExtra.Audio.Depth=16
headExtra.Audio.Frequency=44000
headExtra.Audio.Mode=0
headExtra.AudioEnable=false
Comment Channel: video channel index
RecordType:
0 = regular record
1 = motion detection record
2 = alarm record
ExtraStream:
0 = extra stream 1
1 = extra stream 2
2 = extra stream 3

Abbreviations in above table:


headMain=table.Encode[Channel].MainFormat[RecordType]
headExtra=table.Encode[Channel].ExtraFormat[ExtraStream]

4.4.3 SetAudioEncodeConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment Channel: video channel index
RecordType:
0 = regular record
1 = motion detection record
2 = alarm record
ExtraStream:
0 = extra stream 1
1 = extra stream 2
2 = extra stream 3

Abbreviations in below table:


head=Encode[Channel].MainFormat[RecordType] (or)
Encode[Channel].ExtraFormat[ExtraStream]
Response OK or ERROR

ParamName ParamValue type Description


head.Audio.Bitrate integer Unit is kbps

19
Range depends on capacity in 4.4.1 GetAudioConfigCaps
head.Audio.Compression string Range depends on capacity in 4.4.1 GetAudioConfigCaps

head.Audio.Depth integer Audio sampling depth


head.Audio.Frequency integer Audio sampling frequency
head.Audio.Mode integer Range is {0,1,2,3,4,5,6,7}
Audio encode mode.
0: 4.75kbps,
1: 5.15 kbps,
2: 5.9 kbps,
3: 6.7 kbps,
4: 7.4 kbps,
5: 7.95 kbps,
6: 10.2 kbps,
7: 12.2 kbps,
head.AudioEnable bool Enable/Disable audio

4.5 SnapEncode

4.5.1 GetSnapConfigCaps

URL Syntax http://<ip>/cgi-bin/encode.cgi?action=getConfigCaps


Comment Channel: video channel index
SnapType:
0 = regular snapshot
1 = motion detection snapshot
2 = alarm snapshot

Response caps[Channel].SnapFormat[SnapType].Video.CompressionTypes=H.264,MJPG
caps[Channel].SnapFormat[SnapType].Video.ResolutionTypes=3M,1080,SXGA,1_3M,720,D1,CIF

Field in respons Value range Description


CompressionTypes It contains all supported video compression types separated by comma.
string
Range is {MPEG4, MPEG2, MPEG1, MJPG, H.263, H.264}
ResolutionTypes It contains all supported video resolutions, separated by comma.
string Range is {D1, HD1, BCIF, CIF, QCIF, VGA, QVGA, SVGA, XVGA, WXGA, SXGA, WSXGA, UXGA,
WUXGA, ND1,720, 1080, 1_3M, 2_5M, 3M, 5M}.

20
4.5.2 GetSnapEncodeConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=Encode [Channel].SnapFormat


Response headSnap.Video.BitRate=384
headSnap.Video.BitRateControl=VBR
headSnap.Video.Compression=H.264
headSnap.Video.FPS=1
headSnap.Video.GOP=50
headSnap.Video.Height=576
headSnap.Video.Quality=4
headSnap.Video.Width=704
headSnap.VideoEnable=true
Comment Channel: video channel index
SnapType:
0 = regular snapshot
1 = motion detection snapshot
2 = alarm snapshot

Abbreviations in above table:


headSnap = table.Encode[Channel].SnapFormat[SnapType]

4.5.3 SetSnapEncodeConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment Channel: video channel index
SnapType:
0 = regular snapshot
1 = motion detection snapshot
2 = alarm snapshot

Abbreviation in below table:


head= Encode[Channel].SnapFormat[SnapType]
Response OK or ERROR

ParamName ParamValue type Description


head.Video.BitRate integer Unit is Kbps
Range depends on capability in 4.3.1 GetVideoConfigCaps
head.Video.BitRateControl string Range is {CBR,VBR}
CBR: constant bitrate
VBR: variable bitrate
head.Video.Compression String Range is {MPEG4,MPEG2, MPEG1,MJPG,H.263,H.264}

21
Depends on capacity in 4.3.1 GetVideoConfigCaps
head.Video.FPS float Range is [0.2-30].
Frames per second.
< 1.0: several seconds/frame, FPS=0.3333: 3 seconds per frame.
>1.0: several frames/second. FPS=3: 3 frames per second.
head.Video.GOP integer Range is [1-100].
Group of picture, it’s the interval of I Frame,
Example: GOP=50, means there is one I frame every 49 P or B frames
head.Video.Height integer Video height
head.Video.Width integer Video Width
head.Video.Quality integer Range is [1-6].
Image Quality, available when Video.BitRateControl=VBR
1: worst quality
6: best quality
head.VideoEnable bool True: enable video

4.6ChannelTitle

4.6.1 GetChannelTitleConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=ChannelTitle


Comment Get the title of the channel.
In below table, Channel = video channel index
Response table.ChannelTitle[Channel].Name=CAM1

4.6.2 SetChannelTitleConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>


Comment Set the title of the channel.
If VideoWidget[Channel].ChannelTitle.EncodeBlend is true, this title is blended to the video frames.
Please refer to 4.8.2 SetVideoWidget

In below table, Channel : video channel index


Response OK or ERROR

ParamName ParamValue type Description


ChannelTitle[Channel].Name String Channel Name

22
4.7VideoStandard

4.7.1 GetVideoStandardConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=VideoStandard


Comment
Response table.VideoStandard=PAL

4.7.2 SetVideoStandardConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>


Comment
Response OK or ERROR

ParamName ParamValue type Description


VideoStandard string Range is {PAL,NTSC}
Video Standard

4.8VideoWidget

4.8.1 GetVideoWidgetConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=VideoWidget


Description VideoWidget config contains ChannelTitle, Covers and TimeTitle parameters, defines the background color, front color and
positions of channel title and time title, and defines the regions which are not visible (cover).
Response head.BackColor[0]=0
head.BackColor[1]=0
head.BackColor[2]=0
head.BackColor[3]=128
head.EncodeBlend=true
head.FrontColor[0]=255
head.FrontColor[1]=255
head.FrontColor[2]=255
head.FrontColor[3]=0
head.Rect[0]=0
head.Rect[1]=8191
head.Rect[2]=0
head.Rect[3]=8191

23
Comment Channel: video channel index
CoReg: Cover Region
Covers is an array which sustains multi- Cover regions
0 = region 1
1 = region 2
2 = region 3
3 = region 4
head=table.VideoWidget[Channel].ChannelTitle (or)
table.VideoWidget[Channel].Covers[CoReg] (or)
table.VideoWidget[Channel].TimeTitle

4.8.2 SetVideoWidgetConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment Channel: video channel index
CoReg :Cover region index
Covers is an array which contains multiple cover regions
0 = region 1
1 = region 2
2 = region 3
3 = region 4
headChannelTitle = VideoWidget[Channel].ChannelTitle
headCover = VideoWidget[Channel].Covers[CoReg]
headTimeTitle = VideoWidget[Channel].TimeTitle

VideoWidgetConfig contains cover region settings, channel title settings and time title settings.
The italics below will be replaced by the above abbreviations.
Response OK or ERROR

ParamName ParamValue type Description


headCover.BackColor[0] integer Range is [0-255].
headCover.BackColor[1] BackColor[0]:red value
headCover.BackColor[2] BackColor[1]:green value
headCover.BackColor[3] BackColor[2]:blue value
BackColor[3]: alpha value
headCover.EncodeBlend bool false - widget blend is disabled.
headCover.FrontColor[0] integer Range is [0-255].
headCover.FrontColor[1] FrontColor[0]:red value
headCover.FrontColor[2] FrontColor[1]:green value
headCover.FrontColor[3] FrontColor[2]:blue value
FrontColor[3]: alpha value
headCover.Rect[0] integer Range is [0-8191].

24
headCover.Rect[1] Rect[0]:top left corner x coordinate (left)
headCover.Rect[2] Rect[1]:top left corner y coordinate (top)
headCover.Rect[3] Rect[2]:bottom right x coordinate (right)
Rect[3]:bottom right y coordinate (bottom)
headChannelTitle.BackColor[0] integer Range is the same with headCover
headChannelTitle.BackColor[1]
headChannelTitle.BackColor[2]
headChannelTitle.BackColor[3]
headChannelTitle.EncodeBlend bool
headChannelTitle.FrontColor[0] integer
headChannelTitle.FrontColor[1]
headChannelTitle.FrontColor[2]
headChannelTitle.FrontColor[3]
headChannelTitle.Rect[0] integer Only use the value of (left,top),the value of (right,bottom) is the same
headChannelTitle.Rect[1] as (left,top)
headChannelTitle.Rect[2] Rect[0], Rect[1] are used, and Rect[2] must be same with Rect[0],
headChannelTitle.Rect[3] Rect[3] must be same with Rect[1].
headTimeTitle.BackColor[0] integer Range is the same with headChannelTitle
headTimeTitle.BackColor[1] These are configs about time title.
headTimeTitle.BackColor[2]
headTimeTitle.BackColor[3]
headTimeTitle.EncodeBlend bool
headTimeTitle.FrontColor[0] integer
headTimeTitle.FrontColor[1]
headTimeTitle.FrontColor[2]
headTimeTitle.FrontColor[3]
headTimeTitle.Rect[0] integer
headTimeTitle.Rect[1]
headTimeTitle.Rect[2]
headTimeTitle.Rect[3]
headTimeTitle.ShowWeek bool True: Display week within the time title.

4.9VideoOut

4.9.1 GetVideoOutConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=VideoOut


Description
Response head.Margin[0]=0
head.Margin[1]=0
head.Margin[2]=0
head.Margin[3]=0

25
head.Color.Brightness=50
head.Color. Contrast =50
head.Color. Satuation =50
head.Color. Hue =50
head.Mode. Width =800
head.Mode. Height=600
head.Mode. BPP =16
head.Mode. Format =”Auto”
head.Mode. RefreshRate =60…

Comment head = table.VideoOut[channel].

4.9.2 SetVideoOutConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment
Response OK or ERROR

ParamName ParamValue type Description


head.Margin[0] integer Margin
head.Margin[1]
head.Margin[2]
head.Margin[3]
head.Color.Brightness integer Brightness
head.Color.Contrast =50 integer Contrast
head.Color.Satuation =50 integer Satuation
head.Color.Hue =50 integer Hue
head.Mode.Width =800 integer Resolution
head.Mode.Height=600
head.Mode.BPP =16 integer
head.Mode.Format =”Auto” string The range is {“Auto”, “TV”, “VGA”, “DVI”}
head.Mode.RefreshRate =60 integer Refresh rate.

26
5. NetWork

5.1NetInterfaces

5.1.1 GetInterfaces

URL Syntax http://<ip>/cgi-bin/netApp.cgi?action=getInterfaces


Comment Get all of the system network interfaces.
Description for items In below table
Name: network interface name.
“eth0” - wired network interface
“eth2” - wireless network interface
“3G” - 3G network interface

Type: “Normal” – wired network


“Wireless” – wireless network
"Auto", "TD-SCDMA", "WCDMA", "CDMA1x", "EDGE", "EVDO" – 3G network types.

Valid: network interface is valid if netInterface[n].Valid is true.


Response netInterface[0].Name=eth0
netInterface[0].Type=Normal
netInterface[0].Valid=true
netInterface[1]….

5.2BasicConfig

5.2.1 GetBasicConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=Network


Comment Basic config contains basic network parameters (Default interface, domain name, host name), and configuration of each
network interface.
interface in below table is network interface name, such as eth0, eth2…
Response table.Network.DefaultInterface=eth0
table.Network.Domain=dahua
table.Network.Hostname=badak
table.Network.interface.DefaultGateway=10.7.0.1
table.Network.interface.DhcpEnable=false
table.Network.interface.DnsServers[0]=221.123.33.228
table.Network.interface.DnsServers[1]=221.12.1.228

27
table.Network.interface.IPAddress=10.7.2.3
table.Network.interface.MTU=1500
table.Network.interface.PhysicalAddress=00:10:5c:f2:1c:b4
table.Network.interface.SubnetMask=255.255.0.0

5.2.2 SetBasicConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment interface in below table is network interface name, such as eth0, eth1…
Response OK or ERROR

ParamName ParamValue type Description


NetWork.DefaultInterface string Set default network interface when multiple interfaces exist.
Range of interfaces is depends on 5.1.1 GetInterfaces
NetWork.Domain string Domain name.
NetWork.Hostname string Hostname and Domain compose a network address.
Network.interface.DefaultGateway string IP address
Network.interface.DhcpEnable bool Enable/Disable DHCP.
Network.interface.DnsServers[0] string IP address of first DNS server.
Network.interface.DnsServers[1] string IP address of second DNS server.
Network.interface.IPAddress string Interface IP address.
Network.interface.MTU integer Interface MTU.
Network.interface.PhysicalAddress string MAC address of interface.
HEX string in the form of:
xx:xx:xx:xx:xx:xx.
Range of x is [0-9,a-f,A-F]
Example:
00:10:5c:f2:1c:b4
00:10:5C:F2:1C:B5
Network.interface.SubnetMask string Network mask string:
In the form of x.x.x.x, range of x is [0-255]
Example:
255.255.255.0

5.3PPPoE

5.3.1 GetPPPoEConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=PPPoE

28
Comment
Response table.PPPoE.Enable=false
table.PPPoE.Password=123456
table.PPPoE.UserName=123456

5.3.2 SetPPPoEConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment
Response OK or ERROR

ParamName ParamValue type Description


PPPoE.Enable bool Enable/Disable PPPoE.
PPPoE.UserName string PPPoE user name.
PPPoE.Password string PPPoE user password.

5.4DDNS

5.4.1 GetDDNSConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=DDNS


Comment Index below is the DDNS protocol table index, start from 0.
Response table.DDNS[index].Address=www.dahuatech.com
table.DDNS[index].Enable=true
table.DDNS[index].HostName=www.dahuatech.com
table.DDNS[index].KeepAlive=10
table.DDNS[index].Password=none
table.DDNS[index].Port=5050
table.DDNS[index].Protocol=DAHUA
table.DDNS[index].UserName=user1

5.4.2 SetDDNSConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment Index below is the DDNS protocol table index, start from 0.
Response OK or ERROR

29
ParamName ParamValue type Description
DDNS[index].Address string DDNS server IP address or name.
DDNS[index].Enable bool Multiple DDNS hostname can be configured, but Only one
hostname can be enabled, others should be disabled.
DDNS[index].HostName String Host name of this device.
DDNS[index].KeepAlive integer Range is [1-65535].
Unit is minutes.
DDNS[index].Password string DDNS user password
DDNS[index].Port integer Range is [1-65535].
Port of DDSN server
DDNS[index].Protocol string Range is {NO-IP DDNS, Dyndns DDNS, DAHUA}.
DDSN protocol type
DDNS[index].UserName string DDNS user name

5.5Email

5.5.1 GetEmailConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=Email


Comment
Response table.Email.Address=www.dahuatech.com
table.Email.Anonymous=true
table.Email.AttachEnable=true
table.Email.AttachmentEnable=true
table.Email.Enable=true
table.Email.HealthReport.Enable=false
table.Email.HealthReport.Interval=61
table.Email.Password=123456
table.Email.Port=26
table.Email.Receivers[0][email protected]
table.Email.Receivers[1][email protected]
table.Email.Receivers[2][email protected]
[email protected]
table.Email.SslEnable=false
table.Email.Title=DVRMessage
table.Email.UserName=anonymitty

30
5.5.2 SetEmailConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment
Response OK or ERROR

ParamName ParamValue type Description


Email.Address string SMTP server IP address or name.
Email.Anonymous bool Enable/Disable anonymous email.
Email.AttachEnable bool Enable/Disable email attachment
Email.AttachmentEnable bool Enable/Disable email attachment
Email.Enable bool Enable/Disable email function
Email.HealthReport.Enable bool Enable/Disable report device status by email.
Email.HealthReport.Interval integer Range is [30-1440].
Unit is minutes
Email.Password string User password of email account.
Email.Port integer Range is [1-65535]
Email.Receivers[0] string Email addresses of 3 receivers.
Email.Receivers[1] string
Email.Receivers[2] string
Email.SendAddress string Sender email address.
Email.SslEnable bool True: enable SSL email.
Email.Title string Title of email.
Email.UserName string User name of email account.

5.6Wlan

5.6.1 GetWlanConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=WLan


Comment
Response table.WLan.eth2.Enable=true
table.WLan.eth2.Encryption=off
table.WLan.eth2.KeyFlag=false
table.WLan.eth2.KeyID=0
table.WLan.eth2.KeyType=Hex
table.WLan.eth2.Keys[0]=password1
table.WLan.eth2.Keys[1]=password2

31
table.WLan.eth2.Keys[2]=password3
table.WLan.eth2.Keys[3]=password4
table.WLan.eth2.LinkMode=Auto
table.WLan.eth2.SSID=dahua

5.6.2 SetWlanConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment interface is name of wireless interface, to get all the network interfaces and their properties, refer to 5.1:NetInterfaces.
Response OK or ERROR

ParamName ParamValue type Description


WLan.interface.Enable bool True: Enable WLan on this interface.
WLan.interface.Encryption string Range is {Off, On, WEP64Bits, WEP128Bits,
WPA-PSK-TKIP, WPA-PSK-CCMP}
Encryption mode.
WLan.interface.KeyFlag bool true: key is configured.
WLan.interface.KeyID integer Range is [0-3]
Indicates which key is used.
0 : WLan.interface.Keys[0] is used.
WLan.interface.KeyType string Range is {Hex, ASCII]
WLan.interface.Keys[0] string For ASCII key type: 64bits encryption key length is 5,
WLan.interface.Keys[1] string 128bits encryption key length is 13, consists of [0-9,
WLan.interface.Keys[2] string a-z, A-Z]
WLan.interface.Keys[3] string
For HEX key type: 64bits encryption key length is 10,
128bits encryption key length is 26, consists of [0-9,
a-z, A-Z]
WLan.interface.LinkMode string Range is {Auto, Ad-hoc, Infrastructure}.
Auto – select suitable mode automatically.
Ad-hoc – Device with wireless network adapter can
connect to each other without Access Point.
Infrastructure – Integrate wire and wireless LAN
together to share network resource, access point is
need in this mode.
WLan.interface.SSID string

32
5.7UPnP

5.7.1 GetUPnPConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=UPnP


Comment Index in below is the UPNP map table index, start from 0.
Response table.UPnP.Enable=true
table.UPnP.MapTable[index].Enable=true
table.UPnP.MapTable[index].InnerPort=80
table.UPnP.MapTable[index].OuterPort=8080
table.UPnP.MapTable[index].Protocol=TCP
table.UPnP.MapTable[index].ServiceName=HTTP

5.7.2 SetUPnPConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment Index in below table is UPNP map table index, range is [0-255]
Response OK or ERROR

ParamName ParamValue type Description


UPnP.Enable bool Enable/Disable UPNP feature.
UPnP.MapTable[index].Enable bool Enable/Disable this UPNP map.
UPnP.MapTable[index].InnerPort integer Range is [1-65535].
Inner port number
UPnP.MapTable[index].OuterPort integer Range is [1-65535].
Outer port number.
UPnP.MapTable[index].Protocol string Range is {TCP, UDP]
UPnP.MapTable[index].ServiceName string User defined UPnP service name.

5.7.3 GetUPnPStatus

URL Syntax http://<ip>/cgi-bin/netApp.cgi?action=getUPnPStatus


Comment Get UPNP mapping result:
result=1: mapping succeed.
result=0: mapping failed.
Response rsult=1

33
5.8NTP

5.8.1 GetNTPConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=NTP


Comment
Response table.NTP.Address=clock.isc.org
table.NTP.Enable=false
table.NTP.Port=38
table.NTP.TimeZone=9
table.NTP.UpdatePeriod=31

5.8.2 SetNTPConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment
Response OK or ERROR

ParamName ParamValue type Description


NTP.Address string NTP server IP address or name.
NTP.Enable bool Enable/Disable NTP server.
NTP.Port integer Range is [1-65535].
Port of NTP server.
NTP.TimeZone integer Range is [0-32].
0: "GMT+00:00"
1: "GMT+01:00"
2: "GMT+02:00"
3: "GMT+03:00"
4: "GMT+03:30"
5: "GMT+04:00"
6: "GMT+04:30"
7: "GMT+05:00"
8: "GMT+05:30"
9: "GMT+05:45"
10: "GMT+06:00"
11: "GMT+06:30"
12: "GMT+07:00"
13: "GMT+08:00"
14: "GMT+09:00"
15: "GMT+09:30"
34
16: "GMT+10:00"
17: "GMT+11:00"
18: "GMT+12:00"
19: "GMT+13:00"
20: "GMT-01:00"
21: "GMT-02:00"
22: "GMT-03:00"
23: "GMT-03:30"
24: "GMT-04:00"
25: "GMT-05:00"
26: "GMT-06:00"
27: "GMT-07:00"
28: "GMT-08:00"
29: "GMT-09:00"
30: "GMT-10:00"
31: "GMT-11:00"
32: "GMT-12:00"
NTP.UpdatePeriod integer Range is [0-65535], unit is minutes

5.9AlarmServer

5.9.1 GetAlarmServerConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=AlarmServer


Comment
Response table.AlarmServer.Address=0.0.0.0
table.AlarmServer.Enable=true
table.AlarmServer.Port=37777

5.9.2 SetAlarmServerConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment
Response OK or ERROR

ParamName ParamValue type Description


AlarmServer.Address string Alarm server IP address or name.
AlarmServer.Enable bool Enable/Disable Alarm server.
35
AlarmServer.Port integer Range is [1-65535].
Port of Alarm server.

6. Events

6.1EventHandler

EventHandler is used in alarm and event config in following sections.


It contains settings for actions linked with alarm and events. Actions include record, snapshot, PTZ action,
log, mail, alarm out and so on.
When alarm or event happen, actions defined in alarm EventHandler and event EventHandler are executed.

6.1.1 GetEventHandler

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=<handlerName>


Comment < handlerName> can be one of below four formats
Alarm[alarm channel].EventHandler
MotionDetect[video channel]. EventHandler
BlindDetect[video channel]. EventHandler
LossDetect[video channel]. EventHandler

Example URL:
http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=Alarm[0].EventHandler
can get EventHandler settings of alarm channel 0.
Response
handlerName.EventHandler.AlarmOutChannels[0]=1
handlerName.EventHandler.AlarmOutChannels[1]=1

handlerName.EventHandler.AlarmOutEnable=false
handlerName.EventHandler.AlarmOutLatch=10
handlerName.EventHandler.BeepEnable=true
handlerName.EventHandler.Dejitter=0
handlerName.EventHandler.Delay=30
handlerName.EventHandler.LogEnable=true
handlerName.EventHandler.MailEnable=true
handlerName.EventHandler.PtzLink[0][0]=None
handlerName.EventHandler.PtzLink[0][1]=0
handlerName.EventHandler.PtzLink[1][0]=None
handlerName.EventHandler.PtzLink[1][1]=0

36

handlerName.EventHandler.PtzLinkEnable=false

handlerName.EventHandler.RecordChannels[0]=1
handlerName.EventHandler.RecordChannels[1]=1

handlerName.EventHandler.RecordEnable=true
handlerName.EventHandler.RecordLatch=10

handlerName.EventHandler.SnapshotChannels[0]=1
handlerName.EventHandler.SnapshotChannels[1]=1

handlerName.EventHandler.SnapshotEnable=false
handlerName.EventHandler.SnapshotPeriod=3
handlerName.EventHandler.SnapshotTimes=0
handlerName.EventHandler.TimeSection[0][0]=1 01:00:00-24:00:00
handlerName.EventHandler.TimeSection[0][1]=1 01:00:00-24:00:00


handlerName.EventHandler.TimeSection[6][5]=1 01:00:00-24:00:00
handlerName.EventHandler.TipEnable=true

handlerName.EventHandler. ExAlarmOutEnable=true
handlerName. ExAlarmOutChannels[0] =2
handlerName.ExAlarmOutChannels[1]=3

6.1.2 SetEventHandler

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment Meaning of handlerName is the same with 6.1.1 GetEventHandler
Response OK or ERROR

paramName paramValue Description


type
handlerName.EventHandler.AlarmOutChannels[ch] integer Range is {0, 1}, ch is alarm out channel index.
0 – do not output alarm at alarm out channel ch
1 – output alarm at alarm out channel ch
handlerName.EventHandler.AlarmOutEnable bool Enable/Disable alarm out function.
handlerName.EventHandler.AlarmOutLatch Integer Range is [10-300].
Unit is seconds, indicates the time to output alarm after input alarm is
cleared.

37
handlerName.EventHandler.BeepEnable bool Enable/Disable beep.
handlerName.EventHandler.Dejitter integer Range is [0-255].
Alarm signal dejitter seconds. Alarm signal change during this period is
ignored.
handlerName.EventHandler.Delay integer Range is [0-300].
Delay seconds before setting take effect.
handlerName.EventHandler.LogEnable bool Enable/Disable log for alarm.
handlerName.EventHandler.MailEnable bool Enable/Disable mail send for alarm.
handlerName.EventHandler.PtzLink[ch][0] string Range is {None, Preset, Tour, Pattern}
This is PTZ action linked with events. ch is PTZ channel index.
handlerName.EventHandler.PtzLink[ch][1] integer This is the parameter of PtzLink[ch][0],
If PtzLink[ch]][0] is
Preset: this is preset point.
Tour: this is tour path number.
Pattern: this is pattern number.
handlerName.EventHandler.PtzLinkEnable Bool Enable/Disable PTZ link.
handlerName.EventHandler.RecordChannels[ch] Integer Range is {0, 1}
0 – do not record on video channel ch
1 – record. on video channel ch
handlerName.EventHandler.RecordEnable bool Enable/Disable record function.
handlerName.EventHandler.RecordLatch integer Range is [10-300].
Unit is seconds, indicates the time to record after input alarm is cleared..
handlerName.EventHandler.SnapshotChannels[ch] integer Range is {0, 1}
0 – do not snapshot on video channel ch
1 – snapshot on video channel ch
handlerName.EventHandler.SnapshotEnable bool Enable/Disable snapshot function.
handlerName.EventHandler.SnapshotPeriod integer Range is [0-255].
Frames between snapshot.
0 means continuously snapshot for every frame.
handlerName.EventHandler.SnapshotTimes integer Range is [0-65535]
Snapshot times before stop, 0 means don’t stop snapshot.
handlerName.EventHandler.TimeSection[wd][ts] String It’s table contains effective time period for eventHanlder everyday.
wd (week day) range is [0-6] (Sunday-Staurday)
ts (time section) range is [0-23], it’s index of timesection table.

Format: mask hh:mm:ss-hh:mm:ss


Mask: {0,1}, hh: [0-24], mm: [00-59], ss: [00-59]
Mask 0: this time section is not used.
Mask 1: this time section is used.

Example:
TimeSection[1][0]=1 12:00:00-18:00:00
Means EventHandler is effective between 12:00:00 and 18:00:00 at
Monday.
handlerName.EventHandler.TipEnable bool Enable/Disable local message box tip.
38
handlerName.EventHandler. ExAlarmOutEnable bool
handlerName. ExAlarmOutChannels[channels] integer

6.2Alarm

6.2.1 GetAlarmConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=Alarm


Comment
Response table.Alarm[0].Enable=false
table.Alarm[0].EventHandler….(output of EventHandler is described in 6.1.1 GetEventHandler)
table.Alarm[0].Name=Door1
table.Alarm[0].SensorType=NC
table.Alarm[1]….

6.2.2 SetAlarmConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment In below table, input is external alarm input channel, ch is channel number, wd is weekday index, ts is timesection index.
EventHandler defines parameter of relevant actions when alarm or event happens. It’s also used in following sections about
events.
Response OK or ERROR

ParamName ParamValue type Description


Alarm[input].Enable bool Enable/Disable alarm from a input channel
Alarm[input].EventHandler Setting of EventHandler is described in 6.1.2 SetEventHandler
Alarm[input].Name string Name of alarm input channel.
Alarm[input].SensorType string Range is {NC, NO].
NC: normal close
NO: normal open

6.2.3 GetAlarmOutConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=AlarmOut


Comment alarmOutChannel below is the alarm out channel index.
Response table.AlarmOut[alarmOutChannel].Mode=0
table.AlarmOut[alarmOutChannel].Name=Beep

39
6.2.4 SetAlarmOutConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment Port in below table is alarm out port index, start form 0.
Response OK or ERROR

ParamName ParamValue type Description


AlarmOut[port].Mode integer Range is {0, 1, 2}
0: automatically alarm
1: force alarm
2: close alarm
AlarmOut[port].Name string Alarm out port name.

6.2.5 GetInSlots

URL Syntax http://<ip>/cgi-bin/alarm.cgi?action=getInSlots


Comment Get alarm input channel number.
Below response means there are 2 alarm input channels.
Response result=2

6.2.6 GetOutSlots

URL Syntax http://<ip>/cgi-bin/alarm.cgi?action=getOutSlots


Comment Get alarm output channel number.
Response result=1

6.2.7 GetInState

URL Syntax http://<ip>/cgi-bin/alarm.cgi?action=getInStates


Comment Get alarm input state for all channels.
A bit in the response result indicates a channel alarm states, below result 3 means alarm channel 1 and channel 2 have
alarm now.
Response result=3

40
6.2.8 GetOutState

URL Syntax http://<ip>/cgi-bin/alarm.cgi?action=getOutStates


Comment Get alarm output state for all channels.
A bit in the response result indicates a channel. 1 means alarm is present.
Response result=0

6.2.9 GetChannelInState

URL Syntax http://<ip>/cgi-bin/alarm.cgi?action=getInStates&channel=<channelNo>


Comment Get alarm input state for channelNo. channelNo starts from 0, and must be less than alarm input channels obtained from
6.2.5 GetInSlots.
Result 1 means alarm is present. Result 0 means alarm is not present.
Response result=1

6.2.10 GetChannelOutState

URL Syntax http://<ip>/cgi-bin/alarm.cgi?action=getOutStates&channel=<channelNo>


Comment Get alarm output state for channelNo. channelNo starts from 0, and must be less than alarm output channels obtained
from 6.2.6 GetOutSlots .
Result 1 means alarm is present. Result 0 means alarm is not present.
Response result=0

6.3MotionDetect

6.3.1 GetMotionDetectConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=MotionDetect


Comment MotionDetect config of a video channel contains Enable, Level, Region and EventHandler.
Response table.MotionDetect[0].Enable=false
table.MotionDetect[0].EventHandler… (output of EventHandler is described in 6.1.1 GetEventHandler)
table.MotionDetect[0].Level=3
table.MotionDetect[0].Region[0]=4194303
table.MotionDetect[0].Region[1]=4194303


table.MotionDetect[1]…

41
6.3.2 SetMotionDetectConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment Channel: video channel index
LineNum
Index of region, region is divided into lines and each line has several blocks, a line is described by a 32 bit integer, a bit for
a block..
0=Line 1
1=Line 2


Head = MotionDetect[Channel]
The italics below will be replaced by the above abbreviations.
Response OK or ERROR

ParamName ParamValue type Description


head.Enable bool Enable/Disable motion detect feature in a channel.

head.EventHandler Setting of EventHandler is described in 6.1.2 SetEventHandler


head.Level integer Range is [1-6].
Sensitivity of motion detection.
1: lowest sensitivity.
6: highest sensitivity.
head.Region[LineNum] integer Currently, region is divided into 18 lines and 22 blocks/line.
A bit describes a block in the line.
Bit = 1: motion in this block is monitored..
Example:
MotionDetect[0].Region[0] = 4194303 (0x3FFFFF):: motion in channel 0 line 0’s
22 blocks is monitored.
MotionDetect[0].Region[1] =0: motion in line 1’s 22 blocks is not monitored.
MotionDetect[0].Region[17] = 3: in the last line of channel 0, motion in the left
two blocks is monitored.

6.4BlindDetect

6.4.1 GetBlindDetectConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=BlindDetect


Comment Channel: video channel number
head= table.BlindDetect[Channel]
Response head.Enable=false
head.EventHandler= (output of EventHandler is described in 6.1.1 GetEventHandler)

42
head.Level=3

6.4.2 SetBlindDetectConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment Channel: video channel number
head=BlindDetect[Channel]
Response OK or ERROR

ParamName ParamValue type Description


head.Enable bool Enable/Disable blind detect feature.

head.EventHandler Setting of EventHandler is described in 6.1.2 SetEventHandler


head.Level integer Range is [1-6].
Sensitivity of blind detection.
1: lowest sensitivity.
6: highest sensitivity.

6.5LossDetect

6.5.1 GetLossDetectConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=LossDetect


Comment Channel: video channel number
head=table.LossDetect [Channel]
Response head.Enable=false
head.EventHandler= (output of EventHandler is described in 6.1.1 GetEventHandler)

6.5.2 SetLossDetectConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment Channel: video channel number
Head = LossDetect [Channel]
Response OK or ERROR

ParamName ParamValue type Description


head.Enable bool Enable/Disable loss detect feature.

head.EventHandler Setting of EventHandler is described in 6.1.2 SetEventHandler

43
6.6 StorageAbnormal

6.6.1 GetStorageNotExistConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=StorageNotExist


Comment
Response StorageNotExist.Enable=false
StorageNotExist.EventHandler= (output of EventHandler is described in 6.1.1 GetEventHandler)

6.6.2 SetStorageNotExistConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment
Response OK or ERROR

ParamName ParamValue type Description


StorageNotExist.Enable bool Enable/Disable loss detect feature.

StorageNotExist.EventHandler Setting of EventHandler is described in 6.1.2 SetEventHandler

6.6.3 Get StorageFailureConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name= StorageFailure


Comment
Response StorageFailure.Enable=false
StorageFailure.EventHandler= (output of EventHandler is described in 6.1.1 GetEventHandler)

6.6.4 Set StorageFailureConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment
Response OK or ERROR

ParamName ParamValue type Description


StorageFailure.Enable bool Enable/Disable loss detect feature.

StorageFailure.EventHandler Setting of EventHandler is described in 6.1.2 SetEventHandler

44
6.6.5 GetStorageLowSpaceConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name= StorageLowSpace


Comment
Response StorageLowSpace.Enable=false
StorageLowSpace.EventHandler= (output of EventHandler is described in 6.1.1 GetEventHandler)

6.6.6 SetStorageLowSpaceConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment
Response OK or ERROR

ParamName ParamValue type Description


StorageLowSpace.Enable bool Enable/Disable loss detect feature.

StorageLowSpace.EventHandler Setting of EventHandler is described in 6.1.2 SetEventHandler

6.7 NetAbnormal

6.7.1 GetNetAbortConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name= NetAbort


Comment
Response NetAbort.Enable=false
NetAbort.EventHandler= (output of EventHandler is described in 6.1.1 GetEventHandler)

6.7.2 SetNetAbortConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment
Response OK or ERROR

ParamName ParamValue type Description


NetAbort.Enable bool Enable/Disable loss detect feature.

NetAbort.EventHandler Setting of EventHandler is described in 6.1.2 SetEventHandler

45
6.7.3 GetIPConflictConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name= IPConflict


Comment
Response IPConflict.Enable=false
IPConflict.EventHandler= (output of EventHandler is described in 6.1.1 GetEventHandler)

6.7.4 SetIPConflictConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment
Response OK or ERROR

ParamName ParamValue type Description


IPConflict.Enable bool Enable/Disable loss detect feature.

IPConflict.EventHandler Setting of EventHandler is described in 6.1.2 SetEventHandler

6.8 GetEventIndexes

URL Syntax http://<ip>/cgi-bin/eventManager.cgi?action=getEventIndexes&code=<eventCode>


Comment Get channels indexes that event of code eventCode happens.
eventCode includes:
VideoMotion: motion detection event
VideoLoss: video loss detection event
VideoBlind: video blind detection event.
Response channels[0]=0
channels[1]=2
channels[2]=3

(This response means event happened on channel 0, channel 2, and channel 3.)

6.9 Attach

URL Syntax http://<ip>/cgi-bin/eventManager.cgi?action=attach&codes=[<eventCode>,<eventCode> ,…]


Comment Get channels indexes that event of code eventCode happens.
eventCode includes:
VideoMotion: motion detection event
46
VideoLoss: video loss detection event
VideoBlind: video blind detection event.
MDResult: motion detection data reporting event. The motion detect window contains 18 rows and 22 columns. The
event info contains motion detect data with mask of every row.
Response HTTP Code: 200 OK\r\n
Cache-Control: no-cache\r\n
Pragma: no-cache\r\n
Expires: Thu, 01 Dec 2099 16:00:00 GMT\r\n
Connection: close\r\n
Content-Type: multipart/x-mixed-replace; boundary=<bondary>\r\n
Body:
--<bondary>\r\n
Content-Type: text/plain\r\n
Content-Length: <data length>\r\n
<eventInfo>\r\n\r\n
--<bondary>\r\n
Content-Type: text/plain\r\n
Content-Length: <data length>\r\n
<eventInfo>\r\n\r\n

For example:
HTTP Code: 200 OK\r\n
Cache-Control: no-cache\r\n
Pragma: no-cache\r\n
Expires: Thu, 01 Dec 2099 16:00:00 GMT\r\n
Connection: close\r\n
Content-Type: multipart/x-mixed-replace; boundary=myboundary\r\n\r\n
Body:
-- myboundary \r\n
Content-Type: text/plain\r\n
Content-Length: 39\r\n
Code=VideoMotion;action=Start;index=0\r\n\r\n
-- myboundary \r\n
Content-Type: text/plain\r\n
Content-Length: 38\r\n
Code=VideoBlind;action=Start;index=0\r\n\r\n
-- myboundary \r\n
Content-Type: text/plain\r\n
Content-Length: 38\r\n
Code= MDResult;action=Pulse;index=0;data=61708863,61708863…\r\n\r\n
-- myboundary \r\n

47
7.PTZ

7.1PTZConfig

7.1.1 GetPTZConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=Ptz


Comment Port in below table is PTZ port index, start form 0.
Response table.Ptz[port].Address=8
table.Ptz[port].Attribute[0]=115200
table.Ptz[port].Attribute[1]=8
table.Ptz[port].Attribute[2]=Even
table.Ptz[port].Attribute[3]=1
table.Ptz[port].Homing[0]=0
table.Ptz[port].Homing[1]=30
table.Ptz[port].NumberInMatrixs=0
table.Ptz[port].ProtocolName=NONE

7.1.2 SetPTZConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment Port in below table is PTZ port index, start form 0.
Response OK or ERROR

ParamName ParamValue type Description


Ptz[port].Address integer Range is [0-255].
Device address, if there are more than one device connected to
this port, distinguish them by this address.
Ptz[port].Attribute[0] integer Range is {1200, 2400 ,4800, 9600, 19200, 38400, 57600,
115200}.
Baudrate
Ptz[port].Attribute[1] integer Range is {4, 5, 6, 7, 8}.
Data bit.
Ptz[port].Attribute[2] string Range is {Even, Mark, None, Odd, Space}.
Parity verification mode.
Ptz[port].Attribute[3] float Range is {1, 1.5, 2}.
Stop bit.
Ptz[port].Homing[0] integer Range is {-1,0-255}

48
-1: homing is disabled.
[0-255]: preset point number
Ptz[port].Homing[1] integer Range is [0-65535].
No operation timeout, unit is seconds.
After no operation timeout, PTZ go to preset point set in
Ptz[port].Homing[0].
Ptz[port].ProtocolName string PTZ protocol name, depends on PTZ capability,
refer to 7.2.1 GetProtocolList to get the protocol list.

7.2PTZControl

7.2.1 GetProtocolList

URL Syntax http://<ip>/cgi-bin/ptz.cgi?action=getProtocolList


Comment Get PTZ protocol list.
Response contains all support PTZ protocols separated by comma.
Response result=NONE,AD1641M,ADMATRIX,BANKNOTE,DH-CC440,DH-MATRIX,DH-SD1,DH-SD2,HAIYU,HY,LILIN,PANASONIC

7.2.2 GetCurrentProtocolCaps

URL Syntax http://<ip>/cgi-bin/ptz.cgi?action=getCurrentProtocolCaps&channel=<channelNo>


Comment Get PTZ protocol list, channelNo is PTZ channel index.
Response caps.AlarmLen=0
caps.AuxMax=8
caps.AuxMin=1
caps.CamAddrMax=255
caps.CamAddrMin=1
caps.Interval=200
caps.Menu=false
caps.MonAddrMax=255
caps.MonAddrMin=0
caps.Name=DH-SD1
caps.PanSpeedMax=255
caps.PanSpeedMin=1
caps.PatternMax=5
caps.PatternMin=1
caps.PresetMax=80
caps.PresetMin=1
caps.TileSpeedMax=255

49
caps.TileSpeedMin=1
caps.TourMax=7
caps.TourMin=0
caps.Type=1

Field in response Description


AlarmLen Alarm length in protocol
AuxMax Maximum/Minimum number for auxiliary functions
AuxMin
CamAddrMax Maximum/Minimum channel address
CamAddrMin
Menu True or false, support internal menu of the PTZ or not,
MonAddrMax Maximum/Minimum monitor address
MonAddrMin
Name Name of the operation protocol
PanSpeedMax Maximum/Minimum pan speed.
PanSpeedMin
PatternMax Maximum/Minimum pattern path number.
PatternMin
PresetMax Maximum/Minimum preset point number.
PresetMin
TileSpeedMax Maximum/Minimum tile speed.
TileSpeedMin
TourMax Maximum/Minimum tour path number.
TourMin
Type Type of PTZ protocol.

7.2.3 PTZ control commands

URL Syntax http://<ip>/cgi-bin/ptz.cgi?action=[action]&channel=[ch]&code=[code]&arg1=[argstr]& arg2=[argstr]&arg3=[argstr]


Comment This URL is used to start/stop PTZ control command.
action is PTZ control command, it can be start or stop.
ch is PTZ channel range is [0 - n-1], code is PTZ operation, and arg1, arg2, arg3 is the arguments of operation.
Code and argstr values are listed in below table.
Response OK or ERROR

Code Code description arg1 arg2 arg3 arg4


Up Tile up 0 Vertical speed, 0 0
range is [1-8]
Down Tile down 0 Vertical speed, 0 0
range is [1-8]
Left Pan left 0 Vertical speed, 0 0
50
range is [1-8]
Right Pan right 0 Vertical speed, 0 0
range is [1-8]
ZoomWide Zoom out 0 multiple 0 0
ZoomTele Zoom in 0 multiple 0 0
FocusNear Focus near 0 multiple 0 0
FocusFar Focus far 0 multiple 0 0
IrisLarge Aperture larger 0 multiple 0 0
IrisSmall Aperture smaller 0 multiple 0 0
GotoPreset Go to PTZ preset point 0 Preset point 0 0
number
SetPreset Set PTZ preset point 0 Preset point 0 0
number
ClearPreset Clear PTZ preset point 0 Preset point 0 0
number
LampWaterClear 1: open 0 0 0
2: close
StartTour Start PTZ tour Tour path 0 1: start 0
number 2: automatically
3: stop
LeftUp Pan left and tile up Vertical speed, Horizontal speed, 0 0
range is [1-8] range is [1-8]
RightUp Pan right and tile up Vertical speed, Horizontal speed, 0 0
range is [1-8] range is [1-8]
LeftDown Pan left and tile down Vertical speed, Horizontal speed, 0 0
range is [1-8] range is [1-8]
RightDown Pan right and tile down Vertical speed, Horizontal speed, 0 0
range is [1-8] range is [1-8]
AddTour Add preset point to tour path Tour path Preset point 0 0
number number
DelTour Delete preset point from tour Tour path Preset point 0 0
path number number
ClearTour Clear tour path Tour path 0 0 0
number
AutoPanOn Start pan rotate 0 0 0 0
AutoPanOff Stop pan rotate 0 0 0 0
SetLeftLimit Set left limit. 0 0 0 0
SetRightLimit Set right limit. 0 0 0 0
AutoScanOn Start auto scan. 0 0 0 0
AutoScanOff Stop auto scan. 0 0 0 0
SetPatternBegin Begin pattern path set. Pattern number 0 0 0
SetPatternEnd End pattern path set. Pattern number 0 0 0
StartPattern Run pattern path Pattern number 0 0 0
StopPattern Stop pattern path Pattern number 0 0 0

51
ClearPattern Clear pattern path Pattern number 0 0 0
AlarmSearch Search alarm. 0 0 0 0
Position Go to position Horizontal Vertical position Zoom change 0
position
AuxOn Auxiliary function on, auxiliary 0 0 0 0
function is defined in product
definition document.
AuxOff Auxiliary function off 0 0 0 0
Menu 0 0 0 0
Exit 0 0 0 0
Enter 0 0 0 0
Esc 0 0 0 0
MenuUp 0 0 0 0
MenuDown 0 0 0 0
MenuLeft 0 0 0 0
MenuRight 0 0 0 0
Reset Restore default configuration. 0 0 0 0
SetPresetName Preset point Preset point title. 0 0
number (1 byte)
AlarmPtz Alarm linked PTZ. External alarm Link type: Argument of link 0
input channel. 1: go to preset type:
point Link type = 1,
2: auto scan this is preset point
3: tour number
Link type = 2,
this is auto scan
path
Link type = 3,
this is tour path
LightController Control the light on/off. Address of light Light number switch 0
controller
PositionABS Go to ABS position Horizontal angle: Vertical Zoom in mutiple Speed[1-8], not
0°-360° angle :0°-90° must
PositionReset Use current direction as 0 0 0 0
reference.
UpTele up + TELE Speed [1-8] 0 0 0
DownTele down + TELE Speed [1-8] 0 0 0
LeftTele left + TELE Speed [1-8] 0 0 0
RightTele right + TELE Speed [1-8] 0 0 0
LeftUpTele leftup + TELE Speed [1-8] 0 0 0
LeftDownTele leftdown + TELE Speed [1-8] 0 0 0
RigjtUpTele rightup + TELE Speed [1-8] 0 0 0
RightDownTele rightdown + TELE Speed [1-8] 0 0 0
UpWide up + WIDE Speed [1-8] 0 0 0

52
DownWide down + WIDE Speed [1-8] 0 0 0
LeftWide left + WIDE Speed [1-8] 0 0 0
RightWide right + WIDE Speed [1-8] 0 0 0
LeftUpWide leftup + WIDE Speed [1-8] 0 0 0
LeftDownWide leftdown + WIDE Speed [1-8] 0 0 0
RightUpWide rightup + WIDE Speed [1-8] 0 0 0
RightDownWide rightdown + WIDE Speed [1-8] 0 0 0
Continuously Horizontal Speed Vertical Speed Zoom Speed [-8-8] Timeout
Move Continuously
[-8-8] [-8-8]
Relatively Relatively angle: Relatively Relatively Zoom
Move Relatively
0°-360° angle :0°-90°

7.3PTZStatus

7.3.1 PTZ GetStatus

URL Syntax http://<ip>/cgi-bin/ptz.cgi?action=getStatus


Comment This URL is used to get PTZStatus.
Response status.UTC=6538920
status.MoveStatus=Idle
status.ZoomStatus=Idle
status.PresetID=10
status.Position=120,12,2

7. Record&Snap

8.1Record

8.1.1 GetRecordConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=Record


Comment Channel in below table is video channel number, weekday range is [0-6] (Sunday - Saturday).
Record config contains pre record time and record time sections of every day.
Response table.Record[channel].PreRecord=6
table.Record[channel].TimeSection[weekday][0]=1 00:00:00-24:00:00
table.Record[channel].TimeSection[weekday][1]=0 02:00:00-24:00:00
table.Record[channel].TimeSection[weekday][2]=0 03:00:00-24:00:00
table.Record[channel].TimeSection[weekday][3]=0 04:00:00-24:00:00

53
table.Record[channel].TimeSection[weekday][4]=0 05:00:00-24:00:00
table.Record[channel].TimeSection[weekday][5]=0 06:00:00-24:00:00

8.1.2 SetRecordConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment In below table: ch = channel index, wd = week day index, ts = time section index
Response OK or ERROR

ParamName ParamValue type Description


Record[ch].PreRecord integer Range is [0-300].
Prerecord seconds, 0 means no prerecord.
ch (Channel number) starts form 0
Record[ch].TimeSection[wd][ts] string wd (week day) range is [0-6] (Sunday - Staurday)
ts (time section) range is [0-23], timesection table index.

Format: mask hh:mm:ss-hh:mm:ss


Mask: [0-65535], hh: [0-24], mm: [0-59], ss: [0-59]
Mask indicates record type by bits:
Bit0: regular record
Bit1: motion detection record
Bit2: alarm record
Bit3: card record
Example:
Set record time to every Sunday all day. Record type is motion detection and alarm.
URL should be:
http://<ip>/cgi-bin/configManager.cgi?action=setConfig&name=Record[0].TimeSection[0][0]&table=6 00:00:00-24:00:00
In this example, “6 00:00:00-24:00:00” means motion detection and alarm record all day (6 = 4 & 2, alarm is 4, motion detection is 2.).

8.1.3 GetRecordModeConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=RecordMode


Comment Get record mode for video channels. channel in below table is video channel number.
Response table.RecordMode[channel].Mode=0

54
8.1.4 SetRecordModeConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment channel in below table is video channel index, start form 0.
Response OK or ERROR

ParamName ParamValue type Description


RecordMode[channel].Mode integer Range is {0, 1, 2}.
0: automatically record
1: manually record
2: stop record.

8.2Snap

8.2.1 GetSnapConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=Snap


Comment Channel in below table is video channel number, weekday range is [0-6] (Sunday - Saturday).
Response table.Snap[channel].TimeSection[weekday][0]=1 00:00:00-24:00:00
table.Snap[channel].TimeSection[weekday][1]=0 02:00:00-24:00:00
table.Snap[channel].TimeSection[weekday][2]=0 03:00:00-24:00:00
table.Snap[channel].TimeSection[weekday][3]=0 04:00:00-24:00:00
table.Snap[channel].TimeSection[weekday][4]=0 05:00:00-24:00:00
table.Snap[channel].TimeSection[weekday][5]=0 06:00:00-24:00:00

8.2.2 SetSnapConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment In below table: ch = channel index, wd = week day index, ts = time section index
Response OK or ERROR

ParamName ParamValue type Description


Record[ch].TimeSection[wd][ts] string wd (week day) range is [0-6] (Sunday- Staurday)
ts (time section) range is [0-23], it’s timesection table index.

Format: mask hh:mm:ss-hh:mm:ss


Mask: [0-65535], hh: [0-24], mm: [0-59], ss: [0-59]

55
Mask indicates record type by bits:
Bit0: regular snapshot
Bit1: motion detection snapshot
Bit2: alarm snapshot
Bit3: card snapshot
:

8. System

9.1General

9.1.1 GetGeneralConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=General


Comment
Response table.General.MachineName=Dahua001
table.General. LocalNo=8
table.General. MachineAddress=”binjiangqv jiangnandadao weiyelu”
table.General. MachineGroup=”jiaojing yidui

9.1.2 SetGeneralConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment
Response OK or ERROR

ParamName ParamValue type Description


General.MachineName string Device name or serial number.
General. LocalNo integer
General. MachineAddress string
General. MachineGroup string

56
9.2SystemTime

9.2.1 GetCurrentTime

URL Syntax http://<ip>/cgi-bin/global.cgi?action=getCurrentTime


Comment The time format is "Y-M-D H-m-S". It’s not be effected by Locales.TimeFormat in 9.3.2 SetLocalesConfig.
Response result = 2011-7-3 21:02:32

9.2.2 SetCurrentTime

URL Syntax http://<ip>/cgi-bin/global.cgi?action=setCurrentTime&time=2011-7-3%2021:02:32


Comment The time format is "Y-M-D H-m-S". It’s not be effected by Locales.TimeFormat in 9.3.2 SetLocalesConfig.
Response OK or ERROR

9.3Locales

9.3.1 GetLocalesConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=Locales


Comment
Response table.Locales.DSTEnable=false
table.Locales.DSTEnd.Day=1
table.Locales.DSTEnd.Hour=0
table.Locales.DSTEnd.Minute=0
table.Locales.DSTEnd.Month=1
table.Locales.DSTEnd.Week=2
table.Locales.DSTEnd.Year=2011
table.Locales.DSTStart.Day=0
table.Locales.DSTStart.Hour=0
table.Locales.DSTStart.Minute=0
table.Locales.DSTStart.Month=1
table.Locales.DSTStart.Week=1
table.Locales.DSTStart.Year=2011
table.Locales.TimeFormat=yyyy-MM-dd HH:mm:ss

57
9.3.2 SetLocalesConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment
Response OK or ERROR

ParamName ParamValue Description


type
Locales.DSTEnable bool Enable/Disable DST (daylight saving time)
Locales.DSTEnd.Day integer Range is [0-6] or [1-31]
[0-6]: week day, 0 = Sunday, 6 = Saturday
[1-31]: month day
If Locales.DSTEnd.Week is 0, use month day, otherwise, use week day.
Locales.DSTEnd.Hour integer Range is [0-23]
Locales.DSTEnd.Minute integer Range is [0-59]
Locales.DSTEnd.Month integer Range is [1-12]
Locales.DSTEnd.Week Integer Range is {1,2,3,4,-1,0}.
0 = Use month day
[1,2,3,4,-1]: use week day.
1 = first week, 2 = second, 3 = third, 4 = fourth, -1 = last.
Locales.DSTEnd.Year Integer Range is [2000-2038]
Locales.DSTStart.Day Range is the same with items in Locales.DSTEnd
Locales.DSTStart.Hour Locales.DSTStart table and Locales.DSTEnd table together defines the
Locales.DSTStart.Minute time range of DST.
Locales.DSTStart.Month
Locales.DSTStart.Week
Locales.DSTStart.Year
Locales.TimeFormat string Defines time format displayed in video time title.
String form is: year-month-day hour:mm:ss.
Position of year, month and day can be exchanged.

Range of year is {yy, yyyy}


yy = year without century, yyyy = year with century.
Range of month is {M, MM, MMMM}
M = 1 for January, MM = 01 for January, MMMM = Jan for January
Range of day is {d, dd}
d = 1 for first day, dd = 01 for first day
Range of hour is {H, HH, h, hh}
H = 1 for 1:00, HH = 01 for 1:00, range is 0-23
h = 1 for 1:00, hh = 01 for 1:00, time range is 1-12

Example:
yyyy-MM-dd HH:mm:ss or

58
MM-dd-yyyy HH:mm:ss or
dd-M-yy hh:mm:ss

9.4Language

9.4.1 GetLanguageCaps

URL Syntax http://<ip>/cgi-bin/magicBox.cgi?action=getLanguageCaps


Comment Get the list of supported languages, response is a string contains languages with comma separated.
Languages include
{English, SimpChinese, TradChinese, Italian, Spanish, Japanese, Russian, French, German]
Response Languages=SimpChinese,English,French

9.4.2 GetLanguageConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=Language


Comment Get current system language cofnig.
Response table.Language=SimpChinese

9.4.3 SetLanguageConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment NOTE: After changing language setting, system will automatically reboot!
Response OK or ERROR

ParamName ParamValue type Description


Language string The language range is get from interface in 9.3.1 GetLanguageCaps

59
9.5AccessFilter

9.5.1 GetAccessFilterConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=AccessFilter


Comment bannedIndex below is the banned IP list index,
trustIndex below is the trust IP list index.
Response table.AccessFilter.BannedList[bannedIndex]=10.6.10.1
table.AccessFilter. TrustList[trustIndex]=1.2.3.4
table.AccessFilter.Enable=false
table.AccessFilter.Type=BannedList

9.5.2 SetAccessFilterConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment Range of index in below table is [0-255]
Response OK or ERROR

ParamName ParamValue type Description


AccessFilter.BannedList[index] string Banned IP address list
AccessFilter.TrustList[index] string Trusted IP address list
AccessFilter.Enable bool Enable/Disable access filter function
AccessFilter.Type string Range is {TrustList, BannedList},
TrustList: Turst list is used, banned list is not used.
BannedList: Banned list is used, turst list is not used.

9.6AutoMaintain

9.6.1 GetAutoMaintainConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=AutoMaintain


Comment
Response table.AutoMaintain. AutoRebootDay=3
table.AutoMaintain. AutoRebootHour=0
table.AutoMaintain. AutoRebootMinute=0
table.AutoMaintain. AutoShutdownDay=1

60
table.AutoMaintain. AutoShutdownHour=0
table.AutoMaintain. AutoShutdownMinute=0
table.AutoMaintain. AutoStartUpDay=1
table.AutoMaintain. AutoStartUpHour=2
table.AutoMaintain. AutoStartUpMinute=0

9.6.2 SetAutoMaintainConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment
Response OK or ERROR

ParamName ParamValue Description


type
AutoMaintain. AutoRebootDay integer Range is [-1-7].
Auto restart day.
-1 = never auto restart
0- 6 = Sunday-Saturday
7 = restart every day
AutoMaintain. AutoRebootHour integer Range is [0-23].
Auto restart hour
AutoMaintain. AutoRebootMinute integer Range is [0-59].
Auto restart minute
AutoMaintain. AutoShutdownDay integer Auto reboot time.
AutoMaintain. AutoShutdownHour Range is same with AutoOpenDay, AutoOpenHour, AutoOpenMinute.
AutoMaintain. AutoShutdownMinute
AutoMaintain. AutoStartUpDay integer Auto shutdown time.
AutoMaintain. AutoStartUpHour Range is same with AutoOpenDay, AutoOpenHour, AutoOpenMinute.
AutoMaintain. AutoStartUpMinute

9.7UserManager

9.7.1 Group

There are two user groups: “admin” and “user”. The “admin” group has all the authorities of operating the IP Camera. The “user” group
only has monitor and replay authorities.
61
9.7.2 GetGroupInfo

URL Syntax http://<ip>/cgi-bin/userManager.cgi?action=getGroupInfo&name=<groupName>


Comment Get group setting with name groupName.
The range of groupName is: “admin” and “user”.
Response group.Name=admin
group.Memo=administrator group
goup. AuthorityList=<authList>

9.7.3 GetGroupInfoAll

URL Syntax http://<ip>/cgi-bin/userManager.cgi?action=getGroupInfoAll


Comment Get information of all groups.
Response group[0].Name=admin
group[0].Memo=administrator group
group[0]. AuthorityList=<authList>
group[1].Name=user
group[1].Memo=user group
group[1]. AuthorityList=<authList>
group[2]….

9.7.4 AddUser

URL Syntax http://<ip>/cgi-bin/userManager.cgi?action=addUser&


user.Name=<userName>&
user.Password=<userPassword>&
user.Memo=<userMemo>&
user.Group=<userGroup>&
user.Reserved=<userReserved>&
user.Sharable=<userSharable>
user.AuthList=<authList>
Comment user.Group: string, the range is “admin” and “user”. In different group, the user has different authorities.
user.Sharable: bool, true means allow multi-point login.
User.Reserved: bool, true means this user can’t be deleted.
User.AuthList;.
For example:
Add a user of name operator, password 123456, belongs to group user, and allow multi-point login.
http://<ip>/cgi-bin/userManager.cgi?action=addUser&user.Name=operator&user.Password=123456&user.Group=user&us
er.Sharable=true&user.Reserved=false&user.AuthList= CtrlPanel,ShutDown, Record,Backup
Response OK or ERROR

62
9.7.5 DeleteUser

URL Syntax http://<ip>/cgi-bin/userManager.cgi?action=deleteUser&name=<userName>


Comment Delete user with name username.
Response OK or ERROR

9.7.6 ModifyUser

URL Syntax http://<ip>/cgi-bin/userManager.cgi?action=modifyUser&


name=<oldUserName>&
user.Name=<userName>&
user.Password=<userPassword>&
user.Memo=<userMemo>&
user.Group=<userGroup>&
user.Reserved=<userReserved>&
user.Sharable=<userSharable>
user.AuthList=<authList>
Comment Value range of parameters in <> is the same with 9.7.4 AddUser
Response OK or ERROR

9.7.7 ModifyPassword

URL Syntax http://<ip>/cgi-bin/userManager.cgi?action=modifyPassword&name=<username>&pwd=<newPwd>&pwdOld=<oldPwd>


Comment Modify user password, old password oldPwd should be supplied, new password is newPwd.
Response OK or ERROR

9.7.8 GetUserInfo

URL Syntax http://<ip>/cgi-bin/userManager.cgi?action=getUserInfo&name=<userName>


Comment Get use information with name userName
Response user.Name=admin
user.Memo=admin 's account
user.Group=admin
user.Reserved=true
user.Sharable=true
user. AuthList=<authList>

63
9.7.9 GetUserInfoAll

URL Syntax http://<ip>/cgi-bin/userManager.cgi?action=getUserInfoAll


Comment Get information of all users.
Response users[0].Group=admin
users[0].Id=1
users[0].Memo=admin 's account
users[0].Name=admin
users[0].Reserved=true
users[0].Sharable=true
users[0]. AuthList=<authList>
users[1].Group=admin

9.7.10 GetActiveUserInfoAll

URL Syntax http://<ip>/cgi-bin/userManager.cgi?action=getActiveUserInfoAll


Comment Get active users.
Response users[0].name=admin
users[0].ip=10.43.2.16
users[0].group=admin
users[0].clienttype=web3.0
users[0].logintime=2011-11-08 09:51:03

9.8System Operation

9.8.1 Reboot

URL Syntax http://<ip>/cgi-bin/magicBox.cgi?action=reboot


Comment Reboot the device. If successful, response OK. If fail, response ERROR.
Response OK or ERROR

9.8.2 Shutdown

URL Syntax http://<ip>/cgi-bin/magicBox.cgi?action=shutdown


Comment Shutdown the device. If successful, response OK. If fail, response ERROR.
Response OK or ERROR

64
9.8.3 GetDeviceType

URL Syntax http://<ip>/cgi-bin/magicBox.cgi?action=getDeviceType


Comment Get the device type.
Response type=DVR

9.8.4 GetHardwareVersion

URL Syntax http://<ip>/cgi-bin/magicBox.cgi?action=getHardwareVersion


Comment Get the device hardware version
Response version=1.00

9.8.5 GetSerialNo

URL Syntax http://<ip> /cgi-bin/magicBox.cgi?action=getSerialNo


Comment Get the device serial number
Response sn=YZC0GZ05100020

9.8.6 GetMachineName

URL Syntax http://<ip>/cgi-bin/magicBox.cgi?action=getMachineName


Comment Get the device machine name.
Response name=YZC0GZ05100020

9.8.7 GetSystemInfo

URL Syntax http://<ip>/cgi-bin/magicBox.cgi?action=getSystemInfo


Comment Get the system information.
Response serialNumber= PA1FQ15900207
deviceType=27
processor= ST7108

9.8.8 GetVendor

URL Syntax http://<ip>/cgi-bin/magicBox.cgi?action=getVendor


Comment Get the Vendor information.
Response Vendor=Dahua

65
9.8.9 GetSoftWareVersion

URL Syntax http://<ip>/cgi-bin/magicBox.cgi?action=getSoftwareVersion


Comment Get the software information.
Response version=2.616.0000.0

9.8.10 GetBuildDate

URL Syntax http://<ip>/cgi-bin/magicBox.cgi?action=getBuildDate


Comment Get the build date information.
Response builddate=2013-04-22

9.9 Log

9.9.1 StartFind

URL Syntax http://<ip>/cgi-bin/log.cgi?action=startFind&condition.StartTime=<start>&condition.EndTime=<end>


Comment Start to find log, in response, there is a token for further log finding process.
start/end: the start/end time of log. Format is: yyyy-mm-dd hh:mm:ss.

Example:
Find log between 2011-1-1 12:00:00 and 2011-1-10 12:00:00, URL is:
http://<ip>/cgi-bin/log.cgi?action=startFind&condition.StartTime=2011-1-1 12:00:00
&condition.EndTime=2011-1-10 12:00:00
Response token=1

9.9.2 DoFind

URL Syntax http://<ip>/cgi-bin/log.cgi?action=doFind&token=<tokenValue>&count=<logCount>


Comment Find log with token tokenValue and count logCount
tokenValue is get by startFind in above section, logCount is the count of logs for this query.
The maximum value of logCount is 100.
Response found=2
items[0].RecNo=789
items[0].Time=2011-05-20 11:59:10
items[0].Type=ClearLog
items[0].User=admin
items[1].Detail.Compression=H.264->MJPG
items[1].Detail.Data=Encode

66
items[1].RecNo=790
items[1].Time=2011-05-20 11:59:21
items[1].Type=SaveConfig
items[1].User=System

Field in Response Description


found Count of found log, found is 0 if no log is found.
User User name
Type Log type
Time Time of this log
RecNo Log number.
Detail Log details.

9.9.3 StopFind

URL Syntax http://<ip>/cgi-bin/log.cgi?action=stopFind&token=<tokenValue>


Comment Stop query log by token tokenValue
Response OK or ERROR

9.9.4 Clear

URL Syntax http://<ip>/cgi-bin/log.cgi?action=clear


Comment Clear all the logs.
Response OK or ERROR

10. Storage

10.1 File Finding

10.1.1 Create

URL Syntax http://<ip>/cgi-bin/mediaFileFind.cgi?action=factory.create


Comment Create a media file finder
Response result=08137

67
10.1.2 StartFind

URL Syntax http://<ip>/cgi-bin/mediaFileFind.cgi?action=findFile&object=<objectId>&condition.Channel=<channel>&condition.StartTime=


<start>&condition.EndTime=<end>&condition.Dirs[0]=<dir>&condition.Types[0]=<type>&condition.Flag[0]=<flag>&condition.E
vents[0]=<event>&condition.VideoStream=<stream>
Comment Start to find file wth the above condition. If start successfully, return true, else return false.
object : The object Id is got from interface in 10.1.1 Create
condition.Channel: in which channel you want to find the file .
condition.StartTime/condition.EndTime: the start/end time when recording.
condition.Dirs: in which directories you want to find the file. It is an array. The index starts from 0. The range of dir is
{“/mnt/dvr/sda0”, “/mnt/dvr/sda1”}. This condition can be omitted. If omitted, find files in all the directories.
condition.Types: which types of the file you want to find. It is an array. The index starts from 0. The range of type is {“dav”,
“jpg”, “mp4”}. If omitted, find files with all the types.
condition.Flags: which flags of the file you want to find. It is an array. The index starts from 0. The range of flag is {“Timing”,
“Manual”, “Marker”, “Event”, “Mosaic”, “Cutout”}. If omitted, find files with all the flags.
condition.Event: by which event the record file is triggered. It is an array. The index starts from 0. The range of event is
{“AlarmLocal”, “VideoMotion”, “VideoLoss”, “VideoBlind”, “Traffic*”}. This condition can be omitted. If omitted, find files of all
the events.
condition.VideoStream: which video stream type you want to find. The range of stream is {“Main”, “Extra1”, “Extra2”,
“Extra3”}. If omitted, find files with all the stream types.
Example:
Find file in channel 1, in directory “/mnt/dvr/sda0",event type is "AlarmLocal" or "VideoMotion", file type is “dav”, and time
between 2011-1-1 12:00:00 and 2011-1-10 12:00:00 , URL is:
http://<ip>/cgi-bin/mediaFileFind.cgi?action=findFile&object=08137&condition.Channel=1&conditon.Dir[0]=”/mnt/dvr/sda0”&
conditon.Event[0]=AlarmLocal&conditon.Event[1]=VideoMotion&condition.StartTime=2011-1-1%2012:00:00&condition.EndTi
me=2011-1-10%2012:00:00&condition.VideoStream=”Main”
Response OK or Error

10.1.3 FindNextFile

URL Syntax http://<ip>/cgi-bin/mediaFileFind.cgi?action=findNextFile&object=<objectId>&count=<fileCount>


Comment Find the next fileCount files.
The maximum value of fileCount is 100.
Response found=1
items[0]. Channel =1
items[0]. StartTime =2011-1-1 12:00:00
items[0]. EndTime =2011-1-1 13:00:00
items[0]. Type =dav
items[0]. Events[0]=AlarmLocal
items[0]. VideoStream=Main
items[0]. FilePath =/mnt/dvr/sda0/2010/8/11/dav/15:40:50.jpg
items[0]. Length =790
items[0]. Duration = 3600
68
Field in Response Description
found Count of found file, found is 0 if no file is found.
Channel Channel
StartTime Start Time
EndTime End time
Type File type
Events Event type.
VideoStream Video Stream type.
FilePath File path.
Length File length
Duration Duration time

10.1.4 Close

URL Syntax http://<ip>/cgi-bin/mediaFileFind.cgi?action=close&object=<objectId>


Comment Stop find.
Response OK or ERROR

10.1.5 Destroy

URL Syntax http://<ip>/cgi-bin/mediaFileFind.cgi?action=destroy&object=<objectId>


Comment Destroy the media file finder.
Response OK or ERROR

10.2 Storage Device

10.2.1 GetStorageDevicePortInfo

URL Syntax http://<ip>/cgi-bin/storageDevice.cgi?action=factory.getPortInfo


Comment Get the storage device port info
Response device port info
Total=2
Plug=1
Mask=1
Bad=0

69
10.3 NAS

10.3.1 GetNASConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=NAS


Comment Return all the directories on the NAS server.
Response table.NAS[0].Name=” FTP1”
table.NAS[0].Enable = true
table.NAS[0].Protocol =”FTP”
table.NAS[0].Address =”www.dahuatech.com”
table.NAS[0].Port =21
table.NAS[0].UserName =”anonymity”
table.NAS[0].Password =”none”
table.NAS[0].Directory =”share”

10.3.2 SetNASConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment In below table:
Head =NAS[index]
Index: The index of the NAS Server
Response OK or ERROR

ParamName ParamValue type Description


Head.Name string NAS name.
Head .Enable bool Enable/Disable the NAS.
Head. Protocol string The range is {“FTP”, “SMB”}
Head. Address string The IP address or host name.
Head .Port integer NAS port.
Head.UserName string NAS username.
Head .Password string NAS password.
Head .Directory string Directory name.

70
10.4 Storage Point

10.4.1 GetRecordStoragePointConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=RecordStoragePoint


Comment
Response table.RecordStoragePoint [0].TimingRecord.Local =”local”
table.RecordStoragePoint [0].TimingRecord. Redundant =” Redundant”
table.RecordStoragePoint [0].TimingRecord. Remote =” FTP”
table.RecordStoragePoint [0].TimingRecord. AutoSync = false
table.RecordStoragePoint [0].TimingRecord. AutoSyncRange =0
table.RecordStoragePoint [0].TimingRecord. LocalForEmergency =false
table.RecordStoragePoint [0].TimingRecord. CompressBefore =15

10.4.2 SetRecordStoragePointConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment In below table:
ch = channel index,
recType :The range is {“TimingRecord”,” VideoDetectRecord”,” AlarmRecord”,” EventRecord”,” TimingSnapShot”,”
VideoDetectSnapShot”,” AlarmSnapShot”,” EventSnapShot”}
Response OK or Error

ParamName ParamValue type Description


RecordStoragePoint [ch].[recType].Local string Local directory name.
RecordStoragePoint [ch].[recType]. Redundant string Redundant directory name.
RecordStoragePoint [ch].[recType]. Remote string Remote directory name.
RecordStoragePoint [ch].[recType]. AutoSync bool When remote directory recovers, auto synchronize local
directory to remote directory or not.
RecordStoragePoint [ch].[recType]. AutoSyncRange integer From the remote directory recovering time, how long the
data needs to be synchronized. The unit is hour. If it is 0, all
the data needs to be synchronized.
RecordStoragePoint [ch].[recType]. LocalForEmergency bool When the remote directory is unusable, save the data the
local directory or not.
RecordStoragePoint [ch].[recType]. CompressBefore integer How many days data will be compressed.

10.4.3 GetStorageGroupConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=StorageGroup


Comment
71
Response table.StorageGroup[0]. FileHoldTime =0
table.StorageGroup[0]. OverWrite =1

10.4.4 SetStorageGroupConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment In below table:
Index = StorageGroup index
ch = channel index
Response OK or Error

ParamName ParamValue type Description


StorageGroup[Index]. Name string Storage group name.
StorageGroup[Index]. Memo string Storage group memo.
StorageGroup[Index]. FileHoldTime integer How many days the file will be hold.
StorageGroup[Index]. OverWrite bool Over write or not when there is not enough storage.
StorageGroup[Index]. Channels[ch]. MaxPictures Integer The max pictures beyond which the old pictures will be over
written. If it is 0, the old pictures will be not over written.
StorageGroup[Index]. Channels[ch]. Path string The channel path.

11. GUI

11.1.1 GetGUIConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=GUISet


Comment Get GUI config.
Response table.GUISet. WindowAlpha =128
table.GUISet. TimeTitleEnable =true
table.GUISet. TimeTitlePos[0]=0
table.GUISet. TimeTitlePos[1]=0
table.GUISet. TimeTitlePos[2]=8191
table.GUISet. TimeTitlePos[3]=8191
table.GUISet. MenuShowOption =0
table.GUISet. MenuAutoHideTime =10
table.GUISet. AutoLogout =10
table.GUISet. ChannelTitleShowEnable =true
table.GUISet. ChannelTitlePos[0]=0
table.GUISet. ChannelTitlePos[1]=0
table.GUISet. ChannelTitlePos[2]=8191
table.GUISet. ChannelTitlePos[3]=8191
table.GUISet. AutoGuideEnable =true

72
11.1.2 SetGUIConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment
Response OK or ERROR

ParamName ParamValue type Description


GUISet.WindowAlpha integer Diaphaneity of the window background.
GUISet.TimeTitleEnable bool Show the time title or not.
GUISet.TimeTitlePos[0] integer The position of the time title.
GUISet.TimeTitlePos[1] integer
GUISet.TimeTitlePos[2] integer
GUISet.TimeTitlePos[3] integer
GUISet.MenuShowOption integer 0: Show the directory.
1:Hide the directory.
2:Timing hide the directory.
GUISet.MenuAutoHideTime integer How many seconds to hide the directory.
GUISet.AutoLogout integer How many minutes to auto logout. The range is
[0-120]. 0 expresses not logout.
GUISet.ChannelTitleShowEnable bool Show the channel title or not.
GUISet.ChannelTitlePos[0] integer The position of the channel title.
GUISet.ChannelTitlePos[1] integer
GUISet.ChannelTitlePos[2] integer
GUISet.ChannelTitlePos[3] integer
GUISet.AutoGuideEnable bool Auto guide or not when startup.

12. Display

12.1 Split

12.1.1 GetSplitMode

URL Syntax http://<ip>/cgi-bin/split.cgi?action=getMode&channel=<channel>


Comment Get the split mode.
Response mode=split1
group=4
73
12.1.2 SetSplitMode

URL Syntax http://<ip>/cgi-bin/split.cgi?action=setMode&channel=<channel>&mode=<mode>&group=<group>


Comment mode:enum{split1,split2,split4,split6,split8,split9,split12,split16,split20,split25,split36,split64,split144,pip1,pip3};
Response OK or ERROR

12.2 Monitor Tour

12.2.1 EnableMonitorTour

URL Syntax http://<ip>/cgi-bin/split.cgi?action=enableTour&channel=<channel>&enable=<flag>


Comment Enbale monitor tour.
Response OK or ERROR

12.2.2 GetMonitorTourConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=MonitorTour


Comment Get MonitorTour config.
Response table.MonitorTour[ch].Enable=128
table.MonitorTour[ch].Interval=true
table.MonitorTour[ch].Mask.Split1=0,1,5
table.MonitorTour[ch].Mask.Split8=0,1,5
table.MonitorTour[ch].Collections=Favortite1, Favortite2…

12.2.3 SetMonitorTourConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment paramValue as below table.
Response OK or ERROR

ParamName ParamValue type Description


MonitorTour[ch].Enable bool MonitorTour or not.
MonitorTour[ch].Interval integer MonitorTour interval.
MonitorTour[ch].Mask.Split1 Channel array for split1
MonitorTour[ch].Mask.Split8 Channel array for split8

74
MonitorTour[ch].Collections Split collections

12.3 Monitor Collect

12.3.1 GetMonitorCollectionConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=MonitorCollection


Comment Get GUI config.
Response table.MonitorCollection.collectionname. Mode=Split1
table.MonitorCollection.collectionname.Windows[winno].Enable= true
table.MonitorCollection.collectionname.Windows[winno].Device=device1
table.MonitorCollection.collectionname.Windows[winno].VideoChannel=5
table.MonitorCollection.collectionname.Windows[winno].VideoStream=Main
table.MonitorCollection.collectionname.Windows[winno].AudioChannel=5
table.MonitorCollection.collectionname.Windows[winno].AudioStream=Main

12.3.2 SetMonitorCollectionConfig

URL Syntax http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment In below table:Collect= MonitorCollection.collectionname. collectionname can be any name.
Response OK or ERROR

ParamName ParamValue type Description


Collect. Mode string The range is the same as 12.1.2 SetSplitMode
Collect.Windows[winno]. Enable bool Enable the window or not.
Collect.Windows[winno]. Device string The device Id.
Collect.Windows[winno]. VideoChannel integer The video channel .
Collect.Windows[winno]. VideoStream string The range is {“Main”, “Extra1”, “Extra2”, “Extra3”,
“Auto”}.
Collect.Windows[winno]. AudioChannel integer The audio channel .
Collect.Windows[winno]. AudioStream string The range is {“Main”, “Extra1”, “Extra2”, “Extra3”,
“Auto”}.

75
13. Audio

13.1 Audio MIME type

MIME Description
Audio/PCM
Audio/ADPCM
Audio/G.711A
Audio/G.711Mu
Audio/G.726
Audio/G.729
Audio/MPEG2
Audio/AMR
Audio/AAC

13.2 Post Audio

URL Syntax http://<ip>/cgi-bin/audio.cgi?action=postAudio&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment paramValue as below table.
Response OK or ERROR

ParamName ParamValue type Description


httptype string singlepart:HTTP content is a continuous flow of audio
packets
multipart:HTTP content type is
multipart/x-mixed-replace,and each audio packet ends
with a boundary string
channel integer The audio channel

13.2.1 Example for singlepart

The RUL of transmit a singlepart、channel 1 audio stream(encoded with G.711 A-law) is:
http: //<ip>/cgi-bin/audio.cgi?action=postAudio&httptype=singlepart&channel=1

example:
POST /cgi-bin/audio.cgi?action=postAudio&httptype=singlepart&channel=1 HTTP/1.1
Content-Type: Audio/G.711A
Content-Length:9999999

<Audio data>
<Audio data>

76
13.3.2 Example for multipart

The RUL of transmit a multipart、channel 1 audio stream(encoded with G.711 A-law) is:
http: //<ip>/cgi-bin/audio.cgi?action=postAudio&httptype= multipart &channel=1

example:
POST /cgi-bin/audio.cgi?action=postAudio&httptype= multipart &channel=1 HTTP/1.1
Content-Type: multipart/x-mixed-replace; boundary=<boundary>
--<boundary>
Content-Type: Audio/G.711A
Content-Length: 800

<Audio data>
--<boundary>

13.3 Get Audio

URL Syntax http://<ip>/cgi-bin/audio.cgi?action=getAudio&<paramName>=<paramValue>[&<paramName>=<paramValue>...]


Comment paramValue as below table.
Response OK or ERROR

ParamName ParamValue type Description


httptype string singlepart:HTTP content is a continuous flow of audio
packets
multipart:HTTP content type is
multipart/x-mixed-replace,and each audio packet ends
with a boundary string
channel integer The audio channel

13.3.1 Example for singlepart

The RUL of Request a singlepart、channel 1 audio stream(encoded with G.711 A-law) is:
http: //<ip>/cgi-bin/audio.cgi?action=getAudio&httptype=singlepart&channel=1

If the request was successful, the server returns a continuous flow of audio packets.The content type is only set at the beginning of the
connection.
Return:
HTTP Code: 200 OK
Content-Type: Audio/G.711A
Body:
<Audio data>

77
<Audio data>

13.3.2 Example for multipart

The RUL of Request a multipart、channel 1 audio stream(encoded with G.711 A-law) is:
http: //<ip>/cgi-bin/audio.cgi?action=getAudio&httptype=multipart&channel=1

If the request was successful, the server returns a continuous flow of audio packets. The content type is “multipart/x-mixed-replace” and each
audio packet ends with a boundary string.
Return:
HTTP Code: 200 OK
Content-Type: multipart/x-mixed-replace; boundary=<boundary>
--<boundary>
Content-Type: Audio/G.711A
Content-Length: 800

<Audio data>
--<boundary>

14. Appendix

14.1 Stream Format

The Stream format is used by 4.1.9 GetStream By Http and 4.1.10 Playback By Http, describes the format of the data stream.
Stream Header:

Byte
0 1 2 3 4 5 6 7
Order

Key Flag Type reserved packet length

Byte
8 9 10 11 12 13 14 15
Order

Extend header
Key channel Sequence
length

Byte
16 17 18 19 20 21 22 23
Order

Key utc utcms reserved Check


78
sum
Flag=”DH”;
Type=0x10 means the audio packet;
Type=0x20 means the video packet;
Packet length means the packet total length, contains the packet header, maybe one or more extend header, and the media data;

Extend Header Format

Byte
0 1 2 3 4 5 6 …
Order

Key Type length reserved data


Extend header length must be multiple of 4 bytes;

Audio extend header:

Byte
0 1 2 3 4 5 6 7
Order

Audio Sample
Key 0x11 8 reserved Tracks reserved
Type Freq
A audio packet must contain the audio extend header;
Audio Type:1 - PCM8;2 - G729;3 - IMA_ADPCM;4 - G711U;5 - G721;6 - PCM8_VWIS;7 - MS_ADPCM;8 - G711A;9 - AMR-NB;10 -
PCM16;11- G723.1;12 – AAC;13 - G726_40;14 - G726_32;15 - G726_24;16 - G726_16
Tracks: Tracks number, support 1 and 2;
Sample Freq: audio sample frequence,1 - 4000;2 - 8000;3 - 11025;4 - 16000;5 - 20000;6 - 22050;7 - 32000;8 - 44100;9 - 48000;

Video Extend Header:

Byte
0 1 2 3 4 5 6 7
Order

Video Frame
Key 0x21 16 reserved Width
Type Type

Byte
8 9 10 11 12 13 14 15
Order

I Frame Frame
Key Height reserved
Interval Rate
A video packet must contain the video extend header; Video Type means the video codec type, 1-MPEG4; 2-H.264; Frame Type: 1-I frame;
2-P frame;3-B frame; Width and Height describe the frame width and height by pixel;

Channel Title Extend Header:

79
Byte
0 1 2 3 4 5 6 …
Order

Key 0x22 len reserved Title …


When a stream begin, or the device channel title changes, the video packet must contain the channel title extend header; If the channel
title is Chinese, it only support utf8 format.

TimeZone Extend Header:

Byte
0 1 2 3 4 5 6 7
Order

Daylight
Key 0x31 8 reserved Time Zone saving reserved
time
When a stream begin, or the TimeZone changes, the video packet must contain the TimeZone extend header; Time Zone[0]:
[-12,12](west time zone 12 to east time zone 12), Time Zone[1] modify the time by minutes; Daylight saving time: 1/0, yes or not in daylight
saving time;

Event Flag Extend Header:

Byte
0 1 2 3 4 5 6 …
Order

Key 0x23 len reserved Event Flag


If the video frame contain one or more event flags, the video packet should contain the Event Flag Extend Header. The event flag means
what event had happened by set the bit as 1;
Event Flag: bit0-exterior alarm; bit1-move detect; bit2-video lost.

15 PositionManager

15.1 GetStatus

URL Syntax http://<ip>/cgi-bin/positionManager.cgi?action=getStatus&channel=<channelno>


Comment Get GPS status.
status.Time: current time;
status.Longitude: current longitude;
status.Latitude: current latitude;
status.Altitude: current altitude;
status.Speed: current speed, km/h;
status.Bearing: current bearing;
status.AntennasStatus: current antennas status;
status.PositioningResult: positioning

80
status.SatelliteCount: satellite number;
status.WorkStatus: work status;
status.AlarmPoints: alarm Position;
Response status.Time= [2009,9,8,10,32,12]
status.Longitude=[120,10,32.00]
status.Latitude=[30,11,11.0]
status.Altitude=9999.9
status.Speed=30.00
status.Bearing=45.3
status.AntennasStatus=1
status.PositioningResult=1
status.SatelliteCount=2
status.WorkStatus=2
status.AlarmPoints=[1,31]

81

You might also like