API Access

Your [API KEY] can be found in API in the dashboard menu. Responses to HTTP Requests return as JSON strings. Group Key can be found in the Settings window.

[API KEY] Can also be your logged in auth_token as well as the API Access key.

Login by API - Get Temporary API Key

Provide your login credentials. machineID can be anything.

$.post('http://xxx.xxx.xxx.xxx/?json=true',{machineID: "fMUVxYdG1X3hWb7GNkTd", mail: "[email protected]", pass: "123", function: "dash"},function(d){
console.log(d.$user)
})
  • mail : Address used to login.
  • pass : Password associated to the account being used to login.
  • ke : Group Key, this can be found in Settings.
  • machineID : The unique string used to identify a machine when using 2-Factor Authentication.

If you have 2-Factor Authentication enabled you will need to pass a second gate. machineID must be the same as the one used at the first gate.

$.post('http://xxx.xxx.xxx.xxx/?json=true',{ke: "2Df5hBE", id: "XDf5hB3", machineID: "fMUVxYdG1X3hWb7GNkTd", factorAuthKey: "123456"},function(d){
console.log(d.$user)
})
  • id : User ID, this can be found after login.
  • factorAuthKey : The key you will receive to pass the verification for your account.

Get Streams

JPEG Snapshot. Snapshot must be enabled in Monitor Settings.

http://xxx.xxx.xxx.xxx/[API KEY]/jpeg/[GROUP KEY]/[MONITOR ID]/s.jpg

MJPEG Stream. Stream type must be MJPEG.

http://xxx.xxx.xxx.xxx/[API KEY]/mjpeg/[GROUP KEY]/[MONITOR ID]

MJPEG for iframe.

http://xxx.xxx.xxx.xxx/[API KEY]/mjpeg/[GROUP KEY]/[MONITOR ID]/full

m3u8 for HLS Stream. Stream type must be HLS.

http://xxx.xxx.xxx.xxx/[API KEY]/hls/[GROUP KEY]/[MONITOR ID]/s.m3u8

Getting Monitors

Get all saved monitors

http://xxx.xxx.xxx.xxx/[API KEY]/monitor/[GROUP KEY]

This method will get all started monitors

http://xxx.xxx.xxx.xxx/[API KEY]/smonitor/[GROUP KEY]

Get a single monitor by ID

http://xxx.xxx.xxx.xxx/[API KEY]/monitor/[GROUP KEY]/[MONITOR ID]

Getting Videos

Get videos for group key

http://xxx.xxx.xxx.xxx/[API KEY]/videos/[GROUP KEY]

Get videos for monitor ID

http://xxx.xxx.xxx.xxx/[API KEY]/videos/[GROUP KEY]/[MONITOR ID]

Get video file

http://xxx.xxx.xxx.xxx/[API KEY]/videos/[GROUP KEY]/[MONITOR ID]/[FILENAME]

Get video file after start time

http://xxx.xxx.xxx.xxx/[API KEY]/videos/[GROUP KEY]/[MONITOR ID]/[FILENAME]?start=YYYY-MM-DDTHH:mm:ss

Get video file before end time

http://xxx.xxx.xxx.xxx/[API KEY]/videos/[GROUP KEY]/[MONITOR ID]/[FILENAME]?end=YYYY-MM-DDTHH:mm:ss

Get video file between start time and end time

http://xxx.xxx.xxx.xxx/[API KEY]/videos/[GROUP KEY]/[MONITOR ID]/[FILENAME]?start=YYYY-MM-DDTHH:mm:ss&end=YYYY-MM-DDTHH:mm:ss

Get video file with custom start operator

http://xxx.xxx.xxx.xxx/[API KEY]/videos/[GROUP KEY]/[MONITOR ID]/[FILENAME]?start=YYYY-MM-DDTHH:mm:ss&startOperator=>=

Get video file with custom end operator

http://xxx.xxx.xxx.xxx/[API KEY]/videos/[GROUP KEY]/[MONITOR ID]/[FILENAME]?end=YYYY-MM-DDTHH:mm:ss&endOperator=<=

System Triggers

Trigger a Motion Event (Pretend to be a Motion Engine)

http://xxx.xxx.xxx.xxx/[API KEY]/motion/[GROUP KEY]/[MONITOR ID]?data={"plug":"camera1","name":"stairs","reason":"motion","confidence":197.4755859375}
  • plug : The name of the plugin. You can put the name of the camera.
  • name : The name of the region. Example : door
  • reason : The reason for this trigger. Example : motion
  • confidence : A number to signify how much confidence this engine has that there is motion. Example : 197.4755859375

