Zavio IP Camera SDK / API

This is the official for Zavio IP camera SDK / API used by software developers to program software applications. It is provided by CCTV Camera Pros, the North American master distributor for Zavio. You can shop here for the latest Zavio IP cameras that work with this SDK.

API, HTTP - Interface Specification

Revision: 3.2
Date: 2014-Mar-12


TABLE OF CONTENTS

TABLE OF CONTENTS. 1

DOCUMENT HISTORY.. 1

1 OVERVIEW... 1

1.1 Product and firmware versions. 1

2 REFERENCES. 2

3 DEFINITIONS. 2

3.1 General notation. 2

3.1.1 General abbreviations. 2

3.1.2 Style convention. 2

3.1.3 General CGI URL syntax and parameters. 2

3.1.4 Parameter value convention. 2

4 INTERFACE SPECIFICATION.. 2

4.1 Server responses. 2

4.1.1 HTTP status codes. 2

5 API GROUPS. 2

5.1 General 2

5.1.1 Add, remove, update and list parameters and their values. 2

5.1.2 Hard factory default 2

5.1.3 Backup. 2

5.1.4 Restore. 2

5.1.5 Firmware upgrade. 2

5.1.6 Reboot server 2

5.1.7 Language pack upload. 2

5.2 JPEG.. 2

5.2.1 JPEG image request 2

5.2.2 JPEG image (snapshot) CGI request 2

5.2.3 JPEG image response. 2

5.3 PTZ.. 2

5.3.1 PTZ set 2

5.3.2 PTZ configuration. 2

5.4 Motion/Audio Detection Level 2

5.5 I/O.. 2

5.5.1 Input 2

5.5.2 Output 2

5.6 Audio data transmit 2

5.7 RTSP. 2

5.7.1 Unicast request 2

5.7.2 Unicast response. 2

5.8 HTTP event 2

5.8.1 Test event server availability. 2

5.9 Secure socket level 2

5.9.1 Create self-signed certificate. 2

5.9.2 Read certificate information. 2

5.10 Network storage. 2

5.10.1 Test network storage server. 2

5.10.2 List download directory path of network storage. 2

5.10.3 List download file name of network storage. 2

5.10.4 Download file of network storage. 2

5.11 Server test 2

5.11.1 Test for SMTP. 2

5.11.2 Test for FTP. 2

5.12 File access. 2

5.12.1 File read. 2

5.12.2 File write. 2

5.13 Lens Control

5.13.1 Lens Control set

5.14 Get Fan/Temperature/Heater and set defog

5.14.1 Get Fan/Temperature/Heater

5.14.2 Set Defog

5.15 EdgeRecord State

5.15.1 EdgeRecord State Set


 DOCUMENT HISTORY

Version

Date

Comment

1.0.1

2015-May-06

Add equip, edgerecord

1.0.2

2015-Dec-18

Add Network storage download file cgi

 

1 OVERVIEW

This document specifies the external HTTP-based application programming interface of the IP camera and video servers with M2 firmware.

The HTTP-based video interface provides the functionality for requesting single and multi-part images and for getting and setting internal parameter values. The image and CGI-requests are handled by the built-in Web server in the camera and video servers.

 

1.1 Product and firmware versions

The support for the HTTP API is product and firmware dependent. Please refer to the Release Notes for the actual product for compliance information.

 

 

2 REFERENCES

HTTP protocol

  1. Hypertext Transfer Protocol -- HTTP/1.0

 

 

3 DEFINITIONS

This section contains information on general usage of this document.

3.1 General notation

3.1.1 General abbreviations

The following abbreviations are used throughout this document

CGI

Common Gateway Interface - a standardized method of communication between a client (e.g. a web browser) and a server (e.g. a web server).

TBD

To be done/designed - signifies that the referenced section/subsection/entity is intended to be specified, but has not reached a level of maturity to be public at this time.

N/A

Not applicable - a feature/parameter/value is of no use in a specific task

URL

RFC 1738 describes the syntax and semantics for a compact string representation for a resource available via the Internet. These strings are called "Uniform Resource Locators" (URLs).

URI

A Uniform Resource Identifier (URI) is a compact string of characters for identifying an abstract or physical resource. RFC 2396 describes the generic syntax of URI.

 

3.1.2 Style convention

In URL syntax and in descriptions of CGI parameters, text in italics within angle brackets denotes content that should be replaced with either a value or a string. When replacing the text string, the angle brackets must also be replaced. An example of this is the description of the name for the server, denoted with <servername> in the URL syntax description below, which is replaced with the string myserver in the URL syntax example, also shown below.

URL syntax is written with the word "Syntax:" shown in bold face, followed by a box with the referred syntax, as shown below. The name of the server is written as <servername>. This is intended to be replaced with the name of the actual server. This can either be a name, e.g. "thecam" or "thecam.adomain.net" or the associated IP number for the server, e.g. 192.168.1.100.

Syntax:

http://<servername>/cgi-bin/view/image?res=<Resolution>

A description of returned data is written with "Return:" in bold face, followed by the returned data in a box. All data returned as HTTP-formatted, i.e. starting with the string HTTP, is line-separated with a Carriage Return and Line Feed (CRLF) printed as \r\n.

Return:

HTTP/1.0 <HTTP code> <HTTP text>\r\n

URL syntax examples are written with "Example:" in bold face, followed by a short description and a light grey box with the example.

Example: Request default image.

http://myserver/cgi-bin/view/image?res=320x240

Examples of what can be returned by the server from a request are written with "Example:" in bold face, followed by a short description and a light grey box with an example of the returned data.

