Skip to content

Camera Import API

A POST request is used to import the cameras to the following URL: http(s)://YOUR_WATCHER_URL/vsaas/api/v2/cameras/import

Console:

curl http://127.0.0.1:80/vsaas/api/v2/cameras/import --data-binary @mydata.csv \
-H 'Content-type:text/csv' -H 'x-vsaas-api-key: <your api key>'

mydata.csv example:

stream_url,substream_url,thumbnails,onvif_url,onvif_profile,ptz,dvr_depth,dvr_path,enabled,access,title
rtsp://127.0.0.1:554,,,http://127.0.0.1:8899,000,0,3,storage,1,private,office_cam1
rtsp://127.0.0.2:554,,,http://127.0.0.2:8899,000,0,3,storage,1,private,office_cam2

Response:

{
  "created": 2,
  "updated": 0,
  "deleted": 0,
  "errors": {}
}

One string example:

echo -e "stream_url,substream_url,thumbnails,onvif_url,onvif_profile,ptz,dvr_depth,dvr_path,enabled,access,title\nrtsp://127.0.0.1:554,,,http://127.0.0.1:8899,000,0,3,storage,1,private,office_cam1\nrtsp://127.0.0.2:554,,,http://127.0.0.2:8899,000,0,3,storage,1,private,office_cam2" | curl http://127.0.0.1:80/vsaas/api/v2/cameras/import?type=csv --data-binary @-  -H 'Content-type:text/csv' -H 'x-vsaas-api-key: 3a7d9386-6c3a-440d-a75d-e6b3fdc3368e'

Response:

{
  "zu": 0, 
  "cameras": [
    {"name": "office_cam2-689f1b1548", "created": true}, 
    {"name": "office_cam1-c0ce3faa10", "created": true}
  ], 
  "users": [], 
  "success": true, 
  "zc": 2
}

CSV or list of JSON objects with the following fields:

  • title: camera name.
  • name: stream name. Default is ‘title’ with a random suffix.
  • static: 1: constantly working stream, 0: on-demand stream.
  • stream_url: main stream RTSP URL.
  • substream_url: secondary stream RTSP URL (for multi-bitrate). Turned off by default.
  • thumbnails (string): camera snapshot URL. Send 0 instead of the URL to reset thumbnails. If you don’t know the camera snapshot URL, use 1. Watcher will turn it on automatically. Note: we recommend that you use a direct URL. Otherwise, the server load will increase at 10%. If you specify the URL, a direct communication with the camera is established, saving your server processing power.
  • onvif_url: camera URL to access via the onvif protocol. By default, it’s set to ‘no.’
  • onvif_profile: ONFIV profile
  • ptz: (0 or 1) — turn PTZ off/on (if camera supports).
  • access: camera access type (private / public / authorized). Public will be accessible to all users, private — to a camera owner only. Private is a default value.
  • owner: camera owner login.
  • enabled: (0 or 1) turns camera on / off.
  • dvr_path: path to save the archive. Default is no archive.
  • dvr_depth: (integer in days) — number of days to store the archive. 0 — disables the archive.
  • coordinates:geographical coordinates.
  • postal_address: camera’s postal address.
  • comment: camera comment.
  • agent_model (string): camera model.
  • agent_serial (string): camera serial number.
  • agent_id (string): camera agent unique number.
  • agent_key (string): special field used for Watcher authorization.
  • agent_pin (string): special field used for Watcher authorization.