How to add a camera to Cloud2 with VMS API
Cloud2 web client uses its own API which reframes VMS API requests, but it is still possible to add a camera to be fully functional in Cloud2 using only VMS API commands - /v3/channels/ and /v3/channel_groups/
Camera provisioning
We recommend using /v3/channels/ for camera provisioning. Here is the example of the complete curl and the body of the same curl:
curl -X POST "https://web.vxgdemo.vxgdemo.cloud-vms.com/api/v3/channels/" -H "accept: application/json" -H "Authorization: LKey {LKEY}" -H "Content-Type: application/json" -d "{ \"meta\": { \"18\": \"siteId\", \"bedrock_image_resolution\": \"FHD\", \"bedrock_model_id\": \"eu.anthropic.claude-3-5-sonnet-20240620-v1:0\", \"macAddress\": \"B8:A4:4F:01:55:44\", \"planId\": \"c37906ac-f012-4d91-9576-2febd3820aa0\", \"rsid\": \"B8A44F015544\", \"siteId\": \"18\" }, \"name\": \"Axis camera\", \"rec_mode\": \"on\", \"hosting_mode\": \"on\", \"storage_direct_recording\": false, \"events_enabled\": true, \"metadata_events_enabled\": true, \"filter_events_by_aliases\": true, \"source\": { \"url\": \"https://api.uplink.vxgdemo.cloud-vms.com/uplink_camera/\\", \"login\": \"root\", \"password\": \"password\" }, \"timezone\": \"Canada/Eastern\", \"protect_from_changes\": false, \"provision_server\": true, \"serial_number\": \"B8A44F015544\", \"mac_address\": \"B8:A4:4F:01:55:44\"}"
{
"meta": {
"18": "siteId",
"bedrock_image_resolution": "FHD",
"bedrock_model_id": "eu.anthropic.claude-3-5-sonnet-20240620-v1:0",
"macAddress": "B8:A4:4F:01:55:44",
"planId": "c37906ac-f012-4d91-9576-2febd3820aa0",
"rsid": "B8A44F015544",
"siteId": "18"
},
"name": "Axis camera",
"rec_mode": "on",
"hosting_mode": "on",
"storage_direct_recording": false,
"events_enabled": true,
"metadata_events_enabled": true,
"filter_events_by_aliases": true,
"source": {
"url": "https://api.uplink.vxgdemo.cloud-vms.com/uplink_camera/",
"login": "root",
"password": "password"
},
"timezone": "Canada/Eastern",
"protect_from_changes": false,
"provision_server": true,
"serial_number": "B8A44F015544",
"mac_address": "B8:A4:4F:01:55:44"
}
Adding to the group token
In order to see this camera on the Monitoring page of Cloud2, you also need to add it to the group token of the site. In the example above, we added the camera to Site18, you can find it using /v3/channel_groups/ and add this new camera (let’s say, CAMID 123):
curl -X GET "https://web.vxgdemo.vxgdemo.cloud-vms.com/api/v3/channel_groups/118/" -H "accept: application/json" -H "Authorization: LKey {LKEY}"
{
"ai_targeted": false,
"channels": [
10,
11,
12,
13
],
"channels_access": "all",
"id": 118,
"include_all_channels": false,
"max_channels_amount": null,
"name": "Site18",
"token": "eyJ0b2tlbiI6ICJzaGFyZS5leUp6YVNJNklERXhPSDAuNjdiNzFkMmV0YmMxZmFiMDAuMHJ4Y1FNMXpsMXNFdkJZTEZyT3RVX1lwbkl3IiwgImFwaSI6ICJ3ZWIudnhnZGVtby52eGdkZW1vLmNsb3VkLXZtcy5jb20ifQ=="
}
curl -X PUT "https://web.vxgdemo.vxgdemo.cloud-vms.com/api/v3/channel_groups/118/" -H "accept: application/json" -H "Authorization: LKey {LKEY}" -H "Content-Type: application/json" -d "{ \"channels\": [ 10, 11, 12, 13, 123 ]}"