Example: Returned data after a successful request.

HTTP/1.0 200 Ok\r\n

 

3.1.3 General CGI URL syntax and parameters

CGI URLs are written in lower-case. CGI parameters are written in lower-case and as one word. When the CGI request includes internal camera parameters, the internal parameters must be written exactly as named in the camera or video server. The CGIs are organized in function related directories under the cgi-bin directory. The file extension of the CGI is required.

Syntax:

http://<servername>/cgi-bin/<subdir>[/<subdir>...]/<cgi>
[?<parameter>=<value>[&<parameter>=<value>...]]

Example: List the Network parameters.

http://myserver/cgi-bin/operator/param?action=list&group=General.Network

 

3.1.4 Parameter value convention

In tables defining CGI parameters and supported parameter values, the default value for optional parameters is system configured.

 

 

4 INTERFACE SPECIFICATION

4.1 Server responses

4.1.1 HTTP status codes

The built-in Web server uses the standard HTTP status codes.

Return:

HTTP/1.0 <HTTP code> <HTTP text>\r\n

with the following HTTP code and meanings

HTTP code

HTTP text

Description

200

OK

The request has succeeded, but an application error can still occur, which will be returned as an application error code.

204

No Content

The server has fulfilled the request, but there is no new information to send back.

302

Moved Temporarily

The server redirects the request to the URI given in the Location header.

400

Bad Request

The request had bad syntax or was impossible to fulfill.

401

Unauthorized

The request requires user authentication or the authorization has been refused.

404

Not Found

The server has not found anything matching the request.

409

Conflict

The request could not be completed due to a conflict with the current state of the resource.

500

Internal Server Error

The server encountered an unexpected condition that prevented it from fulfilling the request.

503

Service Unavailable

The server is unable to handle the request due to temporary overload.

Example: Request includes invalid file names.

HTTP/1.0 404 Not Found\r\n

 

 

5 API GROUPS

To make it easier for developers to get an idea of which API requests are supported for different products, the requests have been grouped together. Information about which groups are supported can be found in the product-specific release notes document.

5.1 General

The requests specified in the General section are supported by all video products with firmware version 4.00 and above.

5.1.1 Add, remove, update, and list parameters and their values

Note:  

  1. These requests have different security levels. The security level for each parameter is specified in the parameter document.
  2. The URL must follow the standard way of writing a URL, (RFC 2396: Uniform Resource Identifiers (URI) Generic Syntax); that is, spaces and other reserved characters (";", "/", "?", ":", "@", "&", "=", "+", "," and "$") within a <parameter> or a <value> must be replaced with %<ASCII hex>. For example, in the string My camera, the space will have to be replaced with %20, My%20camera.

Method: GET/POST

Syntax:

http://<servername>/cgi-bin/view/param?
<parameter>=<value>[&<parameter>=<value>...]
http://<servername>/cgi-bin/operator/param?
<parameter>=<value>[&<parameter>=<value>...]
http://<servername>/cgi-bin/admin/param?
<parameter>=<value>[&<parameter>=<value>...]

with the following parameter and values

<parameter>=<value>

Values

Description

action=<string>

 

add, remove, update or list

Specifies the action to take. Depending on this parameter, various parameters may be set, as described in the following sections.

 

5.1.1.1 List parameters

Syntax:

http://<servername>/cgi-bin/view/param?action=list
[&<parameter>=<value>...]
http://<servername>/cgi-bin/operator/param?action=list
[&<parameter>=<value>...]
http://<servername>/cgi-bin/admin/param?action=list
[&<parameter>=<value>...]

with the following parameter and values

<parameter>=<value>

Values

Description

group=<string>[,<string>...]

<group[.name]>[,<group[.name]>...]

Returns the value of the camera parameter named <group>.<name>. If <name> is omitted, all the parameters of the <group> are returned.

The camera parameters must be entered exactly as they are named in the camera or video server.

Wildcard (*) can be used when listing parameters. See example below.

If this parameter is omitted, all parameters in the device are returned.

Responseformat

rfc

Get the HTTP response format according to standard. 

Response format:
HTTP/1.0 200 OK\r\n
Content-Type: text/plain\r\n
\r\n
<parameter pair>

Example: List the Network parameters.

http://myserver/cgi-bin/admin/param?action=list&group=General.Network

 

5.1.1.2 List output format
HTTP/1.0 200 OK\r\n
Content-Type: text/plain\n
\n
<parameter pair>

where <parameter pair> is

<parameter>=<value>\n
[ <parameter pair> ]

 

Example: Network query response.

HTTP/1.0 200 OK\r\n
Content-Type: text/plain\n
\n
root.General.Network.eth0.IPAddress=191.168.1.100\n
root.General.Network.eth0.SubnetMask=255.255.255.0\n



If the CGI request includes an invalid parameter value, the server returns no message.
Return:  

HTTP/1.0 200 OK\r\n
Content-Type: text/plain\n
\n

 

5.1.1.3 Update parameters

Syntax:

http://<servername>/cgi-bin/operator/param?action=update
[&<parameter>=<value>...]
http://<servername>/cgi-bin/admin/param?action=update
[&<parameter>=<value>...]

with the following parameters and values

<parameter>=<value>

Values

Description

<string>=<string>

<group.name>=<value>

 

Assigns <value> to the parameter <group.name>.

The <value> must be URL-encoded when it contains non-alphanumeric characters.

The camera parameters must be entered exactly as named in the camera or the video server.

Example: Set the image resolution to 320x240 pixels.

