Skip to content

API Fields

This page distills field-level details from the current DTO and route implementations, focusing on the common responses, event queries, event records, HTTP push parameters, and MQTT parameters that are most commonly used by public integrations. A complete OpenAPI schema can be generated from these DTOs later.

Common Response

FieldTypeDescription
resCodenumberCWAI response code; 1 = success, 0 = failure
resMsgobject[]Error or info message list
resMsg[].msgCodestringMessage code
resMsg[].msgTextstringMessage text
resultCodestringChinaMobile-compatible response code
resultMsgstringChinaMobile-compatible response text
resDataobjectBusiness response data

Pagination and Time Range

Event queries and similar interfaces reuse the pagination and time fields:

FieldTypeDefaultDescription
pageNumnumber1Page number
pageSizenumber10Page size
timeBeginnumber0Start time, millisecond timestamp
timeEndnumber0End time, millisecond timestamp

Event Query Conditions

Source: MsgConditionEvent.

FieldTypeDescription
algorithmCodesstring[]Algorithm code list
categorysstring[]Event category list (field name retained from the current implementation)
videoChannelNamestringChannel name
personNamestringPerson name
personCodestringPerson code
matchLibNamestringMatched gallery name
propColorstringTarget color, often vehicle color
propRelatedColorstringRelated target color, often plate color
propTypestringTarget type, often vehicle type
propDirectionstringTarget direction, often vehicle direction
reportStatusnumberReport status, default -1

Event Record

Source: MsgEventUnit.

FieldTypeDescription
idstringEvent record ID
videoChannelIdstringVideo channel ID
channelCodestringChannel code
channelNamestringChannel name
timestampnumberEvent time, millisecond timestamp
categorystringEvent category
algorithmCodestringAlgorithm code
algorithmNamestringAlgorithm name
areaIdstringArea ID
areaNamestringArea name
fullPicturestringFull-frame image URL
detectedPicturestringTarget detection image URL
videostringAlarm video URL
videostructuredstringStructured video file URL
reportStatusnumberReport status
propertystringAttribute JSON string; varies by algorithm type

Event Report Payload

HTTP webhook and some internal event messages use CMsgOnEventsReq semantics:

FieldTypeDescription
messageIdstringMessage ID
devIdstringDevice ID
taskIdstringTask ID
videoChannelIdstringChannel ID
channelNamestringChannel name
timestampstringUTC millisecond timestamp string
itimestampnumberUTC millisecond timestamp (defined in the DTO; the current outbound to_json does not output this field, only inbound deserialization reads it)
algorithmIdstringAlgorithm ID
algorithmCodestringAlgorithm code
algorithmNamestringAlgorithm name
areaIdstringArea ID
areaNamestringArea name
orignalPicturestringOriginal image URL (field name retained from the current implementation)
fullPicturestringFull-frame image URL
detectedPicturestringTarget detection image URL
videostringAlarm video URL
videostructuredstringStructured video file URL
overviewFilestringStructured overview file URL
recordIdstringAlarm record ID
filesstring[]Related file list (defined in the DTO; the current outbound to_json does not output this field, only inbound deserialization reads it)
isRetryMessagebooleanWhether this is a retry message
propertyobjectAttribute object; varies by algorithm type
categorystringEvent category

Property Field Types

Event properties are differentiated via OnEventsPropertyType (see the enum in src/util/MsgBaseTypes.h, and the outbound serialization in src/util/dto/ClientMsgEvent.cc). Each type outputs its corresponding JSON key:

Type (OnEventsPropertyType)Output KeyMain Fields
facefacequality, age, gender, wearMask, wearGlasses, featureUrl, image
body (Body / BodyFeature)bodytopLength, topColor, bottomLength, bottomColor, featureUrl, image
vehiclevehicleplateColor, vehicleColor, vehicleClass, orientation, plate, plateSrc, attrs
behaviorbehaviorcount, duration, targetId
machineMaterialmachineMaterialmatchId, matchDegree, groupId, groupName, baseImageUrl, runningStatus
peoplepeopleenterNumber, leaveNumber, enterOrgNum, leaveOrgNum, time
carcarenterNumber, leaveNumber, enterOrgNum, leaveOrgNum, time
workClothesRecognitionworkClothesRecognitionmatchId, matchDegree, groupId, groupName, baseImageUrl
personCount (PersonCount)personCount + personsArea person-count statistics; also outputs the persons list (fields below)
countNumber (CountNumber)countNumberCounting-type events

The following are additional sub-objects (not independent OnEventsPropertyType enum values, but emitted alongside the main type):

Sub-objectEmitted WhenMain Fields
recognitionEmitted alongside the face typematchDegree, matchLibName, matchId, LibImage, matchName, personCode, personId
personsEmitted alongside the personCount typeorignalPicture, fullPicture, targetPicture, box
targetAny type, appended when bHaveTarget is trueinAreaTime, inAreaFullImageUrl, outAreaTime, outAreaFullImageUrl

HTTP Push Parameters

Routes:

text
/gtw/cwai/System/QueryHttpInterfaceParam
/gtw/cwai/System/SetHttpInterfaceParam
FieldTypeDescription
switchbooleanWhether HTTP push is enabled; the set interface only recognizes this field
enablebooleanOnly output by the query response (same value as switch); the set interface does not read this field
urlstringHTTP URL that receives events

MQTT Parameters

Routes:

text
/gtw/cwai/System/QueryMqttAdapterParam
/gtw/cwai/System/SetMqttAdapterParam
FieldTypeDefaultDescription
switchbooleantrueWhether MQTT is enabled; the set interface only recognizes this field
enablebooleantrueOnly output by the query response (same value as switch); the set interface does not read this field
urlstringemptyMQTT broker address
portnumber1883MQTT broker port
statusbooleantrueCurrent MQTT registration/connection status; a query-result field
authModenumber00 uses built-in IoT auth; non-0 uses a normal username/password
clientIdstringemptyClient ID under normal auth mode
userNamestringemptyUsername under normal auth mode
passwdstringemptyPassword under normal auth mode

IoT Network Mode Parameters

Routes:

text
/gtw/cwai/System/QueryIotNetworkParam
/gtw/cwai/System/ModifyIotNetworkParam
FieldTypeDefaultDescription
mqttIpstringemptyMQTT address under IoT network mode
mqttPortnumber1883MQTT port under IoT network mode
httpUrlstringemptyHTTP address under IoT network mode
statusbooleantrueWhether MQTT is currently enabled; a query-result field

Released under the Apache 2.0 License.