# Get&Push

## Function

This API is used to get parameter for Event > Event check & Event push.

## Event push

### POST

For details, please refer to POST.

### GET

For details, please refer to Get.

## Event check

### Response Message

#### Parameter Description

##### table 1

Parameter | Range | Type | Description
--- | --- | --- | ---
reader_id |  | unsigned int | Optional, when not input, the board checks all alarm information and outputs readerID
sequence |  | unsigned int | Optional, when not input, the board checks all alarm information and outputs readerID
lap_number |  | unsigned int | Optional, when not input, the board checks all alarm information and outputs readerID
plus_eventchk | "eventAiPushPic" | string | Must bring, subscription required
ext_data |  | Json array | Subscription method needs to be taken, carry the type of client needs to subscribe, see table 1.1
subscribe_id |  | unsigned int | Current reader index
data_pos |  | unsigned int | Index of current reader read events

##### table 1.1

Parameter | Range | Type | Description
--- | --- | --- | ---
subscribe_type |  | Json Array | Subscription Type For the type of subscription required by the client, see table 1.2
unsubscribe_type |  | Json Array | Unsubscribed types Do not include certain types in already subscribed types, see table 1.2
snap_resolution | "640x480" "1280x720" "no_snapshot" | string | Optional event carry picture resolution，no_snapshot: Without chart

table 1.2

Parameter | Range | Type | Description
--- | --- | --- | ---
event | "all" "motion" "io" "videoloss" "videohide" "int" "sound_dectet" | Json Array | Ordinary event type
aipushpic | "all" | Json array | Intelligent tweet type

#### Sample:

    POST /API/Event/Check
    HTTP/1.1

    {
        "version": "1.0",
        "data": {
            "plus_eventchk": "eventAiPushPic",
            "ext_data": {
                "subscribe_type": [{"event": ["all"]}]
            },
            "reader_id": 1,
            "sequence": 9595,
            "lap_number": null
        }
    }

### Response Message

#### Parameter Description

##### Table 2

Parameter | Range | Type | Description
--- | --- | --- | ---
reader_id |  | int | Optional, when the request has no readerID, create a readerID and return it.
sequence |  | int | Current latest sequence position
lap_number |  | unsigned int | The number of laps the current sequence position belongs to
subscribe_record_sign |  | bool | Optional, the default is to subscribe to the recording flag .If the field passes true or does not pass this field, it means to subscribe to the recording flag, and if the field passes false, it means not to subscribe to the recording flag
subscribe_intelligence |  | bool | Optional, subscribe to smart alarm events by default.If the field passes true or does not pass this field, it means subscription, and if the field passes false, it means not to subscribe to the smart alarm event
alarm_list |  | Json array | Single alarm show as table
log_collect |  | Json Object | Optional. When the log collection NVR mode is enabled, you can push log messages table 22
heat_alarm | "HeatAlarm" | string | Optional, when there is no alarm_list, output heartbeat alarm message
videoloss_status |  | bool | Dynamically display the video loss logo
alarm_snap_data |  | Json array | For the image data carried by the event (event push is not supported by udp), see table 15
ai_snap_picture |  | Json object | Intelligent map data, see table 16
ccCount |  | Json array | Cc count statistics, see table 17
hmlist |  | json array | Heat map statistics, see table 18
device_name |  | string | devicename
dev_net_info |  | Json array | Device information, see table 19
system_alarm |  | Json array | Device alarm see table 3 (optional)
report_alarm |  | Json array | Single channel alarm see table 20 (optional)
channel_alarm |  | Json array | Single channel alarm see table 5 (optional)
time |  | string | "MM/DD/YYYYhh:mm:ss"
devInfo_ftp_check_update |  | Json Object | Notify the client that no new version is detected.
storage_disk_refresh |  | bool | Whether the device is formatting the hard disk, true: HDD is being formatted; false: HDD is not being formatted(cloud dedicated)
nm_hot_standby |  | Json Object | See System > N+M Hot Standby Page > Range

##### Table 3

Parameter | Range | Type | Description
--- | --- | --- | ---
device_name | Max_length:31 | string | Equipment name (optional)
hdd |  | json | See Table 4 (optional)
abnormal_fans |  | bool | Fan abnormality alarm
wrong_power_number | 1，2 | int | Identify a power supply anomaly

##### Table 4

Parameter | Range | Type | Description
--- | --- | --- | ---
hdd_alarm_type | "Ok","Error" | string | Hard disk alarm type
hdd_alarm_info | "Full" "Bad" "Unformat" "Readonly" "Warning" "NoDisk" | string | Hard disk error warning information

##### Table 5

Parameter | Range | Type | Description
--- | --- | --- | ---
channel |  | string |
motion_alarm |  | bool | (optional)
record_flag |  | json | Video logo (optional) See Table 6
camera_connect_status |  | json | (optional) Table 7
io_alarm |  | bool | (optional)
pir_alarm |  | bool | (optional)
channel_name |  | string | (optional)
Floodlight_AudioAlarm |  | json | (optional) Table 8
ptz_alarm |  | json | (optional) Table 9
videoloss |  | bool | (optional)
int_alarm |  | Json Object | (optional) Table 10
alarm_state |  | Json array | (optional) Table 11
talkback_alarm |  | Json array | (optional) table 12
motion_smart_alarm |  | Json Object | Table 13
alarm_out_state |  | Json Array | (NVR/DVR) See Table 14
wireless_ipc_type |  | int | (wireless dedicated)Wireless IPC power supply type, battery 1, long-term power supply 2
remote_pair_state | Max_length:20 | string | (wireless dedicated)Report the result of remote matching Pair success:paired successfully Pair fail:Pairing failed Timeout:time out Pair is not supported:pairing not supported
take_alarm_snap |  | unsigned int | Carry the id corresponding to the picture
chn_alias |  | string | For channel

##### Table 6

Parameter | Range | Type | Description
--- | --- | --- | ---
m | "R""G" | string | Motion Alarm "R":Alarm recording status "G":Alarm without recording state
i | "R""G" | string | IO Alarm "R":Alarm recording status "G":Alarm without recording state
p | "R""G" | string | PIR Alarm "R":Alarm recording status "G":Alarm without recording state
s | "R""G" | string | Intelligent Alarm "R":Alarm recording status "G":Alarm without recording state
r | "SR""MR" | string | Recording "SR":Alarm recording status,"MR":On-board manual recording status
h | "R" | string | SDcardAlarm "R":Hard disk alarm
c | "R""G" | string | VideoTampering "R":Alarm recording status "G":Alarm without recording state

##### Table 7

Parameter | Range | Type | Description
connect_status | "NotConfigured" "Online" "Offline" "Sleep" "NotPaired" | string | Channel connection status
ability | "Fisheye" "Binoculars" "Ptz" "NewPtz"（NVR/DVR Need not） "HkPtz" "Iris" "Mainstream" "Substream" "Mobilestream" "FloodLight" "AudioAlarm" "AlarmOutNum" "TalkHalf" "TalkFull" "Color" "RedBlueLight" "NotAutoReconnect" "Pir" "Cover" "DsDistance"(cloud dedicated) "RegionFocus"(cloud dedicated) | string array |
protocol | Max length: 15byte | string | IPC access protocol
input_num |  |  | Alarm input
output_num |  |  | Alarm Output
intelligent_ability | "CrossCount" "HeatMap" "SOD" "LCD" "PVD" "FD" "PID" "CrowdDensity" "LPD" "RSD" "QD" "AttributeDetect" "Intrusion" "RegionEntrance" "RegionExiting" "FireDetection" "TempMeas" |  |

##### Table 8

Parameter | Range | Type | Description
--- | --- | --- | ---
floodlight_switch | true false | bool | White light real-time switch,false: close true: open
flood_light_value | 1 - 100 | int | Brightness of white light
floodlight_value_range | 1 - 100 | Object | White light brightness range
audioAlarm_switch | true false | bool | Horn real-time switch false: close true: open
audioAlarm_value | 1 - 10 | int | Speaker volume
audioAlarm_value_range | 1 - 10 | Object | Speaker volume range

##### Table 9

Parameter | Range | Type | Description
--- | --- | --- | ---
cur_zoom_value |  | int | Current position of zoom (temporarily unused)
zoom_step | 0 - 2 | int | 0:1 step 1:5 Step 2:20 Step (temporarily unused)
cur_focus_value |  | int | Focus Current location (temporarily unused)
focus_step | 0 - 2 | int | 0:1 Step 1:5 Step 2:20 Step (temporarily unused)
auto_focus_state |  | int | 0:Focus ends,1:Focusing (temporarily unused)
shift_range |  | int | (temporarily unused)
ptz_cruise_state |  | bool | Preset point cruise state
ptz_line_scan_state |  | bool | Line scan cruise state

##### Table 10

Parameter | Range | Type | Description
--- | --- | --- | ---
alarm_val | true|false | bool |
int_subtype | video_tampersod lcd pid pd fd sound avd pd_vd cc cd qd lpd rsd ad intrusion region_entrance region_exiting fireDetect measure | string | "video_tamper":Video tampering alarm "sod":SOD object lost legacy "lcd":LCD cable alarm "pid":PID perimeter alarm "pd":PD human body "fd":FD face "sound":Sound alarm "avd":avd alarm "pd_vd":pd_vd alarm "cc":cc alarm "cd":Crowd Density Detection "qd":Queue length detection "lpd":license plate detection "rsd":Abnormal sound detection "ad":Face attribute "fireDetect"：flame detection "measure"：temperature measurement

##### Table 11

Error Code | Description
--- | ---
readerID_invalid |
position_invalid |

##### Table 12

Parameter | Range | Type | Description
--- | --- | --- | ---
channel | 1 - 127 | int | Intercom channel number
talkback_close | true|false | bool | Whether to close the intercom
error_code | "localuser_operating_cannot_talkback" "localuser_close_talkback" | string | Intercom off reason localuser_operating_cannot_talkback:The user is in the setting interface localuser_close_talkback:User turns off intercom

##### Table 13

Parameter | Range | Type | Description
--- | --- | --- | ---
MDtime |  | string | "MM/DD/YYYYhh:mm:ss"
MDState |  | string array |

##### Table 14

Parameter | Range | Type | Description
--- | --- | --- | ---
Local->1 |  | bool | Local->1 channel alarm switch
…… |  |  | ……
Local->x |  | bool | Local->x channel alarm switch
IP_CH1->1 |  | bool | IP_CH1->1 channel alarm switch
…… |  |  | ……
IP_CHx->x |  | bool | IP_CHx->x channel alarm switch

##### Table 15

Parameter | Range | Type | Description
--- | --- | --- | ---
chnnel |  | string | devicename
chn_alias |  | string | eventpush carry
img_id |  | int | The id that the picture carries
img_encode |  | string | Picture coding format
img_format |  | string | picture format
img_data |  | string | Picture data

##### Table 16

Parameter | Range | Type | Description
--- | --- | --- | ---
SnapedObjInfo |  | Json Object | Push data when PD&VD, PID, LCD intelligent alarm, as shown in the Table 23 below
PlateInfo |  | Json Object | Push data when LPD intelligent alarm, as shown in the table Table 24 below
FaceInfo |  | Json Object | The push data when FD intelligent alarm, as shown in the Table 25 below

##### Table 17

Parameter | Range | Type | Description
--- | --- | --- | ---
channel |  | string | devicename
chn_alais |  | string | eventpush carry
cc_type |  | int | type
cc_objNum |  | int | cc alarm count
cc_version |  | int | version
ccin_num |  | int | cc entry quantity
ccout_num |  | int | cc outgoing quantity
cc_in_sum_num |  | int | cc enters total number
cc_out_sun_num |  | int | cc out total quantity

##### Table 18

