Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

IP Camera CGI Instructions

Version Author Date Update


1.0 Maverick Gao 2007-11-21 Updated for system version: x.x.1.2
1.01 Maverick Gao 2008-07-25 Updated for system version: x.x.1.17
z get_params.cgi(the below params are
added): wifi_channel、wifi_authtype、
wifi_keyformat 、 wifi_key1_bits 、
wifi_key2_bits 、 wifi_key3_bits 、
wifi_key4_bits。
z set_wifi.cgi(the below params are
added):channel、authtype、keyformat、
key1_bits 、 key2_bits 、 key3_bits 、
key4_bits。
z modify snapshot.cgi , add a new
authentification method:user name and
password are added in the params
z add videostream.cgi
1.02 Maverick Gao 2008-08-06 Updated for system version: x.x.1.18
z modify camera_control.cgi,add pan/tilt
control
1.03 Maverick Gao 2009-01-07 Updated for system version: x.x.1.32
1.04 Maverick Gao 2009-02-07 Updated for system version: x.x.1.33
Modify motion detect sensitivity and add
alarm armed params
1.05 Maverick Gao 2009-04-29 Updated for system version: x.x.1.39
add videostream.asf
add resolution in videostream.cgi
Contents

ip camera cgi introduction.................................................................................................................4


TU UT

snapshot.cgi.......................................................................................................................................5
TU UT

videostream.cgi .................................................................................................................................5
TU UT

videostream.asf .................................................................................................................................5
TU UT

get_status.cgi .....................................................................................................................................6
TU UT

get_camera_params.cgi .....................................................................................................................7
TU UT

decoder_control.cgi ...........................................................................................................................8
TU UT

camera_control.cgi ............................................................................................................................9
TU UT

reboot.cgi ..........................................................................................................................................9
TU UT

restore_factory.cgi ..........................................................................................................................10
TU UT

get_params.cgi ................................................................................................................................10
TU UT

upgrade_firmware.cgi .....................................................................................................................13
TU UT

upgrade_htmls.cgi ...........................................................................................................................13
TU UT

set_alias.cgi .....................................................................................................................................13
TU UT

set_datetime.cgi ..............................................................................................................................13
TU UT

set_users.cgi ....................................................................................................................................14
TU UT

set_devices.cgi ................................................................................................................................14
TU UT

set_network.cgi ...............................................................................................................................15
TU UT

set_wifi.cgi ......................................................................................................................................15
TU UT

set_pppoe.cgi ..................................................................................................................................16
TU UT

set_upnp.cgi ....................................................................................................................................16
TU UT

set_ddns.cgi.....................................................................................................................................16
TU UT

set_ftp.cgi ........................................................................................................................................17
TU UT

set_mail.cgi .....................................................................................................................................17
TU UT

set_alarm.cgi ...................................................................................................................................18
TU UT
ip camera cgi introduction
The cgi listed hither is a set of interfaces based on http protocol provided by ip camera. Client
program (it can be web pages run on web browser or other application program) can make any
operation on the device through cgi.

z cgi safety authentification: The cgi listed needs safety authentification when they are called.
Different cgi interfaces have different privileges which can be divided into visitor, operator
and administrator and are determined by the user set in the device. The safety authentification
supports two methods: the Basic safety authentification stipulated in http protocols and
adding user name and password in the cgi parameters.
z Cgi calling method:For all http methods, the cgi listed supports get and post method only.
upgrade_firmware.cgi and upgrade_htmls.cgi support post only and other cgi supports get
only.
Get (for example)
<form action=”/set_mail.cgi”>
<input name=”svr”>
<input name=”user”>
<input name=”pwd”>
<input name=”sender”>
<input name=”receiver1”>
<input name=”receiver2”>
<input name=”receiver3”>
<input name=”receiver4”>
<input type=hidden name=”next_url” value=”index.htm”>
<input type=submit value=”ok”>
</form>
Post (for example)
<form action=”upgrade_firmware.cgi?next_url=index.htm” method=”post”
enctype=”multipart/form-data”>

<input type=”file” name=”file” size=”20”>


</form>
z Cgi returns:according to the returns, the cgi listed can be classified as two categories:
9 The cgi to get the device status and parameter including get_status.cgi and
get_params.cgi. They return a text including the device status or parameters, the format
of which is similar with the variable definition in javascript defining every status and
parameter as a variable and return, for example:
var id=’003456789A0A’;
var sys_ver=’0.0.1.2’;
var app_ver=’0.0.1.3’;
var alias=”;
var now=1195552193;
var tz=0;
var ntp_enable=1;
var ntp_svr=’time.nist.gov’;
9 Cgi to set the device parameters or operate. This category of cgi will return a text of the
operation result. If successful, it will return “ok”; otherwise, it will return the specific
error information, for instance, “error: illegal param” indicating the cig has illegal
parameters. However, if you want it to return a file but a simple text of “ok” when the
operation succeeds, you can add “next_url” in the cgi params being requested. The
parameter will go to the next file when the responding operation succeeds and please be
noted that it must be relative path.

