Nx Witness doesn't have a direct API method to start or stop recording on certain cameras. But there is one called "generic event" that can trigger pre-configured action "Recording on camera".
Here are the simple how-to steps:
- Connect with Nx Witness client to the Media Server
- Select cameras you want to record with an HTTP request
- Right-click them and choose Cameras settings > Recording tab > enable Recording (filling the schedule is not required) > click OK.
- Press Ctrl+E to open the event rules dialog
- Click Add at the top left corner to add a new rule
- Click new appeared rule and in the drop-down list select Generic event
- Click Action column for this event and select Camera recording, in the "Target" column select the camera to record (one of those with recording enabled in the second step) and then click Apply
- You can right-click this new rule and call advanced settings. There you'll be able to add some keywords to specify HTTP requests that will trigger the recording (source name, caption, or description), recording fps, quality, and post-recording time (time to record after the event is over).
- After that to activate recording you'll need to construct and send to server some certain requests to start and end recording). Below some examples of those requests are listed.
Let's assume you're trying them with a browser from the server pc itself. In this case instead of its IP, one can use 127.0.0.1, for other cases use certain server NIC IP address(if you're using a third-party device to make HTTP-requests to Server). Nx Witness Server requires at least one of the source, caption, or description to take some value. For our example HTTP-request let's make caption take the value of the phrases "Hello_World!":
For versions 3.1 or higher
Since 3.1 is released every new rule "On Generic Event" -> "Start camera recording" has default option "Fixed duration" enabled with 5 seconds value. That means that any generic event received recording will start and run for 5 seconds(adjustable).
Thus it is enough to send HTTP GET request with the following URL:
For versions 3.0 or below
Before 3.1 there was no "Fixed duration" option for the "Camera recording" action. In terms of Nx Server, this is a prolonged action so it requires "start" and "stop" command. Before 3.1 it was required to send both commands separately:
- To start recording with every filter string empty in the generic event advanced options send the following request:
- To stop recording use this one:
http://127.0.0.1:7001/api/createEvent?state=Inactive&caption="Hello_World!"Keep in mind that a recording stop will happen when this HTTP-request is processed by server + time from the "Post-recording" option.
Also please keep in mind that all these requests will require authentication. Nx Media Server supports basic and digest authentication. Digest is more secured, the workflow is described in the API documentation.
If authentication at the Server is passed and there is no misprint in the API method, the Server will reply with 200 HTTP status code and JSON with a certain info message. It will tell you either some parameter is missing or be like below if the server accepted the generic event: