Network Cameras - Update
  • 04 Jan 2024
  • 1 Minute to read
  • Dark
    Light

Network Cameras - Update

  • Dark
    Light

Article summary

Update Network Camera

The following endpoint is used to update a network camera's properties e.g. it's URL or state state.

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

url_prefix = 'https://api.cogniac.io'
api_version = "1"
camera_id = 'PHYNPHZ'
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": "Updated Cogniac Network Camera",
  "active": "true",
   }

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

if res.status_code == 200:
    response_data = json.loads(res.content)
    pprint(response_data)
else:
    print(f"Error: {res.status_code}, {res.text}")

The body of the request should contain a dictionary of the form:

{
  "url": "rtsp://admin:password1@127.0.0.1",
  "camera_name": "Updated Camera 1",
  "description": "Cogniac Network Camera",
  "active": True,
  "longitude": -4.036878,
  "longitude": 39.669571 
}
{'IP_config_current': None,
 'IP_config_options': None,
 'active': True,
 'alt_subject_uid': None,
 'camera_name': 'Camera 1',
 'ch_px': None,
 'created_at': 1700860500.818104,
 'created_by': 'test@cogniac.co',
 'current_IP': None,
 'current_subnet_mask': None,
 'custom_configuration': None,
 'cv_px': None,
 'default_gateway': None,
 'description': 'Updated Cogniac Network Camera',
 'device_mode': None,
 'device_version': None,
 'discovered_by': None,
 'focal_length_h_mm': None,
 'focal_length_v_mm': None,
 'gateway_id': None,
 'genicam_features': None,
 'genicam_xml': None,
 'gige_features': None,
 'hae': None,
 'last_model_change_timestamp': None,
 'last_pose_change_timestamp': None,
 'lat': None,
 'lon': None,
 'mac_address': None,
 'manufacturer_info': None,
 'manufacturer_name': None,
 'model_name': None,
 'modified_at': 1700860917.63851,
 'network_camera_id': 'PHYNPHZ',
 'orientation': None,
 'origin_x': None,
 'origin_y': None,
 'pitch': None,
 'pixel_h_um': None,
 'pixel_v_um': None,
 'radial_distortion_coefficients': None,
 'resolution_h_px': None,
 'resolution_v_px': None,
 'roll': None,
 'serial_number': None,
 'skew': None,
 'spec_version_major': None,
 'spec_version_minor': None,
 'subject_uid': 'camera_1_3fhqd',
 'tangential_distortion_coefficients': None,
 'tenant_id': 'abcdefg',
 'tx_m': None,
 'ty_m': None,
 'tz_m': None,
 'url': 'rtsp://admin:password1@127.0.0.1',
 'user_defined_name': None,
 'x_axis_x': None,
 'x_axis_y': None,
 'y_axis_x': None,
 'y_axis_y': None,
 'yaw': None,
 'z_axis_x': None,
 'z_axis_y': None}


Was this article helpful?