snapshot.cgi
description:snapshot the current picture
privilege:visitor
grammar:/snapshot.cgi[?user=&pwd=&next_url=]
parameters:
user:user name
pwd:password
next_url:picture file name

explanation:

0 If there is no parameter in next_url, the return picture file name will be: device id
(alias)_the current time.jpg. Otherwise, the file name will be specified by next_url.

videostream.cgi
description: ipcamera sends jpeg video stream to the client software in server push mode
privilege:visitor
grammar:/videostream.cgi[?user=&pwd=&resolution=]
parameters:
user:user name
pwd:password
resolution: image resolution(8:320*240,32:640*480)

videostream.asf
description:ipcamera sends video and audio data in asf stream media format, which supports vlc
player and mplayer.
privilege:visitor
grammar:/videostream.asf[?user=&pwd=&resolution=]
parameters:
user:user name
pwd:password
resolution:image resolution(8:320*240,32:640*480)

get_status.cgi
description:get device status
privilege:none
grammar:/get_status.cgi
parameters:
user:user name
pwd:password
return:
id:device id
sys_ver:firmware version
app_ver:web ui version
alias:device alias
now:the elapsed time (seconds) from 1970-1-1 0:0:0 to the current device time 。
tz:the time difference (seconds) between standard Greenwich mean time and current device time
zone
alarm_status:the current device alarm status, 0:no alarm;1:motion detect alarm;2:I/O input
alarm
ddns_status:the current device ddns status。
0 No operation
1 Connecting
2 Connecting failed
3 Dyndns succeed
4 Dyndns failed:system error
5 Dyndns failed:user and password error
6 Dyndns failed:illegal user
7 DynDns failed: incorrect domain name format
8 DynDns failed: domain name doesn’t exist
9 DynDns failed: domain name doesn’t belong to
you
10 DynDns failed: too many or too few domain
name requests
11 DynDns failed: domain name is blocked for
misuse
12 DynDns failed: server error
13 DynDns failed: no correct response from server
14 Oray failed: no correct response from server
15 Oray failed: user or password error
16 Oray failed: incorrect domain name
17 Oray succeed
18 .. 28 save
29 3322 succeed
30 3322 failed: system error
31 3322 failed: user and password error
32 3322 failed: illegal user
33 3322 failed: incorrect domain name format
34 3322 failed: domain name doesn’t exist
35 3322 failed: domain name doesn’t belong to you
36 3322 failed: too many or too few domain name
requests
37 3322 failed: domain name is blocked for misuse
38 3322 failed: server error
39 3322 failed: no correct response from server
ddns_host:ddns host name
oray_type:oray service type, 0:standard;1:professional
upnp_status:the current device upnp status。
0 No operation
1 succeed
2 System error
3 Network communication error
4 UPnP communication error
5 UpnP rejected,maybe port confliction

get_camera_params.cgi
description:get the camera parameter settings
privilege:visitor
grammar:/get_camera_params.cgi[?user=&pwd=]
parameters:
user:user name
pwd:password
return:
resolution:image resolution,8:qvga;32:vga
brightness:brightness adjust,0~255
contrast:contrast adjust,0~6
mode:working mode,0:50hz;1:60hz;2:outdoor
flip:rotate,0:initial status;1:vertical reverse;2:horizontal mirror;3:vertical reverse
+ horizontal mirror;

decoder_control.cgi
description:decoder control
privilege:operator
grammar:/decoder_control.cgi?command=[&next_url=]
parameters:
command:decoder control command

value 485 serial port connecting with Built-in motor


pelco-d decoder
0 upward upward
1 Stop upward Stop upward
2 downward downward
3 Stop downward Stop downward
4 leftward leftward
5 Stop leftward Stop leftward
6 rightward rightward
7 Stop rightward Stop rightward
8 Iris small
9 Stop iris small
10 Iris large
11 Stop iris large
12 Focus near
13 Stop focus near
14 Focus far
15 Stop focus far
16 Zoom in
17 Stop zoom in
18 Zoom out
19 Stop zoom out
20 Auto navigation
21 Stop auto navigation
22 Switch 1 on
23 Switch 1 off
24 Switch 2 on
25 Switch 2 off center
26 Switch 3 on Vertical navigation
27 Switch 3 off Stop vertical navigation
28 Switch 4 on Horizontal navigation
29 Switch 4 off Stop horizontal navigation
30 Set preset position 1
31 Remove preset position 1
… .
90 . Left top
91 . Right top
92 Set preset position 32 Left bottom
93 Remove preset position 32 Right bottom
94 Io output high Io output high
95 Io output low Io output low
255 Motor test mode