http://myserver/cgi-bin/admin/param?action=update&StreamProfile.I0.Video.Resolution=320x240

 

5.1.1.4 Add parameters

Syntax:

http://<servername>/cgi-bin/operator/param?action=add
[&<parameter>=<value>...]
http://<servername>/cgi-bin/admin/param?action=add
[&<parameter>=<value>...]

with the following parameters and values

<parameter>=<value>

Values

Description

group=<string>

<group name>

The group node will be added the parameters.

template=<string>

<template name>

Assign a template you want add. The template must be supported by IPCam.

Example: Add one mask parameters.

http://myserver/cgi-bin/operator/param?action=add&group=Image.Mask&template=PrivacyMask

 

5.1.1.5 Remove parameters

Syntax:

http://<servername>/cgi-bin/operator/param?action=remove
[&<parameter>=<value>...]
http://<servername>/cgi-bin/admin/param?action=remove
[&<parameter>=<value>...]

with the following parameters and values

<parameter>=<value>

Values

Description

group=<string>

<group name>

The group node will be removed.

Example: Remove a group of parameter.

http://myserver/cgi-bin/admin/param?action=remove&group=PTZ.PresetPos.P0

 

5.1.2 Hard factory default

Reload factory default. All parameters are set to their factory default value.

Note: This request requires administrator access (administrator authorization).

Method: GET

Syntax:

http://<servername>/cgi-bin/admin/restoredevconf

 

5.1.3 Backup

Download a unit specific backup of /etc/device.conf.

Note: This requires administrator access (administrator authorization).

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/backup


Return:  

HTTP/1.0 200 OK\r\n
Content-Type: application/x-tar\r\n
Content-Disposition: attachment; filename=backup\r\n
\r\n
<file content of backup>

 

5.1.4 Restore

Upload a unit specific backup previously created by the backup command.

Note: This requires administrator access (administrator authorization).

Method: POST

Syntax:  

http://<servername>/cgi-bin/admin/restore

 

The file content is provided in the HTTP body according to the format given in RFC 1867. The body is created automatically by the browser if using HTML form with input type "file".


Example: Upload of backup, where "\r\n" has been omitted in the HTTP body.

POST /cgi-bin/admin/restore? HTTP/1.0\r\n
Content-Type: multipart/form-data; boundary=123456789\r\n
Content-Length: <content length>\r\n
\r\n
--123456789\r\n
<file content of backup>
\r\n
--123456789--\r\n

 

5.1.5 Firmware upgrade

Upgrade the firmware version.

Note: This requires administrator access (administrator authorization).

Method: POST

Syntax:  

http://<servername>/cgi-bin/admin/firmwareupgrade

 

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/firmwareupgrade[?action=<value>]

with the following parameters and values

<parameter>=<value>

Values

Description

action=<string>

preset,
default,

progress

Specifies the type of firmware upgrade.

preset = Pre-process for firmware upgrade.
default = Upgrade and reset all settings.

progress = report current upgrade status.

 

The file content is provided in the HTTP body according to the format given in RFC 1867. The body is created automatically by the browser if using HTML form with input type "file".


Example:

POST /cgi-bin/admin/firmwareupgrade?action=preset&action=default HTTP/1.0\r\n
Content-Type: multipart/form-data; boundary=oivazoivaz\r\n
Content-Length: <content length>\r\n
\r\n
--oivazoivaz\r\n
<firmware file content>
\r\n
--oivazoivaz--\r\n

 

5.1.6 Reboot server

Reboot server.

Note: This requires administrator access (administrator authorization).

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/reboot

 

5.1.7 Language pack upload

upload the language pack

Note: This requires administrator access (administrator authorization).

Method: POST

Syntax:  

http://<servername>/cgi-bin/admin/language

The file content is provided in the HTTP body according to the format given in RFC 1867. The body is created automatically by the browser if using HTML form with input type "file".


Example:

POST /cgi-bin/admin/language HTTP/1.0\r\n
Content-Type: multipart/form-data; boundary=---------------------------7d82deac0f3a\r\n
Content-Length: <content length>\r\n
\r\n
---------------------------7d82deac0f3a\r\n
<language pack content>
\r\n
---------------------------7d82deac0f3a\r\n

 

5.2 JPEG

The requests specified in the JPEG/MJPG section are supported by those video products that use JPEG and MJPG encoding.

 

5.2.1 JPEG image request

Returns an image with the default resolution and compression as defined in the system configuration.

Method: GET

Syntax:

http://<servername>/jpg/image.jpg

Example: Request JPEG image from default camera with default resolution and compression.

http://myserver/jpg/image.jpg

 

5.2.2 JPEG image (snapshot) CGI request

Request a JPEG image (snapshot) with specified properties.

Method: GET

Syntax:

http://<servername>/cgi-bin/admin/image

product/release-dependent.  

Example: Request a JPEG image .

http://myserver/cgi-bin/jpg/image

 

5.2.3 JPEG image response

When a JPEG image is requested, the server returns either the specified JPEG image file or an error.

Return:

HTTP/1.0 200 OK\r\n
Content-Type: image/jpeg\r\n
\r\n
OK\r\n

Example: Requested JPEG image.

HTTP/1.0 200 OK\r\n
Content-Type: image/jpeg \r\n
\r\n
OK\r\n

 

5.3 PTZ

The requests specified in the PTZ section are supported by those video products that have support for Pan/Tilt/Zoom devices.

 

5.3.1 PTZ set

To control the Pan, Tilt and Zoom behavior of a PTZ unit, the following PTZ control URL is used. This URL has view access rights.

