Network Cameras - Create
  • 04 Jan 2024
  • 2 Minutes to read
  • Dark
    Light

Network Cameras - Create

  • Dark
    Light

Article summary

Example: Create a Network Camera

POST /1/networkCameras
Host: https://api.cogniac.io
curl -X POST https://api.cogniac.io/1/networkCameras \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz" \
-H "Content-Type: application/json" \
-d '{
  "url": "rtsp://admin:password1@127.0.0.1",
  "camera_name": "Camera 1",
  "description" : "Cogniac Network Camera",
  "active" : "true"
   }'  | json_pp
import requests
import json
from pprint import pprint

url_prefix = 'https://api.cogniac.io'
api_version = "1"
token = ''  # add your token here
headers = {'Authorization': f'Bearer {token}',
           'Content-Type': 'application/json'}
network_camera_data = {
  "url": "rtsp://admin:password1@127.0.0.1",
  "camera_name": "Camera 1",
  "description": "Cogniac Network Camera",
  "active": "true",
   }

url = f'{url_prefix}/{api_version}/networkCameras'
res = requests.post(url, json=network_camera_data, headers=headers)

if res.status_code == 200:
    response_data = json.loads(res.content)
    print(response_data)
else:
    print(f"Error: {res.status_code}, {res.text}")
{
  "url": "rtsp://admin:password1@127.0.0.1",
  "camera_name": "Camera 1",
  "description": "Cogniac Network Camera",
  "active": True,
  "longitude": -4.036878,
  "longitude": 39.669571 
}
{
   "IP_config_current" : null,
   "IP_config_options" : null,
   "active" : true,
   "alt_subject_uid" : [],
   "camera_name" : "Camera 1",
   "ch_px" : null,
   "created_at" : 1700775477.21315,
   "created_by" : "test@cogniac.co",
   "current_IP" : null,
   "current_subnet_mask" : null,
   "custom_configuration" : {},
   "cv_px" : null,
   "default_gateway" : null,
   "description" : "Cogniac Network Camera",
   "device_mode" : null,
   "device_version" : null,
   "discovered_by" : null,
   "focal_length_h_mm" : null,
   "focal_length_v_mm" : null,
   "gateway_id" : null,
   "genicam_features" : {},
   "gige_features" : [],
   "hae" : null,
   "lat" : null,
   "lon" : null,
   "mac_address" : null,
   "manufacturer_info" : null,
   "manufacturer_name" : null,
   "model_name" : null,
   "modified_at" : 1700775477.21315,
   "network_camera_id" : "VYVRDII",
   "orientation" : 0,
   "origin_x" : null,
   "origin_y" : null,
   "pitch" : null,
   "pixel_h_um" : null,
   "pixel_v_um" : null,
   "radial_distortion_coefficients" : [
      0,
      0,
      0,
      0,
      0,
      0
   ],
   "resolution_h_px" : null,
   "resolution_v_px" : null,
   "roll" : null,
   "serial_number" : null,
   "skew" : 0,
   "spec_version_major" : null,
   "spec_version_minor" : null,
   "subject_uid" : "camera_1_2yopk",
   "tangential_distortion_coefficients" : [
      0,
      0
   ],
   "tenant_id" : "d16jdqt1h71f",
   "tx_m" : null,
   "ty_m" : null,
   "tz_m" : null,
   "url" : "rtsp://admin:password1@127.0.0.1",
   "user_defined_name" : null,
   "x_axis_x" : null,
   "x_axis_y" : null,
   "y_axis_x" : null,
   "y_axis_y" : null,
   "yaw" : null,
   "z_axis_x" : null,
   "z_axis_y" : null
}


Was this article helpful?