Parameter | Range | Type | Description
--- | --- | --- | ---
channel |  | string | devicename
chn_alais |  | string | eventpush carry
hm_type |  | int | type
map_num |  | int | number of alarm
hm_version |  | int | version number
hm_width |  | int | Thermogram width
hm_height |  | int | Heat map height
map_lens |  | int | length
hm_datatype |  | int | type of data
hm_objNum |  | int | Thermogram quantity
hm_img |  | string | Heat map image data

##### Table 19

Parameter | Range | Type | Description
--- | --- | --- | ---
phy |  | string | the Ethernet card
ip |  | string | IP address
mac |  | string | mac address
ChnnelName |  | string | The name of the page setting

##### Table 20

Parameter | Range | Type | Description
--- | --- | --- | ---
channel |  | string | devicename
motion_report |  | json object | For the motion alarm parameters, see Table 21

##### Table 21

Parameter | Range | Type | Description
--- | --- | --- | ---
alarm_state |  | bool | Report the motion alarm status to the remote. (Optional) true: start false: end
alarm_type | smd | string | Alarm type

##### Table 22

Parameter | Range | Type | Description
--- | --- | --- | ---
dir_name |  | string | Name of the log storage directory
file_name |  | string | Log file name

#### Table 23

Parameter | Range | Type | Description
--- | --- | --- | ---
Chn | 0 | int | IPC only uses channel 0
StrChn | "CH1" | string | channel name
StartTime |  | long long | start time, picture with
EndTime |  | long long | end time, picture with
SnapId |  | int | image id
Type |  | int | Image type see Table 26
ObjectImage |  | string | Base64 encoded image data
Background |  | string | Base64 encoded background image data

#### Table 24

