Skip to content

HTTP Webhook Reference

CosmoEdge supports pushing alarm/event data to an external platform over HTTP. The push configuration is currently maintained through system interfaces, and the event payload fields come from the current event DTO and the packaged HTML interface documentation.

Configuration API

Query:

text
/gtw/cwai/System/QueryHttpInterfaceParam

Set:

text
/gtw/cwai/System/SetHttpInterfaceParam

Set request example:

json
{
  "switch": true,
  "url": "http://example.com/cosmo/events"
}

Query response example:

json
{
  "resCode": 1,
  "resMsg": [],
  "resData": {
    "enable": true,
    "switch": true,
    "url": "http://example.com/cosmo/events"
  }
}

Fields:

FieldTypeDescription
switchbooleanWhether HTTP push is enabled.
enablebooleanWhether HTTP push is enabled; compatibility field in the query response.
urlstringReceiver URL.

Event Payload

A typical event payload:

json
{
  "messageId": "MSG-001",
  "devId": "DEVICE_SN",
  "taskId": "TASK_ID",
  "videoChannelId": "CHANNEL_ID",
  "channelName": "Entrance Camera",
  "timestamp": "1792147200000",
  "algorithmId": "ALG_ID",
  "algorithmCode": "helmet",
  "algorithmName": "Helmet Detection",
  "areaId": "AREA_ID",
  "areaName": "Work Zone",
  "orignalPicture": "/data/event/original.jpg",
  "fullPicture": "/data/event/full.jpg",
  "detectedPicture": "/data/event/target.jpg",
  "video": "/data/event/alarm.mp4",
  "videostructured": "/data/event/structured.json",
  "overviewFile": "/data/event/overview.json",
  "recordId": "RECORD_ID",
  "isRetryMessage": false,
  "category": "alarm",
  "property": {}
}

For field details, see API Fields.

Note: The DTO also defines the itimestamp and files fields, but the current outbound to_json serialization does not emit them, so they are intentionally omitted from the payload above.

Property Object

property changes with the algorithm type. The property categories that can currently be confirmed include:

CategoryDescription
faceFace quality, age, gender, mask, glasses, feature files, and face image.
bodyBody attributes, body features, and body image.
vehicleLicense plate, vehicle color, vehicle type, direction, and vehicle attributes.
behaviorBehavior count, duration, and target ID.
machineMaterialMaterial/equipment status match result.
peoplePeople flow statistics.
carVehicle flow statistics.
workClothesRecognitionWork-clothes recognition match result.
personCountPerson count.
countNumberCount number.

Additional sub-objects may appear alongside the main categories:

Sub-objectDescription
recognitionFace-library match result; accompanies face.
personsPerson target list; accompanies personCount.
targetTarget enter/exit area time and image; optional across types.

Receiver Recommendations

  • The receiver should return 2xx to indicate successful processing.
  • Use messageId or recordId for idempotent processing.
  • Perform lazy fetching with retry for image, video, and structured file URLs.
  • Do not assume all fields in property are present; different algorithms only populate the relevant fields.
  • The current implementation retains legacy field names such as orignalPicture; receivers must be tolerant of them.

Packaged HTML Reference

The repository currently retains:

text
data/Interface/ai-box-interface_v1.0.html

After installation, the entry point is:

text
web/staticfile/httpInterface.html

This HTML can be used as a historical interface reference, but open-source documentation should preferentially rely on the current DTO and Markdown references.

Released under the Apache 2.0 License.