Event

Real-time Event (Subscription)

This connection provides real-time notifications for events detected by the AI using WebSocket. The events contain information about the detected objects and their associated confidence scores. Once connected, the WebSocket will send real-time events as they occur.

Note: Please check the Authentication to get the service_id and token

Endpoint:

ws(s)://yourserver.com/apiserver/events/realtime/:service_id/:task_id?token=xxxxx
{
  "task_id": 1,
  "event_id": 2001,
  "event_name": "vehicle_detected",
  "event_description": "A vehicle was detected.",
  "timestamp": "2023-03-13T04:02:42Z",
  "image_url": "https://example.com/event_images/1.jpg",
  "video_url": "https://example.com/event_videos/1.mp4"
  "detected_objects": [
    {
      "object_id": "101",
      "object_name": "car",
      "coordinates": [0.1, 0.2, 0.3, 0.4],
      "confidence_score": 0.8
      "warning": true
    }
  ]
}

Response Fields

detected_objects


Event History

The Event History API allows users to query past events detected by the AI detection system for a specific task. Users can filter the events based on a time range and event name, enabling them to analyze and review historical data efficiently.

Endpoint: GET /events/history

Payload:

Example Request:

GET /events/history?ids=1&start_time=2023-03-01T00:00:00&end_time=2023-03-28T23:59:59&event_name=vehicle_detected&task_id=1&offset=0&limit=10

Response

The response will be a JSON object containing an array of events that match the specified filters. Each event object will include the following information:

Example

[
    {
      "task_id": 1,
      "event_id": 1,
      "event_name": "vehicle_detected",
      "event_description": "A vehicle was detected.",
      "timestamp": "2023-06-13T04:02:42Z",
      "image_url": "https://example.com/event_images/1.jpg",
      "video_url": "https://example.com/event_videos/1.mp4",
      "detected_objects": [
        {
          "object_id": "101",
          "object_name": "car",
          "coordinates": [0.1, 0.2, 0.3, 0.4],
          "confidence_score": 0.8,
          "warning": false
        }
      ],
      "location_id": 1,
      "scenario_id": 103,
      "camera_id": 1
    }
]

#Response Fields

#detected_objects


Event Detail

This API retrieves detailed information about a specific event, including the event name, event description.

Endpoint: GET /events/types/:event_id

Parameters:

Example Request:

GET /events/types/1

Response:

{
    "id": 1,
    "name": "Person detected in zone",
    "description": "Person detected entering the forbidden area."
}

Response Fields:

Last updated