Foscam IPCamera CGI User Guide
Foscam IPCamera CGI User Guide
Copyright@ Shenzhen Foscam Intelligent Technology Limited
Foscam IPCamera CGI User Guide
Contents
General description ........................................................................................................................ 1
AV Function ..................................................................................................................................... 2
getImageSetting...................................................................................................................... 2
setBrightness .......................................................................................................................... 2
setContrast .............................................................................................................................. 2
setHue ...................................................................................................................................... 3
setSaturation ........................................................................................................................... 3
setSharpness .......................................................................................................................... 3
resetImageSetting .................................................................................................................. 4
getMirrorAndFlipSetting ......................................................................................................... 4
mirrorVideo .............................................................................................................................. 4
flipVideo ................................................................................................................................... 5
setPwrFreq .............................................................................................................................. 5
getVideoStreamParam........................................................................................................... 5
setVideoStreamParam ........................................................................................................... 6
getMainVideoStreamType ..................................................................................................... 6
getSubVideoStreamType....................................................................................................... 6
setMainVideoStreamType ..................................................................................................... 7
setSubVideoStreamType ....................................................................................................... 7
GetMJStream .......................................................................................................................... 8
getOSDSetting ........................................................................................................................ 8
setOSDSetting ........................................................................................................................ 8
getOsdMaskArea .................................................................................................................... 9
setOsdMaskArea .................................................................................................................... 9
getMotionDetectConfig .......................................................................................................... 9
setMotionDetectConfig ........................................................................................................ 10
getSnapConfig ...................................................................................................................... 12
setSnapConfig ...................................................................................................................... 12
snapPicture ........................................................................................................................... 13
snapPicture2 ......................................................................................................................... 13
getRecordList ........................................................................................................................ 13
getAlarmRecordConfig ........................................................................................................ 14
setAlarmRecordConfig ........................................................................................................ 14
setIOAlarmConfig ................................................................................................................. 14
getIOAlarmConfig ................................................................................................................. 15
clearIOAlarmOutput ............................................................................................................. 15
getMultiDevList ..................................................................................................................... 16
getMultiDevDetailInfo ........................................................................................................... 16
addMultiDev .......................................................................................................................... 16
delMultiDev ............................................................................................................................ 17
User account ................................................................................................................................. 17
addAccount ........................................................................................................................... 17
delAccount ............................................................................................................................. 18
Copyright@ Shenzhen Foscam Intelligent Technology Limited
Foscam IPCamera CGI User Guide
changePassword .................................................................................................................. 18
changeUserName ................................................................................................................ 18
logIn ........................................................................................................................................ 19
logOut ..................................................................................................................................... 19
getSessionList ....................................................................................................................... 20
getUserList ............................................................................................................................ 20
usrBeatHeart ........................................................................................................................... 20
PTZ Control ................................................................................................................................... 21
ptzMoveUp ............................................................................................................................ 21
ptzMoveDown ....................................................................................................................... 21
ptzMoveLeft ........................................................................................................................... 21
ptzMoveRight ........................................................................................................................ 22
ptzMoveTopLeft .................................................................................................................... 22
ptzMoveTopRight .................................................................................................................. 22
ptzMoveBottomLeft .............................................................................................................. 22
ptzMoveBottomRight ............................................................................................................ 23
ptzStopRun ............................................................................................................................ 23
ptzReset ................................................................................................................................. 23
getPTZSpeed ........................................................................................................................ 24
setPTZSpeed ........................................................................................................................ 24
getPTZPresetPointList ......................................................................................................... 24
ptzAddPresetPoint................................................................................................................ 25
ptzDeletePresetPoint ........................................................................................................... 25
ptzGotoPresetPoint .............................................................................................................. 25
ptzGetCruiseMapList ........................................................................................................... 26
ptzGetCruiseMapInfo ........................................................................................................... 26
ptzSetCruiseMap .................................................................................................................. 26
ptzDelCruiseMap .................................................................................................................. 27
ptzStartCruise........................................................................................................................ 27
ptzStopCruise ........................................................................................................................ 27
zoomIn ................................................................................................................................... 27
zoomOut ................................................................................................................................ 28
zoomStop ............................................................................................................................... 28
getZoomSpeed ..................................................................................................................... 28
setZoomSpeed ...................................................................................................................... 29
setPTZSelfTestMode ............................................................................................................ 29
getPTZSelfTestMode ........................................................................................................... 29
setPTZPrePointForSelfTest ................................................................................................ 30
getPTZPrePointForSelfTest ................................................................................................ 30
set485Info .............................................................................................................................. 30
get485Info .............................................................................................................................. 31
Network .......................................................................................................................................... 31
getIPInfo ................................................................................................................................. 31
setIpInfo ................................................................................................................................. 32
Copyright@ Shenzhen Foscam Intelligent Technology Limited
Foscam IPCamera CGI User Guide
refreshWifiList ....................................................................................................................... 32
getWifiList .............................................................................................................................. 32
setWifiSetting ........................................................................................................................ 33
getWifiConfig ......................................................................................................................... 34
getPortInfo ............................................................................................................................. 35
setPortInfo ............................................................................................................................. 35
getUPnPConfig ..................................................................................................................... 36
setUPnPConfig ..................................................................................................................... 36
getDDNSConfig .................................................................................................................... 36
setDDNSConfig .................................................................................................................... 37
setFtpConfig .......................................................................................................................... 37
getFtpConfig .......................................................................................................................... 38
testFtpServer ......................................................................................................................... 38
getSMTPConfig .................................................................................................................... 38
setSMTPConfig ..................................................................................................................... 39
smtpTest ................................................................................................................................. 40
Device manage ............................................................................................................................. 40
setSystemTime ..................................................................................................................... 40
getSystemTime ..................................................................................................................... 41
openInfraLed ......................................................................................................................... 42
closeInfraLed ......................................................................................................................... 42
getInfraLedConfig ................................................................................................................. 43
setInfraLedConfig ................................................................................................................. 43
getDevState ........................................................................................................................... 43
getDevName ......................................................................................................................... 44
setDevName ......................................................................................................................... 45
getDevInfo ............................................................................................................................. 45
System ........................................................................................................................................... 46
rebootSystem ........................................................................................................................ 46
restoreToFactorySetting ...................................................................................................... 46
exportConfig .......................................................................................................................... 46
ImportConfig .......................................................................................................................... 47
FwUpgrade ............................................................................................................................ 47
MISC .............................................................................................................................................. 48
getFirewallConfig .................................................................................................................. 48
setFirewallConfig .................................................................................................................. 48
getLog .................................................................................................................................... 48
Copyright@ Shenzhen Foscam Intelligent Technology Limited
History
Add the following CGI command to set PT
startup position:
1) setPTZSelfTestMode
2) getPTZSelfTestMode
3) setPTZPrePointForSelfTest
4) getPTZPrePointForSelfTest
1. Add a snap CGI(snapPicture2) which
retrun jpeg image data directly but a
image url
2. Add MotionJpeg stream support
Check and Modify CGI command
document
Foscam IPCamera CGI User Guide
Copyright@ Shenzhen Foscam Intelligent Technology Limited
Foscam IPCamera CGI User Guide
CGI request string format error
Username or password error
General description
Our device can only support authentication by pass user name or password attached
at CGI request string currentlly.
For example:
http://192.168.1.2/cgi-bin/CGIProxy.fcgi&usr=admin&pwd=123&cmd=ABC
We only support GET and POST method. Only importConfig and fwUpgrade can
support POST method.
The cgi request string must be encode in url format. URL encode rule:
The following chars will not be encoded:
[A~Z] [a~z] [0~9] + @ * /
The other chars will be encoded into hex format.
For example:
http://192.168.1.6:88/cgi-bin/CGIProxy.fcgi?usr=admin&pwd=&cmd=getIPInfo
will be encode to:
http://192.168.1.6:88/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3D%26cmd%3DgetIPInfo
cgi execute result
1) We orgnize the cgi execute result as xml format, for example:
<CGI_Result>
<result>0</result>
<isDHCP>1</isDHCP>
<ip>192.168.1.8</ip>
<gate>0.0.0.0</gate>
<mask>255.255.255.0</mask>
<dns1>0.0.0.0</dns1>
<dns2>0.0.0.0</dns2>
</CGI_Result>
<result></result> means the common execute result
Copyright@ Shenzhen Foscam Intelligent Technology Limited
Foscam IPCamera CGI User Guide
Get color attribute of video
/cgi-bin/CGIProxy.fcgi?cmd=getImageSetting
/cgi-bin/CGIProxy.fcgi?cmd=getImageSetting&usr=admin&pwd=
/cgi-bin/CGIProxy.fcgi?cmd=setBrightness
/cgi-bin/CGIProxy.fcgi?cmd=setBrightness&brightness=50&usr=admin&
pwd=
/cgi-bin/CGIProxy.fcgi?cmd=setContrast
AV Function
getImageSetting
setBrightness
setContrast
Copyright@ Shenzhen Foscam Intelligent Technology Limited
Foscam IPCamera CGI User Guide
/cgi-bin/CGIProxy.fcgi?cmd=setContrast&contrast=50&usr=admin&pwd
=
/cgi-bin/CGIProxy.fcgi?cmd=setHue
/cgi-bin/CGIProxy.fcgi?cmd=setHue&hue=50&usr=admin&pwd=
/cgi-bin/CGIProxy.fcgi?cmd=setSaturation
/cgi-bin/CGIProxy.fcgi?cmd=setSaturation&saturation=50&usr=admin&
pwd=
/cgi-bin/CGIProxy.fcgi?cmd=setSharpness
/cgi-bin/CGIProxy.fcgi?cmd=setSharpness&sharpness=50&usr=admin&
pwd=
setHue
setSaturation
setSharpness
Copyright@ Shenzhen Foscam Intelligent Technology Limited
Foscam IPCamera CGI User Guide
Reset color parameters to default value
/cgi-bin/CGIProxy.fcgi?cmd=resetImageSetting
/cgi-bin/CGIProxy.fcgi?cmd=resetImageSetting&usr=admin&pwd=
Get mirror and flip attribute of video
/cgi-bin/CGIProxy.fcgi?cmd=getMirrorAndFlipSetting
/cgi-bin/CGIProxy.fcgi?cmd=getMirrorAndFlipSetting&usr=admin&pwd=
/cgi-bin/CGIProxy.fcgi?cmd=mirrorVideo
/cgi-bin/CGIProxy.fcgi?cmd=mirrorVideo&usr=admin&pwd=
resetImageSetting
getMirrorAndFlipSetting
mirrorVideo
Copyright@ Shenzhen Foscam Intelligent Technology Limited
Foscam IPCamera CGI User Guide
/cgi-bin/CGIProxy.fcgi?cmd=flipVideo
/cgi-bin/CGIProxy.fcgi?cmd=flipVideo&usr=admin&pwd=
/cgi-bin/CGIProxy.fcgi?cmd=setPwrFreq
/cgi-bin/CGIProxy.fcgi?cmd=setPwrFreq&freq=0&usr=admin&pwd=
/cgi-bin/CGIProxy.fcgi?cmd=getVideoStreamParam
Resolution of stream type N
Bit rate of stream type N (20480~2097152)
Frame rate of stream type N
P frames between I frame of stream type N
/cgi-bin/CGIProxy.fcgi?cmd=getVideoStreamParam&usr=admin&pwd=
flipVideo
setPwrFreq
getVideoStreamParam
Copyright@ Shenzhen Foscam Intelligent Technology Limited
Foscam IPCamera CGI User Guide
Set the video stream param of stream N
/cgi-bin/CGIProxy.fcgi?cmd=setVideoStreamParam
Resolution of stream type N
Bit rate of stream type N (20480~2097152)
Frame rate of stream type N
P frames between I frame of stream type N
The suggest value is: X * frameRate
/cgi-bin/CGIProxy.fcgi?cmd=setVideoStreamParam&streamType=0&res
olution=0&bitRate=2097152&frameRate=30&GOP=30&isVBR=0&usr=a
dmin&pwd=
Get the stream type of main stream
/cgi-bin/CGIProxy.fcgi?cmd=getMainVideoStreamType
/cgi-bin/CGIProxy.fcgi?cmd=getMainVideoStreamType&usr=admin&pw
d=
Get the stream type of sub stream
/cgi-bin/CGIProxy.fcgi?cmd=getSubVideoStreamType
setVideoStreamParam
getMainVideoStreamType
getSubVideoStreamType
Copyright@ Shenzhen Foscam Intelligent Technology Limited
Foscam IPCamera CGI User Guide
/cgi-bin/CGIProxy.fcgi?cmd=getSubVideoStreamType&usr=admin&pwd
=
Set the stream type of main stream
/cgi-bin/CGIProxy.fcgi?cmd=setMainVideoStreamType
/cgi-bin/CGIProxy.fcgi?cmd=setMainVideoStreamType&streamType=0&usr=admi
n&pwd=
Set the stream format of sub stream
/cgi-bin/CGIProxy.fcgi?cmd=setSubVideoStream 统一
Our device can only support 2 streams:Main stream for PC access and Sub
stream for mobile access, but someone need a MJ stream to embed their camera
into a webpage, in this case, we should set sub stream format to Motion Jpeg,
and then you can get MJ stream by command:
/cgi-bin/CGIStream.cgi?cmd=GetMJStream, but when you login as a sub stream
user, the stream data will be same as main stream.
/cgi-bin/CGIProxy.fcgi?cmd=setSubVideoStreamType&format=0&usr=admin&pw
d=
setMainVideoStreamType
setSubVideoStreamType
Copyright@ Shenzhen Foscam Intelligent Technology Limited
Foscam IPCamera CGI User Guide
/cgi-bin/CGIStream.cgi?cmd=GetMJStream
1) Motion jpeg stream data is returned from http server by a serverpush mode
2) MJ stream is VGA resolution @ 15fps
/cgi-bin/CGIStream.cgi?cmd=GetMJStream&usr=admin&pwd=
/cgi-bin/CGIProxy.fcgi?cmd=getOSDSetting
Time stamp will display on screen or not
Camera name will display on screen or not
OSD display position, currently can only be 0
/cgi-bin/CGIProxy.fcgi?cmd=getOSDSetting&usr=admin&pwd=
/cgi-bin/CGIProxy.fcgi?cmd=setOSDSetting
Time stamp will display on screen or not
Camera name will display on screen or not
OSD display position, currently can only be 0
/cgi-bin/CGIProxy.fcgi?cmd=setOSDSetting&isEnableTimeStamp=1&isEnable
DevName=1&dispPos=0&isEnableOSDMask=0&usr=admin&pwd=
GetMJStream
getOSDSetting
setOSDSetting
Copyright@ Shenzhen Foscam Intelligent Technology Limited
Foscam IPCamera CGI User Guide
/cgi-bin/CGIProxy.fcgi?cmd=getOsdMaskArea
The top left X position of mask N
The top left Y position of mask N
The bottom right X position of mask N
The bottom right Y position of mask N
Our device can only support 4 mask areas
/cgi-bin/CGIProxy.fcgi?cmd=getOsdMaskArea&usr=admin&pwd=
/cgi-bin/CGIProxy.fcgi?cmd=setOsdMaskArea
The top left X position of mask N
The top left Y position of mask N
The bottom right X position of mask N
The bottom right Y position of mask N
Our device can only support 4 mask areas
/cgi-bin/CGIProxy.fcgi?cmd=setOsdMaskArea&x1_0=100&y1_0=100&x2_0=2
00&y2_0=200&x1_1=0&y1_1=0&x2_1=0&y2_1=0&x1_2=0&y1_2=0&x2_2=0
&y2_2=0&x1_3=0&y1_3=0&x2_3=0&y2_3=0&usr=admin&pwd=
/cgi-bin/CGIProxy.fcgi?cmd=getMotionDetectConfig
Is enable motion detect alarm
Motion alarm linkage
( bit3 | bit2 | bit1 | bit0 )
getOsdMaskArea
setOsdMaskArea
getMotionDetectConfig
Copyright@ Shenzhen Foscam Intelligent Technology Limited
Foscam IPCamera CGI User Guide
The interval time to snap picture again
Motion detect
sensitivity
The time of which motion detect alaram
can trigger again when a motion
detection has happened.
The motion alaram schedule of one week,
N = 0(Monday) ~6(Sunday)
For detail, see *1 bellow
The area info of row N
For detail, see *2 bellow
·Video region is divided into 10*10 sub areasideo region is divided into 10*10
sub areas
·The min unit of schedule is half an hour
/cgi-bin/CGIProxy.fcgi?cmd=getMotionDetectConfig&usr=admin&pwd=
/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig
Is enable motion detect alarm
Motion alarm linkage
( bit3 | bit2 | bit1 | bit0 )
The interval time to snap picture again
Motion detect
sensitivity
The time of which motion detect alaram
setMotionDetectConfig
Copyright@ Shenzhen Foscam Intelligent Technology Limited
Foscam IPCamera CGI User Guide
can trigger again when a motion
detection has happened.
The motion alaram schedule of one week,
N = 0(Monday) ~6(Sunday)
For detail, see *1 bellow
The area info of row N
For detail, see *2 bellow
·Video region is divided into 10*10 sub areasideo region is divided into 10*10
sub areas
·The min unit of schedule is half an hour
/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=1&linkage=16&
snapInterval=2& sensitivity=1&triggerInterval=5 &schedule0=1024&schedule1
=1024&schedule2=1024&schedule3=1024&schedule4=1024&schedule5=102
4&schedule6=1024&area0=1024&area1=1024&area2=1024&area3=1024&ar
ea4=1024&area5=1024&area6=1024&area7=1024&area7=1024&area8=1024
&area9=1024&usr=admin&pwd=
*1 schedule bitmap
Each grid of a row presents half of an hour of one day. For example, 40 presents 20:00
~20:30.
The bit 40 set to “1” means the motion detection is effective between 20:00 to 20:30
*2 area bitmap
Copyright@ Shenzhen Foscam Intelligent Technology Limited
Foscam IPCamera CGI User Guide
/cgi-bin/CGIProxy.fcgi?cmd=getSnapSetting
/cgi-bin/CGIProxy.fcgi?cmd=getSnapConfig&usr=admin&pwd=
/cgi-bin/CGIProxy.fcgi?cmd=setSnapSetting
/cgi-bin/CGIProxy.fcgi?cmd=setSnapConfig&usr=admin&pwd=&snapPicQuali
ty=1&saveLocation=2
The video region is divided into 10*10 sub areas, bit0 above present the first area, when
this bit is set to “1”, it means motion detection is effective on this area.
getSnapConfig
setSnapConfig
Copyright@ Shenzhen Foscam Intelligent Technology Limited