Important: 
Some PTZ units automatically reduce pan and tilt movements as the zoom factor increases. Therefore, the actual movement may be less than what is requested of these units.
The PTZ control is device-dependent. For information about supported parameters and actual parameter values, please check the specification of the PTZ driver you intend to use. The following table is only an overview.

Note:
The URL must follow the standard way of writing a URL, (RFC 2396: Uniform Resource Identifiers (URI) Generic Syntax); that is, spaces and other reserved characters (";", "/", "?", ":", "@", "&", "=", "+", "," and "$") within a <parameter> or a <value> must be replaced with %<ASCII hex>. For example, in the string My camera, the space will have to be replaced with %20, My%20camera.

Method: GET

Syntax:

http://<servername>/cgi-bin/operator/ptzset?<parameter>=<value>[&<parameter>=<value>...]

with the following parameters and values

<parameter>=<value>

Values

Description

move=<string>

home,
up,
down,
left,
right,
upleft,
upright,
downleft,
downright,
repeat,
stop,
reset

Absolute: Moves the device 5 degrees in the specified direction. If add move=repeat to URL, it will continue move in the specified direction until receive move=stop URL.

Relative: Move the device approx. 50-90 degrees1 in the specified direction.

Note: Home is only valid if any home position has been previously set with "home=yes".

Note: Reset means motor calibration.

gotoserverpresetname=<string>

<preset name>2

Move to the position associated with the <preset name>.

gotoserverpresetno=<int>

0, ..., 31

Move to the position associated with the specified preset position number.

runservertourno=<int>

0~3

Start a patrol associated with the specified tour number.

stopservertourno=<int>

0~3

Stop a patrol associated with the specified tour number.

stream=<int>

index of view area

Note: Used to control EPTZ, for control physical PTZ is no need this parameter.

1 Actual values are device driver-specific.
2 <preset name> is a string with a maximum of 31 characters, ~ is not allowed.

Example: Request moves the device left and continue.

http://myserver/cgi-bin/operator/ptzset?move=left&move=repeat

 

5.3.2 PTZ configuration

Configure PTZ preset positions.. 

Note: This request requires operator access (operator authorization).

Method: GET

Syntax:

http://<servername>/cgi-bin/operator/ptzconfig?
<parameter>=<value>[&<parameter>=<value>...]

with the following parameters and values

<parameter>=<value>

Values

Description

setserverpresetname=<string>

<preset name>1

Associates the current position to <preset name> as a preset position in the server.

setserverpresetno=<int>

0, ..., 31 

Saves the current position as a preset position number in the server.

home=<string>

yes

Makes the current position the home position for the camera. Used with setserverpresetname or  setserverpresetno.

removeserverpresetname=<string>

<preset name>1

Remove the specified preset position associated with <preset name>.

removeserverpresetno=<int>

0, ..., 31

Remove the specified preset position.

removeallpreset

 

Remove all preset.

stream=<int>

index of view area

Note: Used to control EPTZ, for control physical PTZ is no need this parameter.

1 <preset name> is a string with a maximum of 31 characters, ~ is not allowed.

 

5.4 Motion/Audio Detection Level

Retrieve the current motion/audio detection level from all or specific motion detection include windows. Alternatively, retrieve all motion detection levels related to a specific motion detection window configuration. A motion detection window is defined by a dynamic parameter group Motion.M<group number>.

Method: GET

Syntax:

http://<servername>/cgi-bin/ admin/detection?
<parameter>=<value>[&<parameter>=<value>...]

with the following parameters and values

<parameter>=<value>

Values

Description

mode=<string>

single

If specified to single, data only sent once. (This parameter must be add to cgi first)

type=<string>

motion, audio

Specify the detection type.

group=<int>[,<int>,…]

<group number>[,<group number>, …]

Specify the motion/audio detection windows that are of interest. Excluding the group argument will return all motion detection level information from all motion detection windows Exclude window are ignored.

1 <preset name> is a string with a maximum of 31 characters, ~ is not allowed.

Return:

HTTP Code: 200 OK
Content-Type: multipart/x-mixed-replace; boundary=<boundary>
Body:
--<boundary>
<motion/audio levels>

where the returnd <motion/audio levels> part is

Content-Type: text/plain

and the <monitor data> part is

<motion/audio level for window with lowest group number>
--<boundary>

and <motion/audio level for window with group number n> is

Group=<group number n>;level=<motion level for n>;threshold=<threshold level for n>;
[ <motion/audio level for window n+1> ]

 

Example: Get motion detection levels related to motion detection windows defined within Motion.M0 and Motion.M1.

http://myserver/cgi-bin/admin/detection?type=motion&group=0,1

The example returns the following.

HTTP Code: 200 OK

Content-Type: multipart/x-mixed-replace;boundary=detection

Body:

--detection
Content-Type: text/plain
 
 
group=0;level=28;threshold=45; 
group=0;level=43;threshold=25;
--detection
Content-Type: text/plain
 
 
group=0;level=12;threshold=45; 
group=0;level=33;threshold=25;
--detection
Content-Type: text/plain
 
 
group=0;level=56;threshold=45; 
group=0;level=3;threshold=25;
--detection
 

 

5.5 I/O

The requests specified in the I/O section are supported by those products that have Input/Output connectors.

 

5.5.1 Input

Digital Input

Method: GET

Note: This request requires administrator access (administrator authorization).

Syntax:  

http://<servername>/cgi-bin/admin/input?
<parameter>=<value>[&<parameter>=<value>...]

with the following parameters and values

<parameter>=<value>

Values

Description

check=<int>[,<int>, ...]

<id1>[,<id2>, ...] 1

Returns the status (1 or 0) of one or more inputs numbered id1 ,id2, ....

monitor=<int>[,<int>, ...]2

<id1>[,<id2>, ...] 1

Returns a multipart stream of "check" inputs (see return description below).

1 Number of inputs may differ for different cameras and video servers. See the product's specification.
2 Support for this parameter is product/release-dependent.

Return: "monitor", i.e., multipart "check" parameter

HTTP/1.0 200 OK\r\n
Content-Type: multipart/x-mixed-replace;boundary=<boundary>\r\n
\r\n 
--<boundary>\r\n
<monitor data>

where the proposed boundary <boundary> is

ioboundary

and the <monitor data> part is

Content-Type: text/plain\r\n
\r\n
<check data>
--<boundary>\r\n

and <check data> is

IO<n>:<action char>\r\n

and <n> is the I/O port number and <action char> is the action character described in the table above.
Note: The output can contain extra blank lines, i.e., extra
\r\n within the sections.

Example: Monitor data on input ports 1, 2, 3, and 4.

http://myserver/cgi-bin/admin/input?monitor=1,2,3,4

Example: Monitor data on input port 1.

HTTP/1.0 200 OK\r\n
Content-Type: multipart/x-mixed-replace; boundary=ioboundary\r\n
\r\n
\r\n
\r\n
\r\n
--ioboundary\r\n
Content-Type: text/plain\r\n
\r\n
IO0:/\n
\r\n
\r\n
--ioboundary\r\n
Content-Type: text/plain\r\n
\r\n
IO0:H\n
\r\n
--ioboundary\r\n
Content-Type: text/plain\r\n
\r\n
\r\n
IO0:\\n
\r\n
\r\n
--ioboundary\r\n
Content-Type: text/plain\r\n
\r\n
\r\n                      
\r\n
\r\n
--ioboundary\r\n
Content-Type: text/plain\r\n
\r\n
\r\n
 .
 .
 .

 

5.5.2 Output

Digital Output

Method: GET

Note: This request requires administrator access (administrator authorization).

Syntax:

http://<servername>/cgi-bin/admin/output?
<parameter>=<value>[&<parameter>=<value>...]

with the following parameters and values

<parameter>=<value>

Values

Description

check=<int>[,<int>, ...]

<id1>[,<id2>, ...] 1

Returns the status (1 or 0) of one or more outputs numbered id1 ,id2, ....

monitor=<int>[,<int>, ...] 2

<id1>[,<id2>, ...] 1

Returns a multipart stream of "check" outputs (see return description below).

action=<string>

[<id>1]:<a>[<wait> <a> ...]

Sets the output relay <id> active or inactive and waits <wait> milliseconds. Note that only one output relay can be activated/deactivated per request.

<id> = Output number. If omitted, output 1 is selected.

<a> = Action character: / or \
/ = active, \ = inactive.

<wait> = Delay in milliseconds.

1 Number of outputs may differ for different cameras and video servers. See the product's specification.
2 Support for this parameter is product/release-dependent.

 

Example: Set output 1 active.

http://myserver/cgi-bin/admin/output?action=1:/

Example: Set two 300 ms pulses with 500 ms delay between the pulses on output 1.

http://myserver/cgi-bin/admin/output?action=1:/300\500/300\

Example: Wait 1 second before setting output 1 active.

http://myserver/cgi-bin/admin/output?action=1:1000/

 

5.6 Audio data transmit

Transmit a Singlepart/Multipart Audio data stream.

Method: POST

Syntax:  

http://myserver/audio_in

 

There are no valid parameters and values.

Example: Singlepart/Multipart Audio data

http://myserver/audio_in

 

5.7 RTSP

The requests specified in the RTSP section are supported by those products that support Real Time Streaming Protocol.

 

5.7.1 Unicast request

Method: GET

Syntax:  

rtsp://<servername>:<rtsp port>/video.pro1*

*Example: Request a RTSP Description file

http://myserver:554/video.pro1*

*The actual file name should be got from parameter. Check parameter document for reference.

 

5.7.2 Unicast response

When RTSP unicast is requested, the server returns a descript file of RTSP video/audio streams. The content type is " application/sdp". Then client can parse the descript file to SETUP, PLAY and TEARDOWN the RTSP stream

Return:

RTSP/1.0 200 OK\r\n
CSeq: 1\r\n
Date: Mon Nov 1 11:42:19 2008 GMT\r\n
Content-base: rtsp://<servername>:<rtsp port>/video.pro1/\r\n
Content-Type: application/sdp\r\n
Content-Length: <descript file size>\r\n
\r\n
<descript file body>\r\n

Example: Requested RTSP Description file.

RTSP/1.0 200 OK\r\n
CSeq: 1\r\n
Date: Mon Nov 1 11:42:19 2008 GMT\r\n
Content-base: rtsp://192.168.1.8:554/video.pro1/\r\n
Content-Type: application/sdp\r\n
Content-Length: <sdp length>\r\n
\r\n
v=0\r\n
o=RTSP 424238335 0 IN IP4 <server_ip>\r\n
s=QStream\r\n
c=IN IP4 0.0.0.0\r\n
t=0 0\r\n
a=range:npt=0-\r\n
a=control:*\r\n
m=video 0 RTP/AVP 99\r\n
a=rtpmap:99 H264/90000\r\n
a=fmtp:99 profile-level-id=42A01E;packetization-mode=1;sprop-parameter-sets=Z0IAKOkAoAQMgA==,aM44gA==\r\n
a=control:trackID=0\r\n
m=audio 0 RTP/AVP 0\r\n
a=control:trackID =1\r\n
\r\n

 

