Gateways-Create
- 25 Oct 2024
- 1 Minute to read
- Print
- DarkLight
Gateways-Create
- Updated on 25 Oct 2024
- 1 Minute to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
A Gateway is a GPU-accelerated interface between on-premises network cameras and the Cogniac cloud. Gateway objects act as a configuration node for our on-premises box.
POST /1/gateways
Host: https://api.cogniac.io
Example: Create Gateway
curl -X POST https://api.cogniac.io/1/gateways \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz" \
-H "Content-Type: application/json" \
-d '{
"name" : "test gateway",
"serial_number": "MF0X8EZ0-A821-21D3-AC0F-3897F789E41A",
"mac_address" : "98975699e41a",
"model" : "RM-M60X"
}'
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'}
gateway_data = {
"name" : "Fake non-existent gateway 2",
"serial_number": "MF0X8EZ0-A821-21D3-AC0F-3897F789E41A",
"mac_address" : "98975699e41a",
"model" : "RM-M60X"
}
url = f'{url_prefix}/{api_version}/gateways'
res = requests.post(url, json=gateway_data, headers=headers)
# Add the necessary logic for handling the 'status_code'
if res.status_code == 200:
response_data = json.loads(res.content)
pprint(response_data)
else:
print(f"Error: {res.status_code}, {res.text}")
{
"name" : "test gateway",
"serial_number": "MF0X8EZ0-A821-21D3-AC0F-3897F789E41A",
"mac_address" : "98975699e41a"
}
{
"gateway_id": "Ajr2t45p!",
"location": "cogniac-hq",
"poll_interval": 20,
"name": "test gateway",
"description": "test gateway at cogniac",
"created_at": 1463179215.124683,
"modified_at": 1463179215.124683,
"tenant_id": "rt06diepwc3i",
"created_by": "test@cogniac.co",
"ip_address": "127.0.0.1",
"serial_number": "MF0X8EZ0-A821-21D3-AC0F-3897F789E41A",
"mac_address" : "98975699e41a"
}
Update Gateway
POST /1/gateways/{gateway_id}
Host: https://api.cogniac.io
{
"name": "updated gateway"
}
{
"gateway_id": "Ajr2t45p",
"location": "cogniac-hq",
"poll_interval": 20,
"name": "updated gateway",
"description": "test gateway at cogniac",
"created_at": 1463179215.124683,
"modified_at": 1463179215.124683,
"tenant_id": "rt06diepwc3i",
"created_by": "test@cogniac.co",
"ip_address": "127.0.0.1",
"serial_number": "MF0X8EZ0-A821-21D3-AC0F-3897F789E41A",
"mac_address" : "98975699e41a"
}
Delete Gateway
DELETE /1/gateways/{gateway_id}
Host: https://api.cogniac.io
HTTP 204 Code (with no body)
Admin Requirement
User must be a member of the Tenant's admin group to delete a gateway
Was this article helpful?