Nx Witness doesn't have 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 HTTP request -> right-click them -> "Cameras settings" -> "Recording" tab -> enable recording(filling the schedule is unnecessary) -> "OK"
- Press "ctrl+e" to call event rules dialog
- Click "Add" at the top left corner to add 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 "Target" column select camera to record(one of those with recording enabled in the second step) -> "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 on 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 Media 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 generic event advanced options send the following request:
- To stop recording use this one:
Keep in mind that recording stop will happen when this HTTP-request is processed by server + time from "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, workflow is described in the API documentation.
If authentication at Server is passed and there is no misprint in API method, Server will reply with 200 HTTP status code and JSON with certain info message. It will tell you either some parameter is missing or be like below if server accepted the generic event: