NX API Modify Device
AnsweredGood day,
I was wondering how it is possible to change the url field for a device using the PATCH API call, as when I try to perform a PATCH, NX changes the url to the desired value for a few seconds, and then reverts it back.
I try the following JSON structure, however, NX keeps reverting my change and I am unsure how to forcibly change the url field for a device via the API call. I need to do it via API call as this has to be repeated for many devices.
{
"url": "rtsp://xx.xx.xx.xx:554/Streaming/channels/102"
}
Note that I use the following API endpoint to do the PATCH:
/rest/v2/devices/{id}
I have also tried using the replace device API endpoint and this did not work either.
PUT: /rest/v2/devices/{id}
-
I would like to further add that I am specifically trying to change the URL field of the device, and not the “streamUrl” field within the “parameters” key. I am trying to make the “url” field to match the value of the “streamUrl” field.
Therefore the resultant JSON structure would look as follows:
{
"url": "rtsp://xx.xx.xx.xx:554/Streaming/channels/102","parameters": {
"streamUrls": {
"1": "rtsp://xx.xx.xx.xx:554/Streaming/channels/102"
}
}
}0 -
Hi Rubin Abraham,
It depends, if you added a device as an RTSP stream, you can change the RTSP urls.
However, and that seems to be the case, if you added the devices via autodiscovery or manual discovery, you cannot change the RTSP URLs, since these are part of the profiles the VMS uses to communicate with the devices, and it is expected that if you apply such, that the VMS will revert this change.
0 -
I do add the device as an RTSP stream, and under system administration, the autodiscovery checkbox is disabled. Do you perhaps know why then the URL keeps getting reverted back? Or how I can change the URL of that device to match my streamURL.
0 -
I've been testing further by doing the following.
I have 2 servers that is running NX. I added the same camera to them using the createDevice API call. In the modify call, I made changes to the “url” field and the “model” field.
On Server 1, I am able to modify the “url” and “model” fields and the change remains.
On Server 2, When i try modify the “url” and “model” fields, NX reverts the change back after a few seconds.
I have compared the system info of both servers using the get Servers API call and have not identified what is causing Server 2 to not allow me to make the change.0 -
Hi Rubin Abraham,
If you added the device as an RTSP stream, and use the following request:
PATCH https://localhost:7001/rest/v3/devices/<cameraId>with body:
{ "streamUrls": { "1": "rtsp://192.168.178.101:554/profile5/media.smp", "2": "rtsp://192.168.178.101:554/profile6/media.smp" } }Omit all other values in the body, and it should work. The actual RTSP URL obviously will be device specific. Of course the RTSP URL needs to valid. You can verify this with FFplay or VLC.
With kind regards.
0
Please sign in to leave a comment.
Comments
5 comments