camera_control.cgi
description:camera sensor control
privilege:operator
grammar:/camera_control.cgi?param=&value=[&next_url=]
parameters:
param:parameter type
value:
param value
0 : 8:qvga
resolution 32:vga
1 : 0~255
brightness
2:contrast 0~6
3:working 0:50hz
mode 1:60hz
2:outdoor
5:rotate 0:initial status
1:vertical reverse
2:horizontal mirror
3:vertical reverse + horizontal mirror

reboot.cgi
description:reboot device
privilege:administrator
grammar:/reboot.cgi[?next_url=]
restore_factory.cgi
description:restore factory settings
privilege:administrator
grammar:/restore_factory.cgi[?next_url=]

get_params.cgi
description:get the current device parameter settings
privilege:administrator
grammar:/get_params.cgi
return:
id Device id
sys_ver Firmware version
app_ver Web UI version
alias Device alias
now The elapsed time (second) from 1970-1-1 0:0:0 to the
current device time
tz The time difference between the Greenwich mean time
and current device time zone
ntp_enable 0:ntp time correction disabled;1:enabled
ntp_svr Ntp server
user1_name User1 name
user1_pwd User1 password
user1_pri User1 privilege,0:visitor;1:operator;2:administrator

user8_name User8 name
user8_pwd User8 password
user8_pri User8 privilege
dev2_alias Device2 alias
dev2_host Device2 host
dev2_port Device2 port
dev2_user Device2 user
dev2_pwd Device2 password

dev4_alias Device4 alias
dev4_host Device4 host
dev4_port Device4 port
dev4_user Device4 user
dev4_pwd Device4 password
ip Ip address
mask mask
gateway gateway
dns Dns server
port port
wifi_enable 0:wifi function disabled;1:enabled
wifi_ssid device ssid to be added in wifi network
wifi_channel save
wifi_mode save
wifi_encrypt 0:encryption disabled;1:wep encryption enabled
wifi_authtype wep authentification type,0:open;1:share
wifi_keyformat Wep key format,0:Hexadecimal. number;1:ascii
character
wifi_defkey Wep key select
wifi_key1 Wep key1
wifi_key2 Wep key2
wifi_key3 Wep key3
wifi_key4 Wep key4
wifi_key1_bits Wep key1 length,0:64 bits;1:128 bits
wifi_key2_bits Wep key2 length,0:64 bits;1:128 bits
wifi_key3_bits Wep key3 length,0:64 bits;1:128 bits
wifi_key4_bits Wep key4 length,0:64 bits;1:128 bits
wifi_wpa_psk wpa psk key
pppoe_enable 0:pppoe disabled;1:enabled
pppoe_user Pppoe user
pppoe_pwd Pppoe password
upnp_enable 0:upnp disabled;1:enabled
ddns_service 0:ddns service disabled
1:Oray
2:DynDns.org(dyndns)
3:DynDns.org(statdns)
4:DynDns.org(custom)
5:save
6:save
7:save
8:3322(dyndns)
9:3322(statdns)
ddns_user Ddns user
ddns_pwd Ddns password
ddns_host Ddns domain name
ddns_proxy_svr Proxy ddns server(dyndns service china mainland use
only)
ddns_proxy_port Proxy server port
mail_svr Mail server host
mail_port Mail server port
mail_user Mail user
mail_pwd Mail password
mail_sender Mail sender
mail_receiver1 Mail receiver1
mail_receiver2 Mail receiver2
mail_receiver3 Mail receiver3
mail_receiver4 Mail receiver4
mail_inet_ip Whether send mail to advise when inet ip of the camera
changes, 0:no;1:yes
ftp_svr ftp server host
ftp_port ftp server port
ftp_user ftp server user
ftp_pwd ftp server password
ftp_dir ftp server storage directory
ftp_mode 0:port mode;1:pasv mode
ftp_upload_interval ,0:disabled
Time interval to upload picture(second)
alarm_motion_armed 0:motion detect alarm disarmed;1:armed
alarm_motion_sensitivity 0-9:high-low
alarm_input_armed 0:input alarm disarmed;1:armed
alarm_iolinkage 0:io linkage disabled;1:enabled
alarm_mail 0:mail advise disabled;1:enabled
alarm_upload_interval ,0:disabled
Time interval to upload picture(second)
alarm_schedule_enable Whether enable alarm schedule
alarm_schedule_sun_0 Sunday alarm schedule,24hours per day, 15min per hour
alarm_schedule_sun_1 and 96 periods in total.
alarm_schedule_sun_2 bit0-95:0:disarmed;1:armed
alarm_schedule_mon_0
alarm_schedule_mon_1
alarm_schedule_mon_2
alarm_schedule_tue_0
alarm_schedule_tue_1
alarm_schedule_tue_2
alarm_schedule_wed_0
alarm_schedule_wed_1
alarm_schedule_wed_2
alarm_schedule_thu_0
alarm_schedule_thu_1
alarm_schedule_thu_2
alarm_schedule_fri_0
alarm_schedule_fri_1
alarm_schedule_fri_2
alarm_schedule_sat_0
alarm_schedule_sat_1
alarm_schedule_sat_2

upgrade_firmware.cgi
description:upgrade firmware
privilege:administrator
grammar:/upgrade_firmware.cgi[?next_url=]
explanation:the cgi must use post method to send the upgrading package to ip camera.

upgrade_htmls.cgi
description:upgrade Web UI
privilege:administrator
grammar:/upgrade_htmls.cgi[?next_url=]
explanation:the cgi must use post method to send the upgrading package to ip camera.

set_alias.cgi
description:set device alias
privilege:administrator
grammar:/set_alias.cgi?alias=[&next_url=]
parameters:
alias:device alias,length <= 20

set_datetime.cgi
description:set device date and time
privilege:administrator
grammar:/set_datetime.cgi?tz=&ntp_enable=&ntp_svr=[&now=&next_url=]

parameters:

now The elapsed time (second) from 1970-1-1 0:0:0 to the


current device time. When the parameter is added, the
device will adjust time based on it.
tz Time zone setting : the time difference between the
Greenwich mean time and current device time (second)
ntp_enable 0:ntp time adjustment disabled;1:enabled
ntp_svr Ntp server,length <= 64

set_users.cgi
description:set device user
privilege:administrator
grammar:
/set_users.cgi?user1=&pwd1=&pri1=&user2=&pwd2=&pri2=&user3=&pwd3=&pri3=&use
r4=&pwd4=&pri4=&user5=&pwd5=&pri5=&user6=&pwd6=&pri6=&user7=&pwd7=&pri7
=&user8=&pwd8=&pri8=[&next_url=]

parameters:

user1 user1 name,length<= 12


pwd1 user1 password,length <= 12
pri1 user1 privilege,0:visitor;1:operator;2:administrator

user8 user8 name
pwd8 user8 password
pri8 user8 privilege

set_devices.cgi
description:multi-device settings
privilege:administrator
grammar:
/set_devices.cgi?dev2_alias=&dev2_host=&dev2_port=&dev2_user=&dev2_pwd=&
dev3_alias=&dev3_host=&dev3_port=&dev3_user=&dev3_pwd=&dev4_alias=&dev4_host
=&dev4_port=&dev4_user=&dev4_pwd=[&next_url=]

parameters:

dev2_alias The 2nd device alias,length <= 20


dev2_host The 2nd device host,length <= 64
dev2_port The 2nd device port
dev2_user The 2nd device user,length <= 12
dev2_pwd The 2nd device password,length <= 12

dev4_alias The 4th device alias
dev4_host The 4th device host
dev4_port The 4th device port
dev4_user The 4th device user
dev4_pwd The 4th device password

set_network.cgi
description:basic network settings of the camera
privilege:administrator
grammar:/set_network.cgi?ip=&mask=&gateway=&dns=&port=[&next_url=]

parameters:

ip Ip address of the camera. If it’s null,it will get ip by


DHCP and ignore mask、gateway、dns settings
mask mask
gateway gateway
dns dns server
port port

set_wifi.cgi
description:wifi settings
privilege:administrator
grammar:
/set_wifi.cgi?enable=&ssid=&encrypt=&defkey=&key1=&key2=&key3=&key4=
&authtype=&keyformat=&key1_bits=&key2_bits=&key3_bits=&key4_bits=&channel=&m
ode=&wpa_psk=[&next_url=]

parameters:

enable 0:wifi disabled;1:enabled


