Issue with Custom Plugin for Receiving JSON via HTTP in Nx Meta
In ProgressI have created a plugin to receive a JSON via HTTP with the information of an event to an Nx Meta server from a client application.
I followed the example you have in the stub (http_requests).
I uploaded the plugin to the server, but when I try to access the web, it returns a 404.
If necessary, I can provide the source code.
Code:
struct HttpRequestContext {
nx::sdk::IUtilityProvider::HttpDomainName domain =
nx::sdk::IUtilityProvider::HttpDomainName::vms;
std::string url = "/rest/v1/analytics/detection";
std::string httpMethod = "POST";
std::string mimeType = "application/json";
std::string requestBody;
int64_t periodSeconds = 1;
};
-
Hi Jose M Martinez,
Thank you for your question.
This behavior is expected because the API endpoint you referenced does not exist.- There are no Analytics APIs in the /rest/v1 family.
- If you are looking for Analytics-related endpoints, they are available in the /rest/v4 family starting with Nx Meta v6.1 BETA.
I’m not sure where you found the reference to this endpoint—perhaps it is custom or from an external source. However, based on the source code, your request was sent to a non-existent endpoint, which is why you received a 404 error. This is expected and correct behavior.
If you need further clarification or information on the supported API endpoints, feel free to let me know.
-
My intention is to create a plugin that allows accepting POST requests similar to createEvent, with the difference that I want to add a bounding box to draw the rectangle where the event took place. I have been reviewing your API, but I cannot find how to create this plugin to accept that request
.
https://meta.nxvms.com/doc/developers/api-tool/apiinformation?type=1&system=18
Is this possible, or is it not considered?
Something like this, more or less:
json analytics_event = {
{"id", "89abcdef-0123-4567-89ab-cdef01234567"},
{"integrationId", "analytics.http_receiver"},
{"type", "detection"},
{"source", "external_detector"},
{"timestamp", std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch()).count()},
{"data", {
{"id_nvr", 1},
{"id_device", "CAM001"},
{"bbox", {
{"x", 0.1},
{"y", 0.2},
{"width", 0.3},
{"height", 0.4}
}}
}}
}; -
Hi
This is likely doable via the new v4 Analytics API of Nx.
The boundary box is one of the parameters of the object's metadata, so it is possible to use API to attach or configure the necessary information.
However, this is a new feature now in BETA version, and it is available within Nx Witness 6.1.0.
If this API fits your desires, we are more than welcome to try.Thanks.
Please sign in to leave a comment.
Comments
3 comments