General: HTTP Access
About
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 | |||
Command | Specific Object | All Objects | Notes |
---|---|---|---|
connect | No | No | Returns CSV of the current authentication code and "OK" |
recordswitch | Yes | No | Starts or stops recording depending on the current state. Returns "recording,OK" or "notrecording,OK" |
alert | Yes | No | Trigger the alert on the specified object. Returns "OK" |
record | Yes | Yes | Starts recording on the specified object. Returns "recording,OK" |
recordstop | Yes | Yes | Stops recording on the specified object. Returns "notrecording,OK" |
ping | No | No | Returns "OK" - use this to check the ispy server is alive |
allon | No | No | Switch all objects on. Returns "OK". |
alloff | No | No | Switch all objects off. Returns "OK". |
recordondetecton | Yes | Yes | Switches on Record on Detect mode (switches off Record on Alert mode) |
snapshot | Yes | Yes | Take a frame snapshot of the specified camera and save it to the grabs directory |
shutdown | No | No | Shutdown iSpy |
recordonalerton | Yes | Yes | Switches on Record on Alert mode (switches off Record on Detect mode) |
recordingoff | Yes | Yes | Switches off all recording modes |
alerton | Yes | Yes | Enables alerts |
alertoff | Yes | Yes | Disables alerts |
allscheduleon | No | No | Switch all scheduled objects on |
allscheduleoff | No | No | Switch all scheduled objects off |
applyschedule | No | No | Apply schedule to all objects |
bringonline | Yes | No | Enable object |
takeoffline | Yes | No | Disable object |
deleteall | Yes | No | Delete all files for the specified object |
removeobject | Yes | No | Removes the specified object |
startlisten | Yes | No | Starts playing the specified mic feed out over the local audio device |
stoplisten | Yes | No | Stops playing the specified mic feed out over the local audio device |
starttalk | Yes | No | Starts talking to the specified camera (talking will also start listening if available) |
stoptalk | Yes | No | Stops 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. | |||
setmask | Yes | No | Sets the filename for the mask overlay for the specified camera. Eg: setmask?ot=2 &oid=0 & fn=C:\somefile.png |
executecmd | No | No | Execute a remote command. Eg: executecmd?id=0 |
deletefile | Yes | No | Delete the video file. Eg: deletefile?ot=1 &oid=0 &fn=filename_without_path.mp4 |
playfile | Yes | No | Play the video file. Eg: playfile?ot=1 &oid=0 &fn=filename_without_path.mp4 |
uploadyoutube | Yes | No | Upload the video file to youtube. Eg uploadyoutube?ot=2 &oid=0 &fn=filename_without_path.mp4 &public=false |
addobject | No | No | Add 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 |
synthtocam | Yes | No | Pass text to ispy to speak out of the camera speaker. Eg: synthtocam?ot=2 &oid=0 &text=hello |
changesetting | Yes | No | Changes individual settings for the camera. Too much to list here, see the ProcessCommandInternal method in LocalServer.cs in the iSpy source code for details. |
getcontentlist | Yes | No | Returns 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 |
getcontentcounts | No | Yes | Returns 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 |
getfloorplanalerts | No | Yes | Returns a comma and pipe delimited list of current floorplan alerts. Returns FloorPlanID, LastAlertTimeStamp, LastRefreshTimeStamp, LastObjectID, LastObjectTypeID |
getfloorplans | No | No | Returns a comma and pipe and ^ delimited list of floorplans and associated objects |
getgraph | Yes | No | Returns 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) |
graphall | No | Yes | Returns a JSON array of activity data for the specified object. Eg: graphall?ot=2&oid=0&startdate=17000000&enddate=18000000&jsfunc=RenderGraph(data) |
getgrabs | No | Yes | Returns a JSON array of frame grabs for the specified object. Eg: getgrabs?startdate=17000000&enddate=18000000&jsfunc=RenderGrabs(data) |
getptzcommands | Yes | No | Returns an HTML list of options for extended PTZ commands for the specified PTZ entry. Eg: getptzcommands?ptzid=0 &oid=0 |
massdeletegrabs | Yes | No | Deletes a bulk list of frame grabs for the specified object. Eg: massdeletegrabs?ot=2&oid=0&filelist=file1.jpg|file2.jpg|file3.jpg|... |
massdelete | Yes | No | Deletes a bulk list of video files for the specified object. Eg: massdelete?ot=2&oid=0&filelist= file1.mp4|file2.mp4|file3... |
getobjectlist | Yes | Yes | Returns a detailed configuration for all running objects in CSV format. See LocalServer.cs Method GetObjectList() for details. |
getcontrolpanel | Yes | No | Returns 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 |
getcmdlist | No | No | Returns a comma and pipe delimited list of available remote commands. |
previewlist | No | No | Returns a comma and pipe delimited list of available files in the media panel. |
kinect_tilt_up | Yes | No | Tilts the specified device up by 4 degrees |
kinect_tilt_down | Yes | No | Tilts the specified device down by 4 degrees |
livefeed | Yes | No | Returns a jpg image from the specified camera |
togglealertmode | Yes | No | Toggles the alert mode for the specified device (movement/ no movement or sound/ no sound) |
triggeralarm | Yes | No | Triggers the alarm for the specified device |
triggerdetect | Yes | No | Triggers 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) |
triggerplugin | Yes | No | Triggers the plugin to process the next frame (only works when the alerts mode is set to trigger) |
video.mjpg | Yes | No | Returns 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.mjpg | Yes | No | Returns an mjpeg video feed of the specified device for example http://ip:port/video.mjpg?oid=1 |
setframerate | Yes | No | Set the max framerate of the specified object (add &rate=5 to set to 5) |
setrecordingframerate | Yes | No | Set 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.