Parameter | Range | Type | Description
--- | --- | --- | ---
Id | 1-15characters | string | License plate number, unique identification.
GrpId |  | int | group ID
SnapId |  | unsigned int | The Id of the picture when the front-end IPC captures
Type | 0 | int | Types of face capture objects
StrChn |  | string | channel
StartTime |  | unsigned long long | Snapshot start time, such as: 2018-10-25 13:08:36, Unix timestamp (displayed according to UTC time zone uniformly)
EndTime |  | unsigned long long | The capture end time, such as: 2018-10-25 13:08:46, Unix timestamp (when displayed, it will be displayed uniformly in UTC time zone)
BgImgWidth |  | unsigned int | Capture the width of the picture
BgImgHeight |  | unsigned int | Capture the height of the picture
Chn |  | int | channel
PlateColor | 0-5 | int | License plate color, the possible values are as follows: enum AIPlateColor_e { APC_Blue = 0,// blue APC_Green = 1,// green APC_Yellow = 2,// yellow APC_Black = 3,// black APC_White = 4,// White APC_Other = 5,// other colours APC_Max };
CarBrand |  | string | car brand
CarType |  | string | car model
Sex |  | int | Owner gender: 0-male, 1-female
Owner | "Mike" | string | owner name
IdCode | "415025199203050916" | string | identification number
Job | "Software" | string | Profession
Phone | "12345678902" | string | telephone number
Domicile | "Guangdong,Zhuhai,Xiangzhou ..." | string | Living
Remark | "Detail of this person ..." | string | Remark
ImageAllInfo |  | string | License plate picture information
PlateImg | "base64(imgData)" | string | license plate image
BgImg | "base64(imgData)" | string | Background picture

#### Table 25

Parameter | Range | Type | Description
--- | --- | --- | ---
Id |  | int | Face Id, unique identification (nvr only)
GrpId |  | int | Group Id (nvr only)
SnapId |  | unsigned int | The Id of the picture when the front-end IPC captures
MD5 |  | string | MD5 value of the face image
Type | 0 | int | Types of face capture objects
StartTime |  | unsigned long long | Snapshot start time, such as: 2018-10-25 13:08:36, Unix timestamp (displayed according to UTC time zone uniformly)
EndTime |  | unsigned long long | The capture end time, such as: 2018-10-25 13:08:46, Unix timestamp (when displayed, it will be displayed uniformly in UTC time zone)
BgImgWidth |  | unsigned int | Capture the width of the picture
BgImgHeight |  | unsigned int | Capture the height of the picture
Score |  | int | Image Score (Confidence)
Sex |  | int | Gender: 0-male, 1-female
Age |  | int | age
Gender |  | int | Face attribute gender: 0-male, 1-female
Beauty |  | int | face score
fAttrAge |  | int | face attribute age
GlassesType |  | int | Glasses type, 0: no glasses, 1: wear glasses (currently there is no distinction between sunglasses and ordinary glasses, all glasses are defaulted)
Expression |  | int | Expression type, 0: no expression, 1: smiling, 2: laughing
MouthMask |  | int | Whether to wear a mask, 0: no mask, 1: with a mask
Race |  | int | Race, 0: Yellow, 1: Caucasian, 2: Black, 3: Arab
Chn |  | int | channel
StrChn | “CH1”…”CH1x” “IP_CH1”…” IP_CH1x” “WIFI_CH1”…” WIFI_CH1x” The number of channels depends on the capabilities of the device. | string | channel
Similarity |  | float | Similarity
ModifyCnt |  | int | The number of revisions, the upper layer is read-only, and is updated in real time by the device every time the face information is modified (nvr only)
ImageAllInfo |  | string | picture information
Image1 | "base64(imgData)" | string | Imported ID photo
Image2 | "base64(imgData)" | string | Capture face pictures
Image3 | "base64(imgData)" | string | A snapshot of the human body
Image4 | "base64(imgData)" | string | Capture background image
Name | "Mike" | string | Name (for nvr only)
Country | "China" | string | Nationality (nvr only)
Nation | "Han" | string | Ethnic (nvr only)
NativePlace | "Guangdong,Zhuhai" | string | Hometown (nvr only)
IdCode | "415025199203050916" | string | ID card (nvr only)
Job | "Software" | string | work (nvr only)
Phone | "12345678902" | string | Phone (nvr only)
Email | "abcd@163.com" | string | Mail (for nvr only)
Domicile | "Guangdong,Zhuhai,Xiangzhou ..." | string | Current residence (nvr only)
Remark | "Detail of this person ..." | string | Evaluation (for nvr only)
Feature | "base64(imgData)" | string | eigenvalue
FtVersion |  | int | Feature value version, it is meaningful only when comparing feature values with the same version, if return feature value, please return this field

#### Table 26

Enumerated value | implication
--- | ---
0 | Face
1 | HumanBody
2 | Vehicle
3 | PID HumanBody
4 | PID Vehicle
5 | LCD HumanBody
6 | LCD Vehicle
7 | NonVehicle
8 | PID NonVehicle
9 | LCD NonVehicle
10 | LicensePlate(LPD)
11 | Intrusion HumanBody
12 | Intrusion Vehicle
13 | Intrusion NonVehicle
14 | RegionEntrance HumanBody
15 | RegionEntrance Vehicle
16 | RegionEntrance NonVehicle
17 | RegionExiting HumanBody
18 | RegionExiting Vehicle
19 | RegionExiting NonVehicle

#### Sample1:

    HTTP/1.1 200 OK
    Content-Type: application/json
    Content-Length: 2976

    {
        "result": "success",
        "data": {
            "alarm_list": [{
                "time": "2023-08-25T08:38:58Z+08:00",
                "system_alarm": [{
                    "device_name": "SE-CH281M8ND-DF-WA2812PW",
                    "hdd": {
                        "hdd_alarm_type": "Error",
                        "hdd_alarm_info": "NoDisk"
                    }
                }],
                "channel_alarm": [{
                    "channel": "CH1",
                    "record_flag": {"h": "R"}
                }]
            }],
            "log_collect": {
                 "dir_name":"2023_07_04",
                 "file_name": "20230704_211532_ch1.log.tar.gz"
             },
            "storage_disk_refresh": false
            "reader_id": 1,
            "sequence": 9596
        }
    }

## Error Code

See Response Messages Body and Common error_code for more information.