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://localhost/watcher/client-api/v3/streams/import' \
-X POST \
--data-binary @mydata.csv \
-H 'Content-Type: text/csv' \
-H 'Authorization: Bearer eyJ0eXAiOiJKV1'
mydata.csv example:
name,title,comment,static,disabled,inputs_0_url,inputs_1_url,dvr_expiration,dvr_episodes_expiration,dvr_storage_limit,dvr_redundancy_factor,vision_alg,vision_areas,organization_id,coordinates_latitude,coordinates_longitude,is_test,onvif_ptz
cam-e7fee73458,Primary camera title,,true,false,rtsp://127.0.0.1/stream/main,rtsp://127.0.0.1/stream/sub,86400,259200,32212254720,3,faces,x1 y1,1,55.71182944518981,37.7775426954031,false,false
,Secondary camera title,Camera comment,true,false,rtsp://127.0.0.1/stream2/main,rtsp://127.0.0.1/stream2/sub,172800,432000,,0,plates,x2 y2,1,51.711667039488155,35.77733281254769,true,true
Response:
{"created":2,"updated":0}
One string example:
echo -e "name,title,comment,static,disabled,inputs_0_url,inputs_1_url,dvr_expiration,dvr_episodes_expiration,dvr_storage_limit,dvr_redundancy_factor,vision_alg,vision_areas,organization_id,coordinates_latitude,coordinates_longitude,is_test,onvif_ptz
cam-e7fee73458,Primary camera title,,true,false,rtsp://127.0.0.1/stream/main,rtsp://127.0.0.1/stream/sub,86400,259200,32212254720,3,faces,x1 y1,1,55.71182944518981,37.7775426954031,false,false
,Secondary camera title,Camera comment,true,false,rtsp://127.0.0.1/stream2/main,rtsp://127.0.0.1/stream2/sub,172800,432000,,0,plates,x2 y2,1,51.711667039488155,35.77733281254769,true,true" | curl 'http://localhost/watcher/client-api/v3/streams/import' -X POST --data-binary @mydata.csv -H 'Content-Type: text/csv' -H 'Authorization: Bearer eyJ0eXAiOiJKV'
Response:
{
{"created":2,"updated":0}
}
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.