Update Shinobi with built in script.

http://xxx.xxx.xxx.xxx/[API KEY]/update/[UPDATE KEY]

Monitor Triggers

Set to a mode for a monitor.

http://xxx.xxx.xxx.xxx/[API KEY]/monitor/[GROUP KEY]/[MONITOR ID]/[MODE]

[MODE] can be one of the following.

  • stop, start, record
  • stop = Disabled
  • start = Watch-Only
  • record = Record

Set to a mode for a number of minutes to elapse before automatically stops.

http://xxx.xxx.xxx.xxx/[API KEY]/monitor/[GROUP KEY]/[MONITOR ID]/[MODE]/[TIME]

Set to a mode for a period of time before automatically stops.

http://xxx.xxx.xxx.xxx/[API KEY]/monitor/[GROUP KEY]/[MONITOR ID]/[MODE]/[TIME]/[TIME INTERVAL]

Here is an example of setting the mode to record on a camera with ID bunny under group key 2Df5hBE. It will stay in this mode until changed.

http://xxx.xxx.xxx.xxx/XXXXXXXXXXXXXXXXX/monitor/2Df5hBE/bunny/record

Setting the mode to record on a camera with ID bunny for 10 minutes under group key 2Df5hBE. It will automatically return to Disabled itself after 10 minutes.

http://xxx.xxx.xxx.xxx/XXXXXXXXXXXXXXXXX/monitor/2Df5hBE/bunny/record/10/min

[TIME INTERVAL] can be left blank to use seconds or one of the following.

min, minute, minutes, hr, hour, hours, day, or days

Modifying a Video or Deleting it

Delete a video

http://xxx.xxx.xxx.xxx/[API KEY]/videos/[GROUP KEY]/[MONITOR ID]/[FILENAME]/delete

Mark as Unread

http://xxx.xxx.xxx.xxx/[API KEY]/videos/[GROUP KEY]/[MONITOR ID]/[FILENAME]/status/1

Mark as Read

http://xxx.xxx.xxx.xxx/[API KEY]/videos/[GROUP KEY]/[MONITOR ID]/[FILENAME]/status/2

Add, Edit or Delete a Monitor

Configuration of monitors remotely.

http://xxx.xxx.xxx.xxx/[API KEY]/configureMonitor/[GROUP KEY]/[MONITOR ID]/[ACTION*]?data={"mid":..}
  • [ACTION*] can be set to delete or not used entirely, There are no other options.
  • It is not necessary to put the data JSON if you are deleting.
  • The act of adding a monitor with an already existing ID will edit the existing monitor.
  • For an example of what to put for the data object check out this Sample JSON.

Embedding Streams

Embedding a websocket stream can be done through an iframe or using a GET request. You can even proxy it through another web engine because the embed URL will only start a stream after it gets the websocket library.

http://xxx.xxx.xxx.xxx/[API KEY]/embed/[GROUP KEY]/[MONITOR ID]

You can add jQuery with this method.

http://xxx.xxx.xxx.xxx/[API KEY]/embed/[GROUP KEY]/[MONITOR ID]/jquery

It's good for :

  • Direct access from a browser tab.
  • In an iframe
  • On a page without jQuery

You can embed with jQuery like this

$.get('http://xxx.xxx.xxx.xxx/[API KEY]/embed/[GROUP KEY]/[MONITOR ID]',function(data){ $('body').append(data) })

You can use it in an iframe like this

<iframe src="http://xxx.xxx.xxx.xxx/[API KEY]/embed/[GROUP KEY]/[MONITOR ID]/jquery|fullscreen"></iframe>

other available options are as follows. You must separate them with |

  • jquery : this addon adds jquery to the embed page. By default jquery is not loaded in case you have already loaded it where you are embedding the stream.
  • fullscreen : This adds CSS rules to fullscreen the stream element. This is good when embedding with an iframe.
  • gui : Extra CSS rules are added to display other information the Shinobi engine might have to provide.

You cannot use the URL like this

<img src="http://xxx.xxx.xxx.xxx/[API KEY]/embed/[GROUP KEY]/[MONITOR ID]">

Embedding on WordPress? You may need to set jQuery like this before the embed code for the feature to work.

$=jQuery
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT