How to Capture IP Addresses, Video URLs, and Timestamps for Events Using "Do HTTP Request" in NX Meta?
PlannedHi everyone,
I’m working with NX Meta and exploring its Event Rules functionality. I’ve successfully configured the Do HTTP Request action to trigger external HTTP requests when events like motion detection occur. However, I’d like to capture and send more detailed information about each event to my external server.
Specifically, I want to include the following data in the HTTP request payload:
- IP Address of the device (e.g., the camera triggering the event).
- Video URL for either live stream or playback related to the event.
- Timestamp of when the event occurred.
I’ve checked the documentation and found variables like {cameraId}
and {timestamp}
, but I’m unclear how to:
- Extract the IP address of the triggering camera/device.
- Construct a video URL dynamically (e.g., live stream or playback link).
- Ensure all of this data is included in the payload of the HTTP request.
Here’s an example of what I want the payload to look like:
{
"event_type": "Motion Detected",
"camera_id": "{cameraId}",
"video_url": "{serverUrl}/media/{cameraId}/stream",
"timestamp": "{timestamp}",
"source_ip": "{sourceIp}"
}
Could someone guide me on:
- Whether the
{sourceIp}
variable is available or how to fetch the device's IP address? - The best way to build the video URL dynamically based on the event?
- Any tips to test and validate the HTTP requests efficiently?
I appreciate any advice, examples, or documentation links that might help.
Thank you!
-
Thanks for your questions. The placeholders feature is currently applicable to Analytics and Generic Events. If your event category falls outside of these two, placeholders will not be available.
From the release note of our previous release:
The following placeholders can be used within the HTTP POST request body,
and they will be automatically replaced with corresponding values from Analytics Event parameters:
• {event.cameraId} – Camera ID (e.g., ad1d1b6c-7013-0049-6fd4-ff15450e4716)
• {event.cameraName} – Camera name (e.g., PND-9080R)
• {event.eventType} – Event type (e.g., nx.stub.objectInTheArea or nx.stub.lineCrossing)
• {event.eventName} – Event name (e.g., Object in the area or Line crossing)
• {event.caption} – Caption (e.g., Line crossing - impulse event (caption))
• {event.description} – Description (e.g., "Line crossing - impulse event (description)")There is an alternative approach as well.
You can monitor events using the transaction bus via HTTP or WebSocket. This allows you to parse JSON responses dynamically and extract the required information. Please notice that the API endpoint in the document could be replaced to the latest version, and we do recommend you use the latest ones. You can find the successor via this changelogRegarding to your questions you might be suggested to check our latest media server API:
1. Fetching the device’s IP address: REST API - Get Device Details
2. Building a video URL dynamically based on the event: REST API - Retrieve Media Format
3. Regarding Testing and Validating HTTP Requests
Only this one, we are not sure what do you mean by this.
Could you clarify what exactly you mean by “testing and validating HTTP requests efficiently”?Thanks.
0 -
The
ec2/transactionBus
endpoint is taking too long to respond on the Postman client via HTTP.0 -
Hi Chirag Jhariya,
At the moment, this is what we can provide, and we are unable to address the performance concerns related to the Postman client.
Typically, the transaction bus is implemented via WebSocket (or HTTP), and it can retrieve event details almost simultaneously when the “broadcast” event is issued.
We are continuously working on improving the flexibility and operability of event placeholders. However, I don’t have an ETA or a visible schedule for these enhancements yet.
Thanks for your understanding.
0
Please sign in to leave a comment.
Comments
3 comments