HTTP Access (controlling Agent via http requests)

HTTP Server Access

HTTP access is useful for interfacing Agent with external triggers (like trip wires/ temperature sensors etc), other running applications and moderate to high-end IP cameras that have their own motion detection code built in (useful to reduce the CPU load of ispy on your computer).

Before you start using HTTP access you will need to know the ID of them camera or microphone that you want to control.

The HTTP format follows the pattern "http://IPADDRESS:PORT/command.cgi?cmd=COMMAND&ot=OBJECT_TYPE&oid=OBJECT_ID

The IP address is the IP address of the computer running Agent. The PORT is the local server port that Agent is using. You can set this in Server Settings on the web portal. The default is 8090. OBJECT_TYPE is either 1 for a microphone or 2 for a camera. The OBJECT_ID is provided in the objects list when you click on a Server in the web portal.

Available commands

These commands can be called over HTTP. For example to record via HTTP you'd use http://yourserver:port/command.cgi?cmd=record&ot=2&oid=1. To record all objects you'd use http://yourserver:port/command.cgi?cmd=record
CommandNotes
recordswitchStarts or stops recording depending on the current state. Returns "recording,OK" or "notrecording,OK"
alertTrigger the alert on the specified object. Returns "OK"
recordStarts recording on the specified object. Returns "recording,OK"
recordstopStops recording on the specified object. Returns "notrecording,OK"
pingReturns "OK" - use this to check the ispy server is alive
allonSwitch all objects on. Returns "OK".
alloffSwitch all objects off. Returns "OK".
recordondetectonSwitches on Record on Detect mode (switches off Record on Alert mode)
snapshotTake a frame snapshot of the specified camera and save it to the grabs directory
recordonalertonSwitches on Record on Alert mode (switches off Record on Detect mode)
recordingoffSwitches off all recording modes
alertonEnables alerts
alertoffDisables alerts
applyscheduleApply schedule to all objects
switchonEnable object
switchoffDisable object

Using groups in place of object IDs

You can also use group names in place of object ids for commands - for example to switch alerts on for a group called "office" you'd do:

http://IPADDRESS:PORT/command.cgi?cmd=alerton&group=office

- this will switch alert mode on for all cameras and microphones with the group name "office". You can set the group name for cameras and microphones on the first tab when editing them.

Video

You can generate an MJPEG stream by using video.mjpg?oids=1,2,3&size=320x240

Stills

You can get a still image by using grab.jpg?oid=1&size=320x240

PTZ

You can control the PTZ attached to the camera by calling ptz.cgi?oid=1&dir=x

Where x is:

  • 0: Center
  • 1: Left
  • 2: Up Left
  • 3: Up
  • 4: Up Right
  • 5: Right
  • 6: Down Right
  • 7: Down
  • 8: Down Left
  • 9: Zoom In
  • 10: Zoom Out
  • 11: Stop