Nx Witness does hot have a direct API method to start or stop recording on specific cameras. There is ah API called saveCameraUserAttributes that can change the additional attributes of a specific camera. We can use this API to enable or disable the recording schedule to effectively start and stop recording.
Visit the Server API page for more information.
How to start and stop recording via the Server API
-
- Go to Camera Settings > General tab, click More Info to expand the section.
- Copy the Camera ID.
- Go to Camera Settings > Recording tab, enabling Recording and set the schedule to Contineous recording.
- Send the Modify Device API PATCH /rest/v3/devices/{id} request to enable/disable recording with the following JSON body.
(Replace the {id} within the API URI with the Camera ID extracted in step 2.)
Enable Recording Schedule:
{
"schedule": {
"isEnabled": true
}
}
Disable Recording Schedule:
{
"schedule": {
"isEnabled": true
}
}
Note: You can use the GET Devices API GET /rest/v3/devices/?_with=id,name to get the camera ID and name from all cameras simultaneously.
Authentication
All requests to the Server application must include valid user authentication. For details, refer to the Login section of the REST API documentation.
Sample code is available in the Nx GitHub repository, specifically HERE.
Note: While examples for Digest Authentication are included, this method has been deprecated since version 5.0 and is kept solely for legacy support. It will be removed in a future release, so we strongly recommend using only the supported authentication methods.
Comments
0 comments
Article is closed for comments.