How to store data coming from a third party API to the NX server?
AnsweredHello,
I have a use case where I am trying to achieve the following:
1. Hit an external third party API
2. Store the data which the API returns to the NX server.
I looked this up and found this article which states that the server database is located here: /opt/networkoptix/mediaserver/var/mserver.sqlite
My guess is that I would have to create a table in this database and store my data in that table.
Could anyone help me out and let me know if this is the right approach to be followed?
System specs:
Ubuntu 18.04
Nx Witness 4.1.0.30526
-
Hello Sindhu Satish ,
Could you elaborate a bit about your objective, please? Where your code is supposed to be executed? Your code is supposed to do what specifically?
-
Hello Andrey, thank you for your response.
So I have an external Python API which accepts a frame sent from the network optic plugin and returns the co-ordinates for the bounding boxes of the objects present in that frame.
I need to get this data and store it within the internal database of the NX server.
this needs to happen within the plugin.
-
Hi Sindhu,
Just to make sure that we are on the same page: you're asking about the metadata plugin development process, is it correct?
If that is the case, you basically need a plugin, that is not only able to send some frames to your external Python backend, but this plugin has to be capable of receiving the data from your backend and supplying the Server with this metadata in a appropriate format.
Could you please elaborate what do you mean by "network optic plugin"? Are you using some of the examples that we provide in order to supply your backend with the video frames? If that is the case, I believe that what you need to do is to modify the plugin in a way that it is going to be capable to receive the metadata from your backend and supply the Server with it.
To record the metadata to the DB of the Mediaserver you do not need to do anything specific as long as your plugin provides the Server with metadata that has got a correct format - it is going to be done by the Server automatically in case if your plugin is up and running and recording is enabled for a camera. So, you don't need to create any tables or records in the DB.
For the starters, please refer to these articles if you did not see them already: https://support.networkoptix.com/hc/en-us/sections/360004090353-Integrating-Video-Analytics.
Then I would suggest you to check the source code of sample_analytics_plugin, which is included with metadata SDK package. It is a small example, but it is capable of providing the Server with metadata that contains size and position of the bounding boxes and text attributes of the objects, the plugin is also capable of generating some sample events.
The plugin uses the methods that are dedicated to transfer of metadata from plugin to Server, these are pullMetadataPackets() and pushMetadataPacket(), you can check on those.
Should you have any problems, please just ask us here.
Regards,
Maxim Podstrechny,
QA Engineer
Please sign in to leave a comment.
Comments
3 comments