The VMS does not currently provide a built-in action within the Rules Engine to directly start or stop recording on specific cameras. However, you can achieve this functionality by using a simple REST API request to change the state of the recording schedule of a camera.
Retrieve the Camera IDs
Before you can send a request, you need the Camera ID of the device you'd like to control. There are two ways to find it:
Via the Desktop Client:
Go to Camera Settings > General tab. Click More Info, and the Camera ID will be displayed. You can copy it directly from there.Via the REST API:
Use the following API request to list all devices along with their names and IDs:GET /rest/v3/devices?_with=id,nameThis will return a list of all device names and their corresponding Camera IDs.
Change the Recording Schedule state
Once you have the Camera ID, you can send a PATCH request to the /rest/v3/devices/{id} endpoint to change its recording schedule. Replace {id} with the actual Camera ID.
To Enable Recording:
PATCH /rest/v3/devices/{id}Body:
{
"schedule": {
"isEnabled": true
}
}To Disable Recording:
PATCH /rest/v3/devices/{id}Body:
{
"schedule": {
"isEnabled": false
}
}Optional: Trigger with the Rules Engine
If desired, you can integrate these API calls with events in the Rules Engine by using a Do HTTP(S) Request action. This allows you to automate camera recording based on system events, analytics triggers, or external inputs, etc.
And you can (should!) create another rule to enable the recording again. As the Event, any Event type can be used, but commonly used Events are Soft Triggers, and Generic Events.
Authentication
{
"error": "0",
"errorString": "",
"reply": null
}NOTE: While this article requires the use of Digest Authentication, please note that this method has been deprecated since version 5.0 and is used solely for legacy support. It will be removed in a future release, so we strongly recommend using only the supported authentication methods, once available.
Comments
0 comments
Article is closed for comments.