Nx Witness doesn't have a direct API method to start or stop recording on certain cameras. But there is one called "saveCameraUserAttributes" that can change the additional attributes of a specific camera. We can use this API to enable or disable the recording schedule; in other words, start/stop recording. Visit the Nx Server API page for more information.
How To enable/disable recording via Nx Server API
- Get the camera's full parameter list JSON through /ec2/getCamerasEx
- Extract the parameter id (not physicalId). Since Nx Witness v3.0, it's possible to get the Camera ID directly from the Nx Witness desktop client. You can find it by going to Camera Settings > Advanced tab.
- Use the id as the index, construct the JSON with required parameters of /ec2/saveCameraAttributes, you can refer to the API document.
- Change the parameter - scheduledEnabled to enable/disable the recording of the camera. True is enabled. False is disabled.
- Send POST request to Nx Media Server, using the API /ec2/saveCameraAttributes.
All requests to the Server application are required to provide correct user authentication. Nx Server supports two types of HTTP authentication: basic and digest.
- Digest is more secure, the workflow is described in the API documentation.
- Basic is much simpler to use, just add user login and password to the link.
For more information download the sample code.
If you have any questions related to this topic or you want to share your experience with other community members or our team, please visit and engage in our support community or reach out to your local reseller.