...
Ensure that the old version of Gateway is running.
Navigate to the extracted folder of the new version of the Gateway.
Execute the script
update.sh
by providing the old Gateway directory and new Gateway directory.Code Block ./update.sh -orig <path_to_old_version_directory> -dest <path_to_new_version_directory>
API
...
Examples
Request authorization token from Gateway
Retrieve authorization token to send valid API requests.
Code Block |
---|
curl -X POST -L 'http://<DEVICE_IP>:8000/api/auth-token/' -H 'Content-Type: application/json' -d '{"username": "user", "password": "pass"}' |
Valid response: 200
Code Block |
---|
{
"token": "8656763e69dd6ead1d167b865f8caf08bf907227"
} |
Get list of cameras on Gateway
Retrieve list of cameras from Gateway database.
Code Block |
---|
curl -H 'Authorization: Token 8656763e69dd6ead1d167b865f8caf08bf907227' -X GET 'http://<DEVICE_IP>:8000/api/cameras/' |
Valid response: 200
Code Block |
---|
[
{
"camera_id": 1,
"access_token": "",
"ip": "104.251.103.214",
"http_port": 7080,
"rtsp_port": 7554,
"is_active": true,
"pid": 151,
"serial": "FAKECAMERA69",
"mac": "FAKECAMERA69",
"rtsp_only": false
}
] |
Add camera to Gateway
When adding a camera, it is suggested to create an Uplink camera on the Cloud VMS without the provisioning server and then copying the created access token to use in the token field when creating a camera on the gateway. Otherwise, you must create an Uplink camera using the provisioning server and use the same serial number and MAC Address values when creating the camera on the gateway.
Code Block |
---|
curl -H 'Authorization: Token 8656763e69dd6ead1d167b865f8caf08bf907227' -X POST http://<DEVICE_IP>:8000/api/add-camera/ -H "Content-Type: application/json" -d '{"ip": <CAMERA_IP>, "http_port": <HTTP_PORT>, "rtsp_port": <RTSP_PORT>, "serial": <CAMERA_SERIAL>, "mac": <CAMERA_MAC>, "token": <CLOUD_ACCESS_TOKEN>}' |
Valid response: 201
Code Block |
---|
{
"camera_id": 1,
"access_token": "",
"ip": "192.168.40.21",
"http_port": 80,
"rtsp_port": 554,
"is_active": false,
"pid": null,
"serial": "FAKECAMERA",
"mac": "FAKECAMERA",
"rtsp_only": false
} |
Delete camera from Gateway
When deleting a camera, the camera ID for the camera on the gateway can be used. If the camera was added using an access token, you can also use the camera’s ID on the Cloud VMS to remove the camera.
Code Block |
---|
curl -H 'Authorization: Token 8656763e69dd6ead1d167b865f8caf08bf907227' -X DELETE http://<DEVICE_IP>:8000/api/cameras/<GATEWAY_CAMERA_ID OR CLOUD_CAMERA_ID>/ |
Valid response: 204 No Content
Restart Gateway proxy connection
Code Block |
---|
curl -H 'Authorization: Token 8656763e69dd6ead1d167b865f8caf08bf907227' -X POST http://<DEVICE_IP>:8000/api/restart/ |
Valid response: 200
Code Block |
---|
{"message":"Server restarted successfully"} |