Snapshot API

<< Click to Display Table of Contents >>

Navigation:  For Developers >

Snapshot API

The Snapshot API allows images to be taken from a remote webcam location and saved to a network or local path.

config.json

A config file is used to set the following settings and can be found in the app directory.

Settings

Name

Type

Description

httpPort

number

Port used to control the application by HTTP requests

Example

{

 "httpPort": 8084

}

cameras/cameras.json

The camera definition file is used to define URL and login details for camera instances.

The key of each definition is used to identify the preset name used when requesting snapshots.

Post-processing can be applied, available options are rotate: 0-360 and quality: 0-100.

type must be specified as a camera type implemented in camera-interfaces.js. Currently only the Panasonic WV range of cameras is supported.

The file is located at C:/7thsense/web/data/app/dss-snapshot/app/cameras.

Example

{

 "cameraOne": {

   "type": "WV",

   "hostname": "192.168.0.100",

   "port": 5000,

   "auth": {

     "username": "Username",

     "password": "Password"

   },

   "resolution": 1920,

   "postProcessing": {

     "rotate": 90,

     "quality": 50

   }

 }

}

/snapshot

Requests and saves an image from a webcam to a destination relative to the dss-snapshot host machine.

Request

http://127.0.0.1:8084/snapshot?camera=cameraOne&preset=1&path=c:/&filename=image.jpg

Query Parameters

Name

Type

Description

camera

string

The unique camera identifier as configured in cameras.json

preset

number

The preset camera position, note there is a 2 second delay for moving the preset

path

string

Absolute path to save image to, this can be a network or local path and will be created if it does not exist

filename

string

Filename to save the new file as, must include extension

Response

ContentType: application/json

{

 "status": "success",

 "data": {

   "path": "c:/",

   "filename": "image.jpg",

   "camera": "cameraOne",

   "preset": "1"

 }

}

/cameras

Lists all cameras in cameras.json

Unique cameras are identified by object key, in this example “cameraOne”

Request

http://127.0.0.1:8084/cameras

Response

ContentType: application/json

{

 "status": "success",

 "data": {

   "cameraOne": {

     "type": "WV",

     "hostname": "192.168.0.100",

     "port": 5000,

     "auth": {

       "username": "Username",

       "password": "Password"

     },

     "resolution": 1920

   }

 }

}

/log

Request

http://127.0.0.1:8084/log

Response

ContentType: text/html

The response is a web page which lists a rolling log of the last 1000 messages processed by the snapshot server.