5.8 HTTP event

If an event handling server is available, user can configure the CGI parameters and/or messages sent to the event server when event occurred.

 

5.8.1 Test event server availability

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/servetest?
<parameter>=<value>[&<parameter>=<value>...]

with the following parameters and values

<parameter>=<value>

Values

Description

cmd=<string>

http

Test server type.

ServerName=<string>

string

Event server address.

ServerPort=<int>

1, ... 65535

Event server port.

UserName=<string>

string

User name.

Password=<string>

string

User password.

ProxyAddr=<string>

string

Proxy address.

ProxyPort=<string>

1, ... 65535

Proxy port.

ProxyUser=<string>

string

User name of proxy server.

ProxyPass=<string>

string

Password of proxy server.

Return: HTTP code from event server.

HTTP/1.0 200 OK\r\n
Content-Type: text/plain\n
\n
 
 

Example:

http://myserver/cgi-bin/admin/servetest?
url=192.168.1.10&ServerName=/cgi/serverhandler&ServerPort=80&UserName=user&Password=password

 

5.9 Secure socket level

Create a certificate or read the content of SSL(secure socket level) certificate.

 

5.9.1 Create self-signed certificate

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/sslselfsign?
<parameter>=<value>[&<parameter>=<value>...]

with the following parameters and values

<parameter>=<value>

Values

Description

CNTR=<string>

string

2-letter country code of subject that conforms to ISO-3166.

STAT=<string>

string

State or province of subject.

LOCA=<string>

string

Locality of subject.

ORGA=<string>

string

Organization of subject.

ORUN=<string>

string

Organizational unit of subject.

CMNM=<string>

string

Common name of subject (The URL of product).

VALI=<int>

1, ... 1000

Validity period of certification.

Return:

HTTP/1.0 200 OK\r\n
Content-Type: text/plain\n
\n
 

Example:

http://myserver/cgi-bin/admin/sslselfsign?CNTR=TW&STAT=Taipei&LOCA=TaipeiCity&ORGA=company&ORUN=organization&CMNM=192.168.1.10&VALI=365

 

5.9.2 Read certificate information

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/sslcertinfo

Return: Content of certificate.

HTTP/1.0 200 OK\r\n
Content-Type: text/plain\n
\n

Certificate: \n
    Data:
\n
        Version: 4 (0x3)
\n
        Serial Number: 0 (0x0)
\n
        Signature Algorithm: md5WithRSAEncryption
\n
        Issuer: C=TW, ST=Taipei, L=TaipeiCity, O=company, OU=organization, CN=192.168.1.10
\n
        Validity
\n
            Not Before: Nov 14 11:29:50 2007 GMT
\n
            Not After : Nov 13 11:29:50 2008 GMT
\n
        Subject: C=TW, ST=Taipei, L=TaipeiCity, O=company, OU=organization, CN=192.168.1.10
\n
        Subject Public Key Info:
\n
            Public Key Algorithm: rsaEncryption
\n
            RSA Public Key: (1024 bit)
\n
                Modulus (1024 bit):
\n
                    00:a1:54:8b:4a:90:3b:bb:14:dd:0d:d7:e1:f0:72:
\n
                    6c:24:d7:59:d7:ea:16:02:88:fa:4c:19:d4:7b:04:
\n
                    9d:ee:c2:89:ad:11:ab:a6:a0:05:ca:63:60:6a:5e:
\n
                    13:97:b2:5c:1d:84:ab:96:90:2a:c7:82:25:15:0c:
\n
                    ef:09:26:cb:c2:f5:aa:ce:63:cc:7f:55:92:f3:35:
\n
                    02:a9:4e:33:90:ea:dd:7c:1c:b5:98:2a:ef:e9:6e:
\n
                    34:09:16:1f:34:97:a4:f7:10:80:62:a1:a0:ae:f9:
\n
                    56:28:70:6d:53:1b:06:70:2c:4b:6b:49:ca:b5:11:
\n
                    01:65:0a:11:0a:59:e5:07:73
\n
                Exponent: 65537 (0x10001)
\n
    Signature Algorithm: md5WithRSAEncryption
\n
        77:e3:bd:d4:28:75:99:f2:a1:9c:d3:6d:72:ec:b9:c8:14:ab:
\n
        b6:df:e9:ba:8a:b5:41:ff:2d:be:92:46:60:28:08:ee:a5:16:
\n
        cb:b9:96:bf:60:63:38:cc:18:cd:0e:a4:7a:86:4e:6f:ec:86:
\n
        60:72:50:ce:6f:93:ec:7b:0a:4d:0f:e6:3d:60:77:aa:e8:9e:
\n
        e6:88:28:14:50:9c:55:7c:21:c8:3f:48:1c:41:0a:d2:aa:1a:
\n
        e9:96:66:06:d8:53:be:58:7a:83:24:71:9f:38:de:c7:51:36:
\n
        9e:cd:5d:da:43:bb:75:2d:bc:51:c9:d8:16:59:22:1b:4d:c3:
\n
        59:e9
\n

 

Example: Read the content of current certificate.

http://myserver/cgi-bin/admin/sslcertinfo

 

5.10 Network storage

5.10.1 Test network storage server.

 Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/servetest?
<parameter>=<value>[&<parameter>=<value>...]

with the following parameters and values

