HTTP Access (controlling ispy via http requests)

HTTP Server Access

HTTP access is useful for interfacing iSpy 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 ID is provide in the title bar of the "edit camera" or "edit microphone" control AFTER you have added it to the iSpy surface.

You will also need to know the IP address of the device that is sending the HTTP commands. This may be your local computer IP address or the IP address of your IP camera.

You will need to add this IP address into the list of Allowed IP addresses on the Settings panel. This list takes a comma seperated list of IP addresses, for example:

192.168.1.10,192.168.1.11 or use a wildcard: 192.168.1.* or just .* to allow everything (not recommended!)

Once this has been added, HTTP requests from those IP addresses will be allowed access to control iSpy.

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

You can find your IP address and Port in web settings. OBJECT_TYPE is either a 1 for a microphone or a 2 for a camera. The OBJECT_ID is provided in the title bar of the camera or microphone when editing it.

Available commands

These commands can be called over HTTP or the command line. Where Specific Object is Yes that means you must pass in the object type id and the object id (as above). Where All Objects is Yes that means the object id/ type is optional and if not supplied the command will affect all objects. For example to record via the command line you'd type ispy.exe commands "record,2,0". Whereas with HTTP you'd use http://yourserver:port/record?ot=2&oid=0. To record all objects you'd use ispy.exe commands "record" or with HTTP: http://yourserver:port/record
CommandSpecific ObjectAll ObjectsNotes
connectNoNoReturns CSV of the current authentication code and "OK"
recordswitchYesNoStarts or stops recording depending on the current state. Returns "recording,OK" or "notrecording,OK"
alertYesNoTrigger the alert on the specified object. Returns "OK"
recordYesYesStarts recording on the specified object. Returns "recording,OK"
recordstopYesYesStops recording on the specified object. Returns "notrecording,OK"
pingNoNoReturns "OK" - use this to check the ispy server is alive
allonNoNoSwitch all objects on. Returns "OK".
alloffNoNoSwitch all objects off. Returns "OK".
recordondetectonYesYesSwitches on Record on Detect mode (switches off Record on Alert mode)
snapshotYesYesTake a frame snapshot of the specified camera and save it to the grabs directory
shutdownNoNoShutdown iSpy
recordonalertonYesYesSwitches on Record on Alert mode (switches off Record on Detect mode)
recordingoffYesYesSwitches off all recording modes
alertonYesYesEnables alerts
alertoffYesYesDisables alerts
allscheduleonNoNoSwitch all scheduled objects on
allscheduleoffNoNoSwitch all scheduled objects off
applyscheduleNoNoApply schedule to all objects
bringonlineYesNoEnable object
takeofflineYesNoDisable object
deleteallYesNoDelete all files for the specified object
removeobjectYesNoRemoves the specified object
startlistenYesNoStarts playing the specified mic feed out over the local audio device
stoplistenYesNoStops playing the specified mic feed out over the local audio device
starttalkYesNoStarts talking to the specified camera (talking will also start listening if available)
stoptalkYesNoStops talking to the specified camera

HTTP access only:

You call these commands directly on the local server, for example http://localhost:8080/thecommand - ensure the computer that you are accessing ispy from has access permissions.
setmaskYesNoSets the filename for the mask overlay for the specified camera. Eg: setmask?ot=2 &oid=0 & fn=C:\somefile.png
executecmdNoNoExecute a remote command. Eg: executecmd?id=0
deletefileYesNoDelete the video file. Eg: deletefile?ot=1 &oid=0 &fn=filename_without_path.mp4
playfileYesNoPlay the video file. Eg: playfile?ot=1 &oid=0 &fn=filename_without_path.mp4
uploadyoutubeYesNoUpload the video file to youtube. Eg uploadyoutube?ot=2 &oid=0 &fn=filename_without_path.mp4 &public=false
addobjectNoNoAdd an object to ispy. Specify the source type in the stid. 0 is JPEG, 1 is MJPEG, 2 is FFMPEG. Eg: addobject?stid=0 &w=320 & h=240 & name=cool_new_cam & url=http://www.somecam.com/cam.jpg
synthtocamYesNoPass text to ispy to speak out of the camera speaker. Eg: synthtocam?ot=2 &oid=0 &text=hello
changesettingYesNoChanges individual settings for the camera. Too much to list here, see the ProcessCommandInternal method in LocalServer.cs in the iSpy source code for details.
getcontentlistYesNoReturns a comma and pipe delimited list of captured files for the object. Pass startdate and enddate as numeric ticks. Eg: getcontentlist?ot=2 &oid=0 &page=0 & startdate=17000000 &enddate=18000000 &pagesize=20 &ordermode=0
getcontentcountsNoYesReturns a comma and pipe delimited list of counts of files for the object. Pass startdate and enddate as numeric ticks. Eg: getcontentcounts? startdate=17000000 & enddate=18000000
getfloorplanalertsNoYesReturns a comma and pipe delimited list of current floorplan alerts. Returns FloorPlanID, LastAlertTimeStamp, LastRefreshTimeStamp, LastObjectID, LastObjectTypeID
getfloorplansNoNoReturns a comma and pipe and ^ delimited list of floorplans and associated objects
getgraphYesNoReturns a JSON array of activity data for the specified file for the specified object. Eg: getgraph?ot=2 & oid=0 & fn=filename_without_path.mp4 & jsfunc=RenderGraph(data,duration,threshold)
graphallNoYesReturns a JSON array of activity data for the specified object. Eg: graphall?ot=2 &oid=0 & startdate=17000000 & enddate=18000000 & jsfunc=RenderGraph(data)
getgrabsNoYesReturns a JSON array of frame grabs for the specified object. Eg: getgrabs?startdate=17000000 & enddate=18000000 & jsfunc=RenderGrabs(data)
getptzcommandsYesNoReturns an HTML list of options for extended PTZ commands for the specified PTZ entry. Eg: getptzcommands?ptzid=0 &oid=0
massdeletegrabsYesNoDeletes a bulk list of frame grabs for the specified object. Eg: massdeletegrabs?ot=2 &oid=0 & filelist=file1.jpg|file2.jpg|file3.jpg|...
massdeleteYesNoDeletes a bulk list of video files for the specified object. Eg: massdelete?ot=2 &oid=0 & filelist= file1.mp4|file2.mp4|file3...
getobjectlistNoNoReturns a detailed configuration for all running objects in CSV format. See LocalServer.cs Method GetObjectList() for details.
getcontrolpanelYesNoReturns an HTML TABLE to render for the control panel for the object. You need to pass in the server port for this request. Eg: getcontrolpanel?port=8080 & ot=2 &oid=0
getcmdlistNoNoReturns a comma and pipe delimited list of available remote commands.
previewlistNoNoReturns a comma and pipe delimited list of available files in the media panel.
kinect_tilt_upYesNoTilts the specified device up by 4 degrees
kinect_tilt_downYesNoTilts the specified device down by 4 degrees
livefeedYesNoReturns a jpg image from the specified camera
togglealertmodeYesNoToggles the alert mode for the specified device (movement/ no movement or sound/ no sound)
triggeralarmYesNoTriggers the alarm for the specified device
triggerdetectYesNoTriggers the motion detector for the specified device (to use this to link your cameras on-board motion detector options to ispy, set ispy motion detector to none and add the cameras ip address to the allowed list in ispy settings)
triggerpluginYesNoTriggers the plugin to process the next frame (only works when the alerts mode is set to trigger)
video.mjpgYesNoReturns an mjpeg multi video feed of the specified devices for example http://ip:port/video.mjpg?oid=1,2,3,4 &size=640x480 &keepAR=true &overlay=false
video.mjpgYesNoReturns an mjpeg video feed of the specified device for example http://ip:port/video.mjpg?oid=1
setframerateYesNoSet the max framerate of the specified object (add &rate=5 to set to 5)
setrecordingframerateYesNoSet the max framerate when recording of the specified object (add &rate=10 to set to 10)

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/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.