Tenants - Network Cameras
  • 22 Dec 2023
  • 1 Minute to read
  • Dark
    Light

Tenants - Network Cameras

  • Dark
    Light

Article summary

The Tenant's network cameras endpoint allows users to search network cameras available to the authorized tenant, sorted alphabetically based on the name of Network Camera.

Argument

Description

tenant_id
boolean

(required) The unique identifier of the Tenant object to be retrieved

reverse
boolean

(optional) Results order can be reversed by adding the ?reverse=true parameter

GET /1/tenants/{tenant_id}/networkCameras
Host: https://api.cogniac.io

Example: List Tenant's Network Cameras

curl -X GET https://api.cogniac.io/1/tenants/current/networkCameras \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz"
| 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}'}

url = f'{url_prefix}/{api_version}/tenants/current/networkCameras'
res = requests.get(url, 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},{res.headers}")
{
  "data": [  
    {
      "network_camera_id": "Asj45tQ1",
      "url": "rtsp://admin:password1@127.0.0.1",
      "camera_name": "Camera 1",
      "description": "Cogniac Network Camera",
      "active": True,
      "created_at": 1463179215.124683,
      "modified_at": 1463179215.124683,
      "tenant_id": "rt06diepwc3i",
      "created_by": "test@cogniac.co",
      "hae" : "0",
      "lat" : "0",
      "lon" : "0"
    },
    {
      "network_camera_id": "B58woskg",
      "rtsp_url": "rtsp://admin:password1@127.0.0.2",
      "camera_name": "Camera 2",
      "description": "Cogniac Network Camera 2",
      "active": True,
      "created_at": 1463179219.124683,
      "modified_at": 1463179219.124683,
      "tenant_id": "rt06diepwc3i",
      "created_by": "test@cogniac.co",
      "hae" : "0",
      "lat" : "0",
      "lon" : "0"
    }
    ]
}


Was this article helpful?