Notification Center

1. Background

The data flow between the SUNMI store open platform and the Saas provider could be bidirectional and real-time. The Saas provider can pass its data to the open platform and remote control SUNMI’s IOT device.

Meanwhile, SUNMI store open platform could push the data in its system to the saas provider through the data center on their need

2. API specification

2.1 protocol

All Open APIs are HTTPS request with POST method only.

Content-Typeapplication/x-www-form-urlencoded
data typeJSON
encodingUTF-8
signatureMD5
sign rule see chapter 2.2

2.2 Sign rule

See authentication

2.3 Common parameter

parameterrequiredtypedescription
app_idyesstringunique identifier provided by SUNMI store open platform
randomyesstring6-10 digits random string with numbers and alphabets.
timestampyesintcurrent 10 digit unix timestamp
signyesstringsee 2.2

3. Event Monitor APIs

3.1 API list

API addressdescription
/hook/addadd the HTTP callback address for a set of events
/hook/deletedelete the HTTP callback address for a set of events

3.2 API detail

8.3.1 Add an event monitoring

API description: By requesting this API, User could set up an http callback for a set of events of their choice on the SUNMI store open platform.

When the specified events happened, open platform will request the given HTTP API.

The authorization of this HTTP API must be the same as the SUNMI store open platform API method.

Following parameters must be included in the callback API:

parameterrequiredtypedescription
shop_idyesstringthe identifier of the shop in open platform
eventyesintThe type of event to monitor
payloadyesstringthe specific structure of message in JSON

API address: /hook/add

Parameters

parameterrequiredtypedescription
shop_idstringthe identifier of the shop in open platform
http_callbackstringthe http call back API
event_listarray[int]the list of event to be monitored

return value: 

{
  code: 0,
  msg: "succeed",
  data: {
  }
}

parameter event

event valuedescription
1010IPC FM010 motion detecting message
1100add a face to a group result message
2001IPC real time face recognition message
4100price change message (currently unavailable)

payload(event=1010): 

{
  ipc_id: 029388
  sn: "FS101D8BS00080",
  name: "设备1",
 video_url:"http://xxx.xxx.xxx.xxx/xxx/xxx/41b061f6f10dbd6fe1aaf469fb0ab012d9193d9655816af31cdfbcsdfe71a5fe1",
  model_name: "FM020",
  motion_type: 0,
}

Parameter motion_type:

motion_type valuedescription
1motion detection event
2voice detection event

payload(event=1100): 

{
  code: 0,
  msg: "",
  face_id:195
}

Parameter code

code valuedescription
5527bad face image
5000database error

payload(event=2001): 

{
    ipc_id: "928",
    face_id: "29195",
    gender: 1,
    age_range: 4,
    group_id: "8927",
    group_name: "stranger",
    group_type": 2
}

Parameter gender:

gender valuedescription
0unknown
1male
2female

parameter age_range:

age_range valuedescription
1age 0~6
2age 7~12
3age 13~18
4age 19~28
5age 29~35
6age 36~45
7age 46~55
8age 56~

Parameter group_type

group_type valuedescription
1stranger face library
2familiar face library
3shop assistant face library
5custom face library

8.3.2 Cancel event monitoring

API description: By requesting this API, the user can cancel the monitor on given events

API address:/hook/delete

Parameters

parameterrequiredtypedescription
shop_idyesstringthe identifier of the shop in open platform
event_listyesarray[int]the list of events that need to be canceled

Return value: 

{
  code: 0,
  msg: "succeed",
  data: {
  }
}

Parameter event:

event valuedescription
1010IPC FM010 motion detecting message
1100add a face to a group result message
2001IPC real time face recognition message
4100price change message (currently unavailable)