<parameter>=<value>

Values

Description

fstype=<string>

 cifs, nfs

Type of network storage

ServerName=<string>

string

IP and directory of server.

UserName=<string>

string

User name.

Password=<string>

string

Password.

Workgroup=<string>

string

Workgroup.

Return:

HTTP/1.0 200 OK\r\n
Content-Type: text/plain\n
\n
#Network storage test OK

Example:

/cgi-bin/admin/servetest?fstype=cifs&ServerName=//10.0.0.56/ns&UserName=usr&Password=pas&Workgroup=none

 

5.10.2 List download directory path of network storage

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/sdstate?action=filelistnas&directory=IPCamera<MAC address>/date/hour

Example:

/cgi-bin/admin/sdstate?action=filelistnas&directory=IPCamera001BFE0B8521/20151104/15/

Return:

HTTP/1.1 200 OK
Content-type: text/plain\n
\n

Total 0

drwxr-xr-x    0 root     root         0 Nov  4  15:15 20151104151225_783F_EN/

drwxr-xr-x    0 root     root         0 Nov  4  15:18 20151104151525_7955_EN/

drwxr-xr-x    0 root     root         0 Nov  4  15:21 20151104151825_A809_EN/

drwxr-xr-x    0 root     root         0 Nov  4  15:24 20151104152126_9059_EN/

 

Directory path: date/hour/record ID

Example:

20151104/15/20151104151225_783F_EN
20151104/15/20151104151525_7955_EN
20151104/15/20151104151825_A809_EN
20151104/15/20151104152126_9059_EN

 

5.10.3 List download file name of network storage

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/sdstate?action=filelistnas&directory=IPCamera<MAC address>/directory path

Example:

/cgi-bin/admin/sdstate?action=filelistnas&directory=IPCamera001BFE0B8521/20151104/15/20151104151225_783F_EN

Return:

HTTP/1.1 200 OK
Content-type: text/plain\n
\n

Total 1749

drwxr-xr-x    1 root     root         195931 Nov  4  15:15 20151104151233_PE.jpg*

drwxr-xr-x    1 root     root         196137 Nov  4  15:15 20151104151233_PE_Post01.jpg*

drwxr-xr-x    1 root     root         202334 Nov  4  15:15 20151104151233_PE_Pre01.jpg*

drwxr-xr-x    1 root     root         203033 Nov  4  15:15 20151104151233_PE_Pre02.jpg*

drwxr-xr-x    1 root     root         40     Nov  4  15:15 recoring.xml*

 

File name: 20151104151233_PE.jpg, 20151104151233_PE_Post01.jpg, 20151104151233_PE_Pre01.jpg, 20151104151233_PE_Pre02.jpg

 

5.10.4 Download file of network storage

Method: GET

Syntax:  

http://<servername>/ns/IPCamera<MAC address>/<directory path>/filename

Example:

http://myserver/ns/IPCamera001BFE0B8521/20151105/09/20151105090720_6542_SN/20151105090720.mkv

 

5.11 Server test

This CGI is to verify connection of FTP client or SMTP server and make sure the parameters are correct.

 

5.11.1 Test for SMTP

The process of SMTP test should be as follows:

1.      Write mail title to /tmp/subject.txt and mail message to /tmp/message.txt via filewrite command (See section 5.13 for reference).

2.      Send CGI command.

3.      Read file /testsmtp.log for test result via fileread command (See section 5.13 for reference).

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/servetest?<parameter>=<value>

with the following parameters and values

<parameter>=<value>

Values

Description

cmd=<string>

smtp,
clearsmtp

smtp: Test SMTP setting.
clearsmtp: Abort current test.

ServerName=<string>

An string

Server name.

ServerPort=<int>

An integer

Server port.

ServerSSL=<string>

on, off

Specify if connect with SSL protocol.

UserName=<string>

A string

User name.

Password=<string>

A string

User password.

RcptToAddr1=<string>

A string

Receiver mail address.

AdminAddr=<string>

A string

Transmitter mail address.

Return:

HTTP/1.1 200 OK
Content-type: text/plain\n
\n

Example:

http://myserver/cgi-bin/admin/servetest?cmd=smtp&ServerName=mailserver.com&ServerPort=25&ServerSSL=off&UserName=user &Password=pass&RcptToAddr1=receive@mail.com&AdminAddr=admin@mail.com
 
Content of testsmtp.log:
smtp: Connect to host 
   
smtp: Start AUTH  
  smtp: AUTH CRAM-MD5
   success
smtp: MAIL FROM:<admin@mail.com>
   
smtp: RCPT TO:<receive@mail.com>
   
smtp: Send message   message sent
smtp: QUIT
   
..............SMTP Test Success..............

 

5.11.2 Test for FTP

The process of FTP test should be as follows:

1.      Write an arbitrarily string to /var/ftptest via filewrite command (See section 5.13 for reference).

2.      Send CGI command.

3.      Read file /testftp.log for test result via fileread command (See section 5.13 for reference).

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/servetest?<parameter>=<value>

with the following parameters and values

<parameter>=<value>

Values

Description

cmd=<string>

ftp,
clearftp

ftp: Test FTP setting.
clearftp: Abort current test.

ServerName=<string>

A string

Server name.

UserName=<string>

A string

User name.

Password=<string>

A string

User password.

Passive=<string>

on, off

Passive mode.

SourceName=<string>

A string

Path and filename of file to be transmitted.

TargetName=<string>

A string

File name on FTP server.

Return:

HTTP/1.1 200 OK
Content-type: text/plain\n
\n