ssid Device ssid to be added to wifi network,length <= 40
channel save =5
mode save =0
encrypt 0:encryption disabled;1:wep encryption;2:wpa tkip;
3:wpa aes;4:wpa2 aes;5:wpa2 tkip+aes
authtype wep authentification tpye,0:open;1:share
keyformat Wep key format,0:Hexadecimal. number;1:ascii
character
defkey Default wep key select:0-3
key1 Wep key1,length <= 30
key2 Wep key2
key3 Wep key3
key4 Wep key4
key1_bits Wep key1 length,0:64 bits;1:128 bits
key2_bits Wep key2 length,0:64 bits;1:128 bits
key3_bits Wep key3 length,0:64 bits;1:128 bits
key4_bits Wep key4 length,0:64 bits;1:128 bits
wpa_psk wpa psk key,length <= 64

set_pppoe.cgi
description:PPPoE settings

privilege:administrator
grammar:/set_pppoe.cgi?enable=&user=&pwd=&mail_ip=[&next_url=]
parameters:

enable 0:pppoe disables;1:enabled


user pppoe user,length <= 40
pwd pppoe password,length <= 20

set_upnp.cgi
descritption:upnp settings

privilege:administrator
grammar:/set_upnp.cgi?enable=[&next_url=]
parameters:

enable 0:upnp disabled;1:enabled

set_ddns.cgi
description:ddns settings

privilege:administrator
grammar:
/set_ddns.cgi?service=&user=&pwd=&host=&proxy_svr=&proxy_port=[&restart_dyndns=
&next_url=]
parameters:

service 0:ddns disabled


1:Oray
2:DynDns.org(dyndns)
3:DynDns.org(statdns)
4:DynDns.org(custom)
5:save
6:save
7:save
8:3322(dyndns)
9:3322(statdns)
user Ddns user,length <= 20
pwd Ddns password,length <= 20
host Ddns domain name,length <= 40
proxy_svr Proxy server host ( dyndns service used in China
mainland only),length <= 20
proxy_port Proxy server port
restart_dyndns 1:restart dyndns;0:no

set_ftp.cgi
description:ftp settings

privilege:administrator
grammar:/set_ftp.cgi?svr=&port=&user=&pwd=&mode=&dir=&upload_interval=[&next_url=]
parameters:

svr ftp server host,length <= 64


port ftp server port
user ftp server user,length <= 64
pwd ftp server password,length <= 64
dir ftp server storage directory,length <= 64
mode 0:port mode;1:pasv mode
upload_interval Time interval to upload pictures(second),0:disabled,
0-65535

set_mail.cgi
description:mail settings

privilege:administrator
grammar:
/set_mail.cgi?svr=&user=&pwd=&sender=&receiver1=&receiver2=&receiver3=&receiver4
=[&next_url=]
parameters:

svr Mail server host,length <= 40


port Mail server port
user Mail server user,length <= 20
pwd Mail server password,length <= 20
sender Mail sender,length <= 40
receiver1 Mail receiver1,length <= 40
receiver2 Mail receiver2,length <= 40
receiver3 Mail receiver3,length <= 40
receiver4 Mail receiver4, length <= 40

set_alarm.cgi
description:alarm settings

privilege:administrator
grammar:
/set_alarm.cgi?motion_armed=&input_armed=&iolinkage=&mail=&upload_interval=&
schedule_enable=&schedule_sun_0=&schedule_sun_1=&schedule_sun_2=&schedule_mon_
0=&schedule_mon_1=&schedule_mon_2=&schedule_tue_0=&schedule_tue_1=&schedule_t
ue_2=&schedule_wed_0=&schedule_wed_1=&schedule_wed_2=&schedule_thu_0=&sched
ule_thu_1=&schedule_thu_2=&schedule_fri_0=&schedule_fri_1=&schedule_fri_2=&sched
ule_sat_0=&schedule_sat_1=&schedule_sat_2=[&next_url=]
parameters:

motion_armed 0:motion detect disarmed;1:armed


motion_sensitivity 0-9:high-low
input_armed 0:alarm input disarmed;1:armed
iolinkage 0:io linkage disabled;1:enabled
mail 0:mail advise disabled ;1:enabled
upload_interval ,0:disabled,
Time interval to upload picture(second)
0-65535
schedule_enable Whether enable alarm schedule
schedule_sun_0 Sunday alarm schedule,24hours per day, 15min per hour
schedule_sun_1 and 96 periods in total.
schedule_sun_2 bit0-95:0:disarmed;1:armed
schedule_mon_0
schedule_mon_1
schedule_mon_2
schedule_tue_0
schedule_tue_1
schedule_tue_2
schedule_wed_0
schedule_wed_1
schedule_wed_2
schedule_thu_0
schedule_thu_1
schedule_thu_2
schedule_fri_0
schedule_fri_1
schedule_fri_2
schedule_sat_0
schedule_sat_1
schedule_sat_2

You might also like