Example:

http://myserver/cgi-bin/admin/servetest?cmd=ftp&ServerName=192.168.10.10&UserName=user&Password=user&Passive=off&SourceName=/var/ftptest&TargetName=testfile
 
Content of testftp.log:
Send file to ftp://user:xxxxx@192.168.10.10:21/testfile
Connecting to 192.168.10.10:21... ! connected
Logging in as user ... Logged in!
File transmit : 
 
    success
Transfered 7 bytes in 1 file
..............FTP Test Success..............

 

5.12 File access

5.12.1 File read

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/fileread?<parameter>=<value>

with the following parameters and values

<parameter>=<value>

Values

Description

READ.filePath=<string>

A string

File name and path to be read.

Return:

HTTP/1.1 200 OK
Content-type: text/plain\n
\n

Example:

http://myserver/cgi-bin/admin/fileread?READ.filePath=/testftp.log

5.12.2 File write

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/filewrite?<parameter>=<value>

with the following parameters and values

<parameter>=<value>

Values

Description

SAVE.filePath=<string>

A string

File name and path to be write to.

SAVE.fileData=<string>

A string

File data to be write to.

Return:

HTTP/1.1 200 OK
Content-type: text/plain\n
\n

Example:

http://myserver/cgi-bin/admin/filewrite?SAVE.filePath=/var/ftptest&SAVE.fileData=testtest

 

5.13 Lens Control

The requests specified in the Lens section are supported by those video products that have support for Zoom and focus devices.

 

5.13.1 Lens Control set

To control the Zoom, Focus behavior of a Lens unit, the following Lens control URL is used.

Compatible models : Motorized Model (B/D8220, 8520, B/D6330, B/D6530…)

Compatible models(Partial) : Speeddome (Not Support focus mode)

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/refocus?<parameter>=<value>[&<parameter>=<value>...]

with the following parameters and values

<parameter>=<value>

Values

Description

mode=<string>

zoom
focus
smart

zoom: Adjust zoom value. Zoom in for tele and zoom out for wide.
focus: Adjust focus value to set near or far scene clearer.
smart: Automatically find maximum focus value. (default focus method is faster)
Note: Choose only one mode in a cgi.
Suggest: Use smart first, and then do little adjustment for zoom or focus.

value=<int>

int

For zoom or focus only.
Zoom and focus range both are integers between -80 and 80.
Note: Negative value for zoom out or focus near and positive value for zoom in or focus far.
Suggest: Adjust value between -10 to 10 at once.

method=<string>

full
fast

Select for smart
full: Scan all focus value and select the maximum one.
fast: Get maximum focus value through mathematical calculations.

Position=<int>

int

Web page Slider Bar (Zoom and Focus) corresponding to range 0~100

Example:

http://myserver/cgi-bin/admin/refocus?mode=zoom&value=10
http://myserver/cgi-bin/admin/refocus?mode=focus&value=-10
http://myserver/cgi-bin/admin/refocus?mode=smart&method=fast
http://myserver/cgi-bin/admin/refocus?mode=zoom&position=100

 

5.14 Get Fan/Temperature/Heater and set defog

The cgi can get fan, temperature, and heater information and set defog on or off.

 

5.14.1 Get Fan/Temperature/Heater information

Get fan, temperature, and heater information.

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/equip?

Example:

http://myserver/cgi-bin/admin/equip?

Return:

HTTP/1.1 200 OK
Content-type: text/plain\n
\n
temperaturec=<value> temperaturef=<value> fan=<value> heater=<value>

 

5.14.2 Set defog

Set defog.

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/equip?defog=on/off

Example:

http://myserver/cgi-bin/admin/equip?defog=off

Return:

HTTP/1.1 200 OK
Content-type: text/plain\n
\n

 

5.15 EdgeRecord State

The cgi can get edgerecord informations.

 

5.16.1 EdgeRecord State Set

The cgi can get edgerecord informations.

Method: GET

Syntax:  

http://<servername>/cgi-bin/admin/edgerecord?<parameter>=<value>[&<parameter>=<value>...]

with the following parameters and values

<parameter>=<value>

Values

Description

sort=<string>

asc
desc

Asc:Sort item by time, from the oldest to the most recent.
Desc:Sort item by time, from the most recent to the oldest.
Default:asc

trigtype=<string>

A string

Show all the event with the same trigger type which is chosen. (Ex: motion detection, periodical record).
Note: depend on the events that camera supports.
String "All" is for all event type.

fromdate=<string>

A string

The start time of edge-record ordering.

todate=<string>

A string

The end time of edge-record ordering.

limit=<string>

An integer

The number of list in a page.(MAX=99, MIN=1)
Default is 10.

typename=<string>

A string

Show all the event with the same name of event list which is chosen.
String "geteventname" is to get all the name of even list.

Example:

http://myserver/cgi-bin/admin/edgerecord?fromdate=2015-04-07%2017:00:00&todate=2015-04-07%2017:10:00&sort=asc&limit=12&trigtype=Motion
http://myserver/cgi-bin/admin/edgerecord?typename=geteventname

 

HTTP/1.1 200 OK
Content-type: text/plain\n
\n

count(*)=1\n

Name=HC_MO\n

RecordID=20150407170246_B4A4_ES\n
StartTime=2015-04-07 17:02:46\n
StopTime=2015-04-07 17:03:00\n
Duration=day:0, 00:00:14\n
TriggerType=Motion\n
RecordingType=HC_MO\n
Complete=yes\n
StorageType=SD\n
MediaType=jpg\n