1 背景介绍
商米数字店铺(SUNMI Store)是商米提供的围绕商户店铺中物联网设备基础上的店铺管理系统。
商米数字店铺作为一个开放平台,支持与第三方SaaS厂商进行各种数据的对接,包括商品信息对接,交易信息对接,会员体系对接等。
2 接口规范
2.1 协议说明
对接的openAPI接口目前只开放HTTPS方式,所有的消息一律采用POST方式。
注:消息体大小不得超过1M,超过1M的请求,直接拒绝!
Content-Type | application/x-www-form-urlencoded |
---|
数据格式 | 返回为JSON格式 |
---|
字符编码 | UTF-8字符编码 |
---|
签名算法 | MD5 |
---|
签名规则 | 参考2.2 签名规则 |
---|
2.2 签名规则
参考《鉴权认证》文档
2.3 公共参数
参数名 | 必填 | 类型 | 说明 | 示例 |
---|
app_id | 是 | string | 唯一标识接入身份,联系商米数字店铺提供 | LMWWQVTW4QGCC |
random | 是 | string | 随机字符串,由数字和字母组成,长度范围为6-10位 | 5dsf6698 |
timestamp | 是 | int | 当前的unix timestamp,精度到秒级,10位数字 | 1581333970 |
sign | 是 | string | 签名信息,详见3.2.2 | 2E7CED3164B6BBDB81145F3CBE204597 |
3 店铺设计规范
参考 《openAPI 商户店铺对接》文档
4 设备管理接口
4.1 接口描述
设备管理接口用来管理智能摄像机设备的基本属性,比如名称等。
4.2 接口列表
接口名称 | 接口描述 |
---|
/device/ipc/getList | 获取设备列表 |
/device/ipc/getListByCompany | 获取商铺下所有设备列表 |
/device/ipc/getInfo | 获取设备基本信息 |
/device/ipc/updateName | 修改设备名称 |
/device/ipc/bind | 绑定设备 |
/device/ipc/unbind | 解绑设备 |
4.3 接口详情
4.3.1 获取设备列表
接口描述:通过本接口调用,用户可以获取相关门店下所有设备列表。
请求链接:/device/ipc/getList
接口版本:v2.0
接口参数:
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 560279010307 |
shop_id | 否 | string
| 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 10096 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/device/ipc/getList",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1581333970,
"random": "5dsf6698",
"sign": "5EA14F9445D72DDE113AA95B04797D29"
}
返回值:
{
"data": {
"total_count": 1,
"ipc_list": [
{
"ipc_id": "549755805878",
"ipc_sn": "C101P98200023",
"ipc_name": "小松松大魔王",
"model_name": "FM010",
"software_version": "1.2.6",
"check_version_time": 1566365781,
"connect_time": 1565951330,
"active_status": 0,
"screenshot_url": "https://xxxxxxxx/IMG/IPC/e36654e8a95a9ad27b5bb585a0f7df50a0de0dd6e0aeaee47b4e34c4f4636f9a"
}
]
},
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed"
}
返回字段描述:active_status
active_status 取值 | 说明 |
---|
0 | 设备离线 |
1 | 设备在线 |
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未查询到数据 |
5041 | 请求中未找到shop_id参数 |
4.3.2 获取设备基本信息
接口描述:通过本接口调用,用户可以获取指定设备基本信息。
请求链接:/device/ipc/getInfo
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 560279010307 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 10096 |
ipc_id | 是 | string | 摄像机设备唯一ID | 549755805878 |
请求示例 :
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/device/ipc/getInfo",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"ipc_id": "549755805878",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1581333970,
"random": "5dsf6698",
"sign": "140E3195C0F00DB09457E015AA79D79B"
}
返回值:
{
"data": {
"ipc_id": "549755805878",
"ipc_sn": "C101P98200023",
"ipc_name": "小松松大魔王",
"model_name": "FM010",
"software_version": "1.2.6",
"check_version_time": 1566365781,
"connect_time": 1565951330,
"active_status": 0,
"screenshot_url": "https://xxxxxxxx/IMG/IPC/e36654e8a95a9ad27b5bb585a0f7df50a0de0dd6e0aeaee47b4e34c4f4636f9a"
},
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed"
}
返回字段描述:active_status
active_status 取值 | 说明 |
---|
0 | 设备离线 |
1 | 设备在线 |
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
5501 | ipc设备不存在 |
4.3.3 修改设备名称
接口描述:通过本接口调用,用户可以修改设备名称。
请求链接:/device/ipc/updateName
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 560279010307 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 10096 |
ipc_id | 是 | string | 摄像机设备唯一ID | 549755805878 |
ipc_name | 是 | string | 修改的新设备名称 | 示例设备 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/device/ipc/updateName",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"ipc_id": "549755805878",
"ipc_name": "示例设备",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1581333970,
"random": "5dsf6698",
"sign": "140E3195C0F00DB09457E015AA79D79B"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {}
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5011 | 与设备通讯错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
5501 | ipc设备不存在 |
5506 | 数据库中未找到该ipc设备信息 |
5510 | 设备未绑定 |
4.3.4 绑定设备
接口描述:通过本接口调用,用户可以绑定指定设备。
请求链接:/device/ipc/bind
接口版本:v2.0
接口参数:
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 560279010307 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 10096 |
ipc_sn | 是 | string | 摄像机设备SN号 | C101D96U00034 |
mac | 是 | string | 摄像机设备mac地址 | 0C25766F5705 |
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/device/ipc/bind",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"ipc_sn": "C201D8BS00089",
"mac":"0C25766F5705",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1578972864,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回示例:
{
"data": {},
"code": 0,/* 其他错误参考错误列表 */
"msg": "succeed"
}
错误码:
错误码 | 说明 |
5000 | 数据库错误 |
5013 | 未找到数据 |
5020 | 无效参数 |
5041 | 请求中未找到shop_id参数 |
5079 | 无效mac地址 |
5501 | 设备不存在 |
5509 | 设备被绑定 |
4.3.5 解绑设备
接口描述:通过本接口调用,用户可以解绑指定设备。
请求链接:/device/ipc/unbind
接口版本:v2.0
接口参数:
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 560279010307 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 10096 |
ipc_sn | 否 | string | 摄像机设备SN号(ipc_sn与ipc_id有其一即可) | C101D96U00034 |
ipc_id | 否 | string | 摄像机设备唯一ID(ipc_sn与ipc_id有其一即可) | 549755805878 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/device/ipc/unbind",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"ipc_sn": "C201D8BS00089",
"ipc_id":"549755805878",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1578972864,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回示例:
{
"data": {},
"code": 0,/* 其他错误参考错误列表 */
"msg": "succeed"
}
错误码:
错误码 | 说明 |
5000 | 数据库错误 |
5013 | 未查询到数据 |
5020 | 无效参数 |
5041 | 请求中未找到shop_id参数 |
5501 | 设备不存在 |
5510 | 设备未绑定 |
4.3.6 获取商户下设备列表
接口描述:通过本接口调用,用户可以获取相关门店下所有设备列表。
请求链接:/device/ipc/getListByCompany
接口版本:v2.0
接口参数:
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_company_no | 是 | string | 商米数字商户唯一编号(v2.0之后为必填项) | 560279010307 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/device/ipc/getListByCompany",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_company_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1581333970,
"random": "5dsf6698",
"sign": "5EA14F9445D72DDE113AA95B04797D29"
}
返回值:
{
"data": {
"total_count": 1,
"ipc_list": [
{
"ipc_id": "549755811632",
"ipc_sn": "C101E96500011",
"ipc_name": "My Camera",
"model_name": "FM010",
"software_version": "1.0.0",
"active_status": 1
}
]
},
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed"
}
返回字段描述:active_status
active_status 取值 | 说明 |
---|
0 | 设备离线 |
1 | 设备在线 |
错误码:
5 人脸分组管理接口
5.1 接口描述
人脸管理接口是用来管理与人脸相关的接口,商米数字店铺会在云上保存相关已授权数据和配置,并将需要的数据同步给店内智能摄像机设备。
5.2 接口列表
接口名称 | 接口描述 |
---|
/face/group/getList | 获取人脸分组列表 |
/face/group/getInfo | 获取指定人脸分组信息 |
/face/group/create | 添加人脸分组 |
/face/group/update | 修改指定人脸分组 |
/face/group/delete | 删除指定人脸分组 |
/face/group/getFaceList | 获取指定人脸分组内的人脸列表 |
/face/getInfo | 获取指定人脸的详细信息 |
/face/add | 向指定人脸分组添加人脸信息 |
/face/update | 修改指定人脸的属性信息 |
/face/updatePicture | 修改指定人脸图片的属性信息 |
/face/delete | 从指定人脸分组中删除人脸信息 |
/face/group/move | 将指定人脸在人脸分组中迁移 |
/face/group/updateMoveStrategy | 修改生客分组移组条件 |
5.3 接口详情
5.3.1 获取人脸分组列表
接口描述:通过本接口调用,用户可以获得人脸分组列表。
请求链接:/face/group/getList
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项 ) | 560279010307 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 10096 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/face/group/getList",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"data": {
"group_list": [
{
"group_id": "578968814328",
"type": 1,
"count": 0,
"capacity": 1000,
"last_modified_time": 0,
"group_name": "stranger",
"description": "",
"customer_key1": "",
"customer_key2": "",
"customer_key3": "",
"customer_key4": "",
"customer_key5": ""
},
{
"group_id": "578968814329",
"type": 2,
"count": 0,
"capacity": 1000,
"last_modified_time": 0,
"group_name": "regular",
"description": "",
"customer_key1": "",
"customer_key2": "",
"customer_key3": "",
"customer_key4": "",
"customer_key5": ""
},
{
"group_id": "578968814330",
"type": 3,
"count": 0,
"capacity": 1000,
"last_modified_time": 0,
"group_name": "employee",
"description": "",
"customer_key1": "",
"customer_key2": "",
"customer_key3": "",
"customer_key4": "",
"customer_key5": ""
},
{
"group_id": "578968817934",
"type": 5,
"count": 0,
"capacity": 1000,
"last_modified_time": 0,
"group_name": "YiliuTest",
"description": "",
"customer_key1": "",
"customer_key2": "",
"customer_key3": "",
"customer_key4": "",
"customer_key5": ""
}
]
},
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed"
}
返回字段描述:type
type 取值 | 说明 |
---|
1 | 生客人脸库 |
2 | 熟客人脸库 |
3 | 店员人脸库 |
5 | 自定义人脸库 |
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
5.3.2 获取指定人脸分组信息
接口描述:通过本接口调用,获取指定人脸分组信息。
请求链接:/face/group/getInfo
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 560279010307 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 10096 |
group_id | 是 | string | 人脸分组唯一标识ID | 578968814328 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/face/group/getInfo",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"group_id": "578968814328",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"data": {
"group_id": "578968814328",
"type": 1,
"count": 0,
"capacity": 1000,
"last_modified_time": 0,
"group_name": "stranger",
"description": "",
"customer_key1": "",
"customer_key2": "",
"customer_key3": "",
"customer_key4": "",
"customer_key5": ""
},
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed"
}
返回字段描述:type
type 取值 | 说明 |
---|
1 | 生客人脸库 |
2 | 熟客人脸库 |
3 | 店员人脸库 |
5 | 自定义人脸库 |
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
5.3.3 添加人脸分组
接口描述:通过本接口调用,用户可以 添加人脸分组。
请求链接:/face/group/create
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 560279010307 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 10096 |
name | 是 | string | 人脸分组名称 | Mike |
type | 是· | int | 人脸分组类型 (1-生客, 2-熟客,3-店员 ,5-自定义,会员) | 5 |
capacity | 是 | int | 人脸分组容量 | 10000 |
description | 否 | string | 人脸分组描述 | 此分组用于对于金卡会员管理 |
customer_key1 | 否 | string | 人脸分组自定义扩展字段1 名称 | vip_level |
customer_key2 | 否 | string | 人脸分组自定义扩展字段2 名称 | hobby |
customer_key3 | 否 | string | 人脸分组自定义扩展字段3 名称 | foreigner |
customer_key4 | 否 | string | 人脸分组自定义扩展字段4 名称 | figure |
customer_key5 | 否 | string | 人脸分组自定义扩展字段5 名称 | hairstyle |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/face/group/create",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"name": "Mike",
"type": 5,
"capacity": 1000,
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {}
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5518 | 人脸库创建失败 |
5041 | 请求中未找到shop_id参数 |
5520 | 已经达到最大人脸分组数量或已经达到最大人脸容量 |
5523 | 已经存在该人脸分组 |
5.3.4 修改指定人脸分组
接口描述:通过本接口调用,用户可以修改指定人脸分组。
请求链接:/face/group/update
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939070408 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 15220 |
group_id | 是 | string | 人脸分组唯一标识ID | 578968817476 |
name | 否 | string | 人脸分组名称 | Mike |
capacity | 否 | int | 人脸分组容量 | 10000 |
description | 否 | string | 人脸分组描述 | 此分组用于对于金卡会员管理 |
customer_key1 | 否 | string | 人脸分组自定义扩展字段1 名称 | vip_level |
customer_key2 | 否 | string | 人脸分组自定义扩展字段2 名称 | hobby |
customer_key3 | 否 | string | 人脸分组自定义扩展字段3 名称 | foreigner |
customer_key4 | 否 | string | 人脸分组自定义扩展字段4 名称 | figure |
customer_key5 | 否 | string | 人脸分组自定义扩展字段5 名称 | hairstyle |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/face/group/update",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"name": "Mike",
"type": 5,
"capacity": 1000,
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {}
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
5506 | 未查询到该数据 |
5520 | 已经达到最大人脸分组数量或已经达到最大人脸容量 |
5525 | 默认人脸库不允许修改 |
5.3.5 删除指定人脸分组
接口描述:通过本接口调用,用户可以删除指定人脸分组。
请求链接:/face/group/delete
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 560279010307 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 10096 |
group_id | 是 | string | 人脸分组唯一标识ID | 578968814328 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/face/group/delete",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"group_id": "578968814328",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {}
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
5506 | 未查询到该数据 |
5524 | 默认人脸库不允许被删除 |
5509 | 非空人脸库 |
5.3.6 获取指定人脸分组内的人脸列表
接口描述:通过本接口调用,用户可以获取指定人脸分组内的人脸列表。
请求链接:/face/group/getFaceList
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 7948 |
group_id | 是 | string | 人脸分组唯一标识ID | 578968813726 |
page_num | 否 (默认1) | int | 当前页码 | 1 |
page_size | 否 (默认10) | int | 当前页条目数量 | 10 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/face/group/getFaceList",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"group_id": "578968813726",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"data": {
"face_list": [
{
"face_id": "578968751459",
"group_id": "578968813726",
"group_name": "",
"gender": 1,
"age_range": 6,
"arrival_count": 0,
"create_time": 1579591542,
"last_arrival_time": 0,
"name": "lll",
"customer_key1": "",
"customer_key2": "",
"customer_key3": "",
"customer_key4": "",
"customer_key5": ""
}
],
"total_num": 1
},
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed"
}
返回字段描述:gender
返回字段描述:age_range
age_range 取值 | 说明 |
---|
1 | 0~6岁 |
2 | 7~12岁 |
3 | 13~18岁 |
4 | 19~28岁 |
5 | 29~35岁 |
6 | 36~45岁 |
7 | 46~55岁 |
8 | 56~ 岁 |
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5506 | 未查询到数据 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
5.3.7 获取指定人脸的详细信息
接口描述:通过本接口调用,用户可以获取指定人脸的详细信息。
请求链接:/face/getInfo
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | stirng | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 7948 |
face_id | 是 | string | 人脸唯一标识ID | 578968751459 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/face/getInfo",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"face_id": "578968751459",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"data": {
"age_range": 6,
"arrival_count": 0,
"create_time": 1579591542,
"face_id": "578968751459",
"gender": 1,
"group_id": "578968813726",
"group_name": "stranger",
"last_arrival_time": 0,
"name": "lll"
},
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed"
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5506 | 未找到数据 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
5.3.8 向指定人脸分组添加人脸信息
接口描述:通过本接口调用,用户可以向指定人脸分组添加人脸信息。
请求链接:/face/add
接口版本:v2.0
接口参数:
Content-Type:application/form-data
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 7948 |
group_id | 是 | string | 人脸分组唯一标识ID | 578968813726 |
name | 是 | string | 人脸对应姓名 | Mike |
pic | 是 | file | 人脸对应图片文件(1M以下) | face.png |
gender | 否 | int | 人脸对应性别 (1-男性, 2 女性) | 1 |
age_range | 否 | int | 人脸对应年龄段 | 4 |
customer_value1 | 否 | string | 人脸分组自定义扩展字段1 内容 | 1 |
customer_value2 | 否 | string | 人脸分组自定义扩展字段2 内容 | sing |
customer_value3 | 否 | string | 人脸分组自定义扩展字段3 内容 | americans |
customer_value4 | 否 | string | 人脸分组自定义扩展字段4 内容 | fat |
customer_value5 | 否 | string | 人脸分组自定义扩展字段5 内容 | short hair |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/face/add",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"group_id": "578968813726",
"name": "Mike",
"pic": {
"value": fs.createReadStream("/D:/image/face.png"),
"options": {
"filename": "/D:/image/face.png",
"contentType": null
}
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {
"face_id": "578968740430"
}
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
5520 | 已经达到最大人脸分组数量或已经达到最大人脸容量 |
备注: 人脸图片添加入人脸库后,商米数字店铺平台会进行相应处理,并生成对应的face_id。由于处理图片信息需要一定时间,所以目前采用异步消息通知处理结果。
具体请参考 《消息推送中心》文档
同步处理并返回方式正在开发中。
5.3.9 修改指定人脸的属性信息
接口描述:通过本接口调用,用户可以修改指定人脸的属性信息。
请求链接:/face/update
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 7948 |
group_id | 是 | string | 人脸分组唯一标识ID | 578968813726 |
face_id | 是 | string
| 人脸唯一标识ID | 578968751459 |
name | 否 | string | 人脸对应姓名 | Mike |
gender | 否 | int | 人脸对应性别 (1 – 男, 2 – 女) | 1 |
age_range | 否 | int | 人脸对应年龄段 | 4 |
customer_value1 | 否 | string | 人脸分组自定义扩展字段1 内容 | 1 |
customer_value2 | 否 | string | 人脸分组自定义扩展字段2 内容 | sing |
customer_value3 | 否 | string | 人脸分组自定义扩展字段3 内容 | americans |
customer_value4 | 否 | string | 人脸分组自定义扩展字段4 内容 | fat |
customer_value5 | 否 | string | 人脸分组自定义扩展字段5 内容 | short hair |
字段描述:age_range
age_range 取值 | 说明 |
---|
1 | 0~6岁 |
2 | 7~12岁 |
3 | 13~18岁 |
4 | 19~28岁 |
5 | 29~35岁 |
6 | 36~45岁 |
7 | 46~55岁 |
8 | 56~ 岁 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/face/update",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"group_id": "578968813726",
"face_id": "578968751459",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {}
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
5520 | 已经达到最大人脸分组数量或已经达到最大人脸容量 |
5521 | 指定人脸分组中不存在该人脸信息 |
5.3.10 从指定人脸分组中删除人脸信息
接口描述:通过本接口调用,用户可以从指定人脸分组中删除人脸信息。
请求链接:/face/delete
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 7948 |
group_id | 是 | string | 人脸分组唯一标识ID | 578968813726 |
face_id_list | 是 | array[string] | 人脸唯一标识ID | [578968751459] |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/face/delete",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"group_id": "578968813726",
"face_id_list": ["578968751459"],
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {}
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
5.3.11 将指定人脸在人脸分组中迁移
接口描述:通过本接口调用,用户可以将指定人脸在人脸分组中迁移。
请求链接:/face/group/move
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 7948 |
source_group_id | 是 | string | 原始人脸分组唯一标识ID | 578968813726 |
target_group_id | 是 | string | 目标人脸分组唯一标识ID | 578968813727 |
face_id_list | 是 | array[string] | 需要迁移的人脸ID数组 | [578968751459] |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/face/group/move",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"source_group_id": "578968813726",
"target_group_id": "578968813727",
"face_id_list": ["578968751459"],
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {}
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
5520 | 已经达到最大人脸分组数量或已经达到最大人脸容量 |
5521 | 指定人脸分组中不存在该人脸信息 |
5522 | 人脸库不存在 |
5.3.12 修改生客分组移组条件
接口描述:通过本接口调用,用户可以修改生客库移库条件。
请求链接:/face/group/updateMoveStrategy
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 7948 |
target_group_id | 是 | string | 目标人脸分组唯一标识ID | 578968813727 |
threshold | 是 | int | 达到生客移库条件的生客出现次数 | 4 |
period | 是 | int | 达到生客移库条件的计数周期,以秒为单位 | 604800 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/face/group/updateMoveStrategy",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"target_group_id": "578968813727",
"threshold": 4,
"period": 604800,
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {}
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
5506 | 未查询到该数据 |
5520 | 已经达到最大人脸分组数量或已经达到最大人脸容量 |
5525 | 默认人脸分组的信息无法修改 |
6 人流统计接口
6.1 接口描述
人流统计接口是用来查询智能摄像机所监控和存储的人流信息和历史记录。目前分为三种统计维度:历史人流统计信息(T+1),当日人流统计信息(T+0),实时人流信息。
其中T+1和T+0的统计信息由HTTP接口提供,SaaS合作方可以通过发起请求获得结果,当日统计信息更新频率为15s内,实时人流信息通过消息推送获取,具体参考 《消息推送中心》文档
6.2 接口列表
接口名称 | 接口描述 |
---|
/passengerFlow/stat/today/getLatest | 获取当日实时人流量(实时总人流量) |
/passengerFlow/stat/today/groupByTag | 获取当日人流统计信息(按照年龄以及生熟客人脸分组) |
/passengerFlow/stat/today/groupByGender | 获取当日人流统计信息(按照年龄以及性别分组) |
/passengerFlow/stat/today/getTrendByHour | 获取当日人流变化趋势(人流总数,时间粒度为小时) |
/passengerFlow/stat/history/groupByTag | 获取历史人流统计信息(人流总数/生熟客/会员) |
/passengerFlow/stat/history/groupByGender | 获取历史客群详情(年龄以及性别) |
/passengerFlow/stat/history/getTrendByHour | 获取历史人流变化趋势(人流总数/生熟客,时间粒度为小时) |
/passengerFlow/stat/history/getTrendByDay | 获取历史人流变化趋势(人流总数/生熟客,时间粒度为天) |
/passengerFlow/stat/history/getTrendByWeek | 获取历史人流变化趋势(人流总数/生熟客,时间粒度为周)(开发中) |
/passengerFlow/stat/history/getTrendByMonth | 获取历史人流变化趋势(人流总数/生熟客,时间粒度为月)(开发中) |
/passengerFlow/stat/history/person/frequency/getList | 获取顾客到店频率分布统计数据 |
6.3 接口详情
6.3.1 获取当日实时人流量
接口描述:通过本接口调用,用户可以获取当日的人流统计。
请求链接:/passengerFlow/stat/today/getLatest
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 7948 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/passengerFlow/stat/today/getLatest",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {
"count": "123", /* 已捕捉到有效人脸数量(即将废弃) */
"total_count": 123, /* 已捕捉到有效人脸数量 */
"unexposed_count": 0, /* 未捕捉到有效人脸数量 */
"pass_count": 110 /* 过店客流数量 */
}
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
6.3.2 获取当日人流统计信息(按照生熟客人脸分组以及年龄范围)
接口描述:通过本接口调用,用户可以获取当日各个年龄段生熟客人流统计
请求链接:/passengerFlow/stat/today/groupByTag
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 7948 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/passengerFlow/stat/today/groupByTag",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"data": {
"count_list": [
{
"age_range": 1,
"stranger_count": 0, /* 生客数量 */
"regular_count": 0, /* 熟客数量 */
"member_count": 0 /* 会员数量 */
},
{
"age_range": 2,
"stranger_count": 0,
"regular_count": 0,
"member_count": 0
},
{
"age_range": 3,
"stranger_count": 0,
"regular_count": 0,
"member_count": 0
},
{
"age_range": 4,
"stranger_count": 0,
"regular_count": 0,
"member_count": 0
},
{
"age_range": 5,
"stranger_count": 0,
"regular_count": 0,
"member_count": 0
},
{
"age_range": 6,
"stranger_count": 0,
"regular_count": 0,
"member_count": 0
},
{
"age_range": 7,
"stranger_count": 0,
"regular_count": 0,
"member_count": 0
},
{
"age_range": 8,
"stranger_count": 0,
"regular_count": 0,
"member_count": 0
}
]
},
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed"
}
字段描述:age_range
age_range 取值 | 说明 |
---|
1 | 0~6岁 |
2 | 7~12岁 |
3 | 13~18岁 |
4 | 19~28岁 |
5 | 29~35岁 |
6 | 36~45岁 |
7 | 46~55岁 |
8 | 56~ 岁 |
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
6.3.3 获取当日人流统计信息(按照性别年龄)
请求链接:/passengerFlow/stat/today/groupByGender
接口描述:通过本接口调用,用户可以获取当日各个年龄段不同性别的人流统计
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 7948 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/passengerFlow/stat/today/groupByGender",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"data": {
"count_list": [
{
"age_range": 1,
"male_count": 0, /* 男性总数 */
"male_regular_count": 0, /* 男性熟客数量 */
"male_member_count": 0, /* 男性会员数量 */
"female_count": 0, /* 女性总数 */
"female_regular_count": 0, /* 女性熟客数量 */
"female_member_count": 0 /* 女性会员数量 */
},
{
"age_range": 2,
"male_count": 0,
"male_regular_count": 0,
"male_member_count": 0,
"female_count": 0,
"female_regular_count": 0,
"female_member_count": 0
},
{
"age_range": 3,
"male_count": 0,
"male_regular_count": 0,
"male_member_count": 0,
"female_count": 0,
"female_regular_count": 0,
"female_member_count": 0
},
{
"age_range": 4,
"male_count": 0,
"male_regular_count": 0,
"male_member_count": 0,
"female_count": 0,
"female_regular_count": 0,
"female_member_count": 0
},
{
"age_range": 5,
"male_count": 0,
"male_regular_count": 0,
"male_member_count": 0,
"female_count": 0,
"female_regular_count": 0,
"female_member_count": 0
},
{
"age_range": 6,
"male_count": 0,
"male_regular_count": 0,
"male_member_count": 0,
"female_count": 0,
"female_regular_count": 0,
"female_member_count": 0
},
{
"age_range": 7,
"male_count": 0,
"male_regular_count": 0,
"male_member_count": 0,
"female_count": 0,
"female_regular_count": 0,
"female_member_count": 0
},
{
"age_range": 8,
"male_count": 0,
"male_regular_count": 0,
"male_member_count": 0,
"female_count": 0,
"female_regular_count": 0,
"female_member_count": 0
}
]
},
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed"
}
字段描述:age_range
age_range 取值 | 说明 |
---|
1 | 0~6岁 |
2 | 7~12岁 |
3 | 13~18岁 |
4 | 19~28岁 |
5 | 29~35岁 |
6 | 36~45岁 |
7 | 46~55岁 |
8 | 56~ 岁 |
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
6.3.4 获取当日人流变化趋势(人流总数,时间粒度为小时)
请求链接:/passengerFlow/stat/today/getTrendByHour
接口描述:通过本接口调用,用户可以获取当日各个时间段的人流统计
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 7948 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/passengerFlow/stat/today/getTrendByHour",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"data": {
"count_list": [
{
"time": "2020-02-11 00:00",
"total_count": 0, /* 已捕捉到有效人脸数量 */
"pass_count": 110, /* 过店客流数量 */
"unexposed_count": 0 /* 未捕捉到有效人脸数量 */
},
{
"time": "2020-02-11 01:00",
"total_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2020-02-11 02:00",
"total_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2020-02-11 03:00",
"total_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2020-02-11 04:00",
"total_count": 0,
"unexposed_count": 0
},
{
"time": "2020-02-11 05:00",
"total_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2020-02-11 06:00",
"total_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2020-02-11 07:00",
"total_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2020-02-11 08:00",
"total_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2020-02-11 09:00",
"total_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2020-02-11 10:00",
"total_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2020-02-11 11:00",
"total_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2020-02-11 12:00",
"total_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2020-02-11 13:00",
"total_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2020-02-11 14:00",
"total_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2020-02-11 15:00",
"total_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2020-02-11 16:00",
"total_count": 0,
"pass_count": 110,
"unexposed_count": 0
}
]
},
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
}
字段描述:age_range
age_range 取值 | 说明 |
---|
1 | 0~6岁 |
2 | 7~12岁 |
3 | 13~18岁 |
4 | 19~28岁 |
5 | 29~35岁 |
6 | 36~45岁 |
7 | 46~55岁 |
8 | 56~ 岁 |
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
6.3.5 获取历史人流统计信息(总数/生熟客/会员)
接口描述:通过本接口调用,用户可以获取历史数据中三个主要人脸分组的人流统计
请求链接:/passengerFlow/stat/history/groupByTag
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 7948 |
start_time | 是 | string | 筛选开始时间 “YYYY-MM-DD” (如果需要查询某一天,开始和结束时间相同) | 2020-01-01 |
end_time | 是 | string | 筛选结束时间 “YYYY-MM-DD” (如果需要查询某一天,开始和结束时间相同) | 2020-01-16 |
备注:
每次接口调用, 开始时间和结束时间的区间限制为30天
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/passengerFlow/stat/history/groupByTag",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"start_time": "2020-01-01",
"end_time": "2020-01-16",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"data": {
"total_count": 0, /* 已捕捉到有效人脸数量(人次) */
"regular_count": 0, /* 熟客数量(人次) */
"stranger_count": 0, /* 生客数量(人次) */
"member_count": 0, /* 会员数量(人次) */
"uniq_total_count": 0, /* 已捕捉到有效人脸数量(去重) */
"uniq_regular_count": 0, /* 熟客数量(去重) */
"uniq_stranger_count": 0, /* 生客数量(去重) */
"uniq_member_count": 0, /* 会员数量(去重) */
"pass_count": 110, /* 过店客流数量*/
"unexposed_count": 0 /* 未捕捉到有效人脸数量 */
},
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed"
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
6.3.6 获取历史客群详情(按照年龄性别)
请求链接:/passengerFlow/stat/history/groupByGender
接口描述:通过本接口调用,用户可以获取当日各个年龄段不同性别的人流统计
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 7948 |
start_time | 是 | string | 筛选开始时间 “YYYY-MM-DD” (如果需要查询某一天,开始和结束时间相同) | 2020-01-01 |
end_time | 是 | string | 筛选结束时间 “YYYY-MM-DD” (如果需要查询某一天,开始和结束时间相同) | 2020-01-01 |
备注:
每次接口调用, 开始时间和结束时间的区间限制为30天
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/passengerFlow/stat/history/groupByGender",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"start_time": "2020-01-01",
"end_time": "2020-01-01",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"data": {
"count_list": [
{
"age_range": 1,
"male_count": 0, /* 男性总数(人次) */
"male_regular_count": 0, /* 男性熟客数量(人次) */
"male_member_count": 0, /* 男性会员数量(人次) */
"female_count": 0, /* 女性总数(人次) */
"female_regular_count": 0, /* 女性熟客数量(人次) */
"female_member_count": 0, /* 女性会员数量(人次) */
"uniq_male_count": 0, /* 男性总数(去重) */
"uniq_male_regular_count": 0, /* 男性熟客数量(去重) */
"uniq_male_member_count": 0, /* 男性会员数量(去重) */
"uniq_female_count": 0, /* 女性总数(去重) */
"uniq_female_regular_count": 0, /* 女性熟客数量(去重) */
"uniq_female_member_count": 0 /* 女性会员数量(去重) */
},
{
"age_range": 2,
"male_count": 0,
"male_regular_count": 0,
"male_member_count": 0,
"female_count": 0,
"female_regular_count": 0,
"female_member_count": 0,
"uniq_male_count": 0,
"uniq_male_regular_count": 0,
"uniq_male_member_count": 0,
"uniq_female_count": 0,
"uniq_female_regular_count": 0,
"uniq_female_member_count": 0
},
{
"age_range": 3,
"male_count": 0,
"male_regular_count": 0,
"male_member_count": 0,
"female_count": 0,
"female_regular_count": 0,
"female_member_count": 0,
"uniq_male_count": 0,
"uniq_male_regular_count": 0,
"uniq_male_member_count": 0,
"uniq_female_count": 0,
"uniq_female_regular_count": 0,
"uniq_female_member_count": 0
},
{
"age_range": 4,
"male_count": 0,
"male_regular_count": 0,
"male_member_count": 0,
"female_count": 0,
"female_regular_count": 0,
"female_member_count": 0,
"uniq_male_count": 0,
"uniq_male_regular_count": 0,
"uniq_male_member_count": 0,
"uniq_female_count": 0,
"uniq_female_regular_count": 0,
"uniq_female_member_count": 0
},
{
"age_range": 5,
"male_count": 0,
"male_regular_count": 0,
"male_member_count": 0,
"female_count": 0,
"female_regular_count": 0,
"female_member_count": 0,
"uniq_male_count": 0,
"uniq_male_regular_count": 0,
"uniq_male_member_count": 0,
"uniq_female_count": 0,
"uniq_female_regular_count": 0,
"uniq_female_member_count": 0
},
{
"age_range": 6,
"male_count": 0,
"male_regular_count": 0,
"male_member_count": 0,
"female_count": 0,
"female_regular_count": 0,
"female_member_count": 0,
"uniq_male_count": 0,
"uniq_male_regular_count": 0,
"uniq_male_member_count": 0,
"uniq_female_count": 0,
"uniq_female_regular_count": 0,
"uniq_female_member_count": 0
},
{
"age_range": 7,
"male_count": 0,
"male_regular_count": 0,
"male_member_count": 0,
"female_count": 0,
"female_regular_count": 0,
"female_member_count": 0,
"uniq_male_count": 0,
"uniq_male_regular_count": 0,
"uniq_male_member_count": 0,
"uniq_female_count": 0,
"uniq_female_regular_count": 0,
"uniq_female_member_count": 0
},
{
"age_range": 8,
"male_count": 0,
"male_regular_count": 0,
"male_member_count": 0,
"female_count": 0,
"female_regular_count": 0,
"female_member_count": 0,
"uniq_male_count": 0,
"uniq_male_regular_count": 0,
"uniq_male_member_count": 0,
"uniq_female_count": 0,
"uniq_female_regular_count": 0,
"uniq_female_member_count": 0
}
]
},
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed"
}
字段描述:age_range
age_range 取值 | 说明 |
---|
1 | 0~6岁 |
2 | 7~12岁 |
3 | 13~18岁 |
4 | 19~28岁 |
5 | 29~35岁 |
6 | 36~45岁 |
7 | 46~55岁 |
8 | 56~ 岁 |
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
6.3.7 获取历史人流变化趋势(总数/生熟客,时间粒度为小时)
请求链接:/passengerFlow/stat/history/getTrendByHour
接口描述:通过本接口调用,用户可以获取一段时间内的人流变化趋势
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | stirng | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 7948 |
start_time | 是 | string | 筛选开始时间 “YYYY-MM-DD” (如果需要查询某一天,开始和结束时间相同) | 2020-01-01 |
end_time | 是 | string | 筛选结束时间 “YYYY-MM-DD” (如果需要查询某一天,开始和结束时间相同) | 2020-01-01 |
备注:
每次接口调用, 开始时间和结束时间的区间限制为24小时
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/passengerFlow/stat/history/getTrendByHour",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"start_time": "2020-01-01",
"end_time": "2020-01-01",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"data": {
"count_list": [
{
"time": "2019-12-01 0:00",
"total_count": 0, /* 已捕捉到有效人脸数量(人次) */
"regular_count": 0, /* 熟客数量(人次) */
"stranger_count": 0, /* 生客数量(人次) */
"member_count": 0, /* 会员数量(人次) */
"uniq_total_count": 0, /* 已捕捉到有效人脸数量(去重)*/
"uniq_regular_count": 0, /* 熟客数量(去重)*/
"uniq_stranger_count": 0, /* 生客数量(去重)*/
"uniq_member_count": 0, /* 会员数量(去重)*/
"pass_count": 110, /* 过店客流数量 */
"unexposed_count": 0 /* 未捕捉到有效人脸数量 */
},
{
"time": "2019-12-01 1:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 2:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 3:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 4:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 5:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 6:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 7:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 8:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 9:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 10:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 11:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 12:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 13:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 14:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 15:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 16:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 17:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 18:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 19:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 20:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 21:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 22:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2019-12-01 23:00",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
}
]
},
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed"
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
6.3.8 获取历史人流变化趋势(总数/生熟客,时间粒度为天)
请求链接:/passengerFlow/stat/history/getTrendByDay
接口描述:通过本接口调用,用户可以获取一段时间内的人流变化趋势
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939070408 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 15220 |
start_time | 是 | string | 筛选开始时间 “YYYY-MM-DD” | 2020-01-01 |
end_time | 是 | string | 筛选结束时间 “YYYY-MM-DD” | 2020-01-03 |
备注:
每次接口调用, 开始时间和结束时间的区间限制为30天
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/passengerFlow/stat/history/getTrendByDay",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"start_time": "2020-01-01",
"end_time": "2020-01-03",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"data": {
"count_list": [
{
"time": "2020-01-01",
"total_count": 0, /* 已捕捉到有效人脸数量(人次) */
"regular_count": 0, /* 熟客数量(人次) */
"stranger_count": 0, /* 生客数量(人次) */
"member_count": 0, /* 会员数量(人次) */
"uniq_total_count": 0, /* 已捕捉到有效人脸数量(去重)*/
"uniq_regular_count": 0, /* 熟客数量(去重)*/
"uniq_stranger_count": 0, /* 生客数量(去重)*/
"uniq_member_count": 0, /* 会员数量(去重)*/
"pass_count": 110, /* 过店客流数量 */
"unexposed_count": 0 /* 未捕捉到有效人脸数量 */
},
{
"time": "2020-01-02",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
},
{
"time": "2020-01-03",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0,
"uniq_total_count": 0,
"uniq_regular_count": 0,
"uniq_stranger_count": 0,
"uniq_member_count": 0,
"pass_count": 110,
"unexposed_count": 0
}
]
},
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed"
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
6.3.9 获取历史人流变化趋势(总数/生熟客,时间粒度为周)(开发中)
请求链接:/passengerFlow/stat/history/getTrendByWeek
接口描述:通过本接口调用,用户可以获取一段时间内的人流变化趋势
接口参数:
参数名称 | 是否必须 | 类型 | 说明 |
---|
shop_id | 是 | string | SaaS对接店铺标识,SaaS厂商提供 |
start_time | 是 | string | 筛选开始时间 “YYYY-MM-DD” |
end_time | 是 | string | 筛选结束时间 “YYYY-MM-DD” |
备注:
每次接口调用, 开始时间和结束时间的区间限制为12周
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {
"count_list": [
{
"time": "2019-09-11",
"total_count": 0, /* 总数 */
"regular_count": 0, /* 熟客数量 */
"stranger_count": 0, /* 生客数量 */
"member_count": 0 /* 会员数量 */
},
{
"time": "2019-09-11",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0
}
]
}
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
6.3.10 获取历史人流变化趋势(总数/生熟客,时间粒度为月)(开发中)
请求链接:/passengerFlow/stat/history/getTrendByMonth
接口描述:通过本接口调用,用户可以获取一段时间内的人流变化趋势
接口参数:
| | | |
---|
参数名称 | 是否必须 | 类型 | 说明 |
---|
shop_id | 是 | string | SaaS对接店铺标识,SaaS厂商提供 |
start_time | 是 | string | 筛选开始时间 “YYYY-MM-DD” |
end_time | 是 | string | 筛选结束时间 “YYYY-MM-DD” |
备注:
每次接口调用, 开始时间和结束时间的区间限制为12个月
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {
"count_list": [
{
"time": "2019-01",
"total_count": 0, /* 总数 */
"regular_count": 0, /* 熟客数量 */
"stranger_count": 0, /* 生客数量 */
"member_count": 0 /* 会员数量 */
},
{
"time": "2019-12",
"total_count": 0,
"regular_count": 0,
"stranger_count": 0,
"member_count": 0
}
]
}
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
6.3.11 获取顾客到店频率分布统计数据
接口描述:通过本接口调用,用户可以获取顾客到店频率分布情况
请求链接: /passengerFlow/stat/history/person/frequency/getList
接口版本:v2.0
接口参数:
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
sunmi_shop_no | 是 | string | 商米数字店铺平台唯一编号 | 560279010307 |
start_time | 是 | string | 筛选开始时间 “YYYY-MM-DD” (如果需要查询某一天,开始和结束时间相同) | 2020-01-01 |
end_time | 是 | string | 筛选结束时间 “YYYY-MM-DD” (如果需要查询某一天,开始和结束时间相同,end_time日期需要小于当前日期) | 2020-01-16 |
- 每次接口调用, 开始时间和结束时间的区间限制为30天
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/passengerFlow/stat/history/person/frequency/getList",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"start_time": "2020-01-01",
"end_time": "2020-01-16",
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 1,
"msg": "",
"data": {
"frequency_list": [{
"frequency": 1, /*到店频次*/
"stranger_uniq_count": 76, /*生客数量(去重)*/
"regular_uniq_count": 4, /*熟客数量(去重)*/
"member_uniq_count": 0 /*会员数量(去重)*/
}, {
"frequency": 2,
"stranger_uniq_count": 13,
"regular_uniq_count": 2,
"member_uniq_count": 0
}, {
"frequency": 3,
"stranger_uniq_count": 5,
"regular_uniq_count": 2,
"member_uniq_count": 0
}, {
"frequency": 4,
"stranger_uniq_count": 5,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 5,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 6,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 7,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 8,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 9,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 10,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 11,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 12,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 13,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 14,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 15,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 16,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 17,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 18,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 19,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 20,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 21,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 22,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 23,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 24,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 25,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 26,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 27,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 28,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 29,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 30,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 31,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 32,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 33,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 34,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 35,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 36,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 37,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 38,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 39,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 40,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 41,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 42,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 43,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 44,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 45,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 46,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 47,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 48,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 49,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}, {
"frequency": 50,
"stranger_uniq_count": 0,
"regular_uniq_count": 0,
"member_uniq_count": 0
}]
}
}
错误码:
错误码 | 说明 |
5025 | 时间参数错误 |
5041 | 请求中未找到shop_id参数 |
7 直播回放接口
7.1 接口描述
直播回放接口是用来查看实时和历史视频数据的接口。
7.2 接口列表
接口名称 | 接口描述 |
---|
/media/live/start | 开始远程直播 |
/media/live/stop | 结束远程直播 |
/media/playback/start | 开始远程回放 |
/media/playback/stop | 结束远程回放 |
/media/video/getList | 获取回放视频列表 |
/media/motionDetection/getList | 获取动态侦测视频列表 |
/media/playback/getSnapshot | 获取指定时间的监控图片 |
/media/live/getSnapshot | 获取实时监控图片 |
7.3 接口详情
7.3.1 开始远程直播
接口描述:通过本接口调用,用户可以开始远程直播。
请求链接:/media/live/start
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可 | 10087 |
ipc_id | 是 | string | 摄像机设备唯一ID | 549755805835 |
resolution | 是 | int | 分辨率 | 0 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/media/live/start",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"ipc_id": "549755805835",
"resolution": 0,
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed"
"data": {
"url": "https://xxxxxxxx/C101P98200023/1219130724381102080.flv?auth_key=1579501989-729716105000265001016467621435-0-",
"hls_url": "https://xxxxxxxx/C101P98200023/1219130724381102080.m3u8?auth_key=1579501989-729716105000265001016467621435-0-"
}
}
字段描述:resolution
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5011 | 与设备通讯错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
5501 | ipc设备不存在 |
5510 | 设备未绑定 |
7.3.2 结束直播
接口描述:通过本接口调用,用户可以结束远程直播。
请求链接:/media/live/stop
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 10087 |
ipc_id | 是 | string | 摄像机设备唯一ID | 549755805835 |
resolution | 是 | int | 分辨率 | 0 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/media/live/stop",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"ipc_id": "549755805835",
"resolution": 0,
"timestamp": 1581383983,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {}
}
字段描述:resolution
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5011 | 与设备通讯错误 |
5041 | 请求中未找到shop_id参数 |
5501 | ipc设备不存在 |
5510 | 设备未绑定 |
7.3.4 获取回放视频列表
接口描述:通过本接口调用,用户可以获取回放视频列表。
请求链接:/media/video/getList
接口版本:v2.0
接口参数:
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | SaaS对接店铺标识,SaaS厂商提供 | 10087 |
ipc_id | 是 | string | 摄像机设备唯一ID | 549755805835 |
start_time | 是 | int | 开始查询时间,Unix时间戳,秒级别 | 1578969264 |
end_time | 是 | int | 结束查询时间,Unix时间戳,秒级别 | 1578972864 |
备注:
start_time与end_time时间区间限制为3600s
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/media/video/getList",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"ipc_id": "549755805835",
"start_time": 1578969264,
"end_time": 1578969264,
"timestamp": 1578972864,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {
"total_count": 1,
"video_list": [{
"ipc_id": "549755812970",
"url": "http: //xxxxxxxx/VIDEO/IPC/SS101D8BS00087/39C1045AF2EA34B0CEA528FB228C8EDA",
"start_time": 1551854897,
"end_time": 1551854958
}]
}
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5021 | 非法参数(时间区间超限) |
5041 | 请求中未找到shop_id参数 |
7.3.5 获取动态侦测视频列表
接口描述:通过本接口调用,用户可以获取回放视频列表。
请求链接:/media/motionDetection/getList
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | stirng | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 10087 |
ipc_id | 是 | string | 摄像机设备唯一ID | 549755805835 |
start_time | 是 | int | 开始查询时间,Unix时间戳,秒级别 | 1578969264 |
end_time | 是 | int | 结束查询时间,Unix时间戳,秒级别 | 1579055640 |
page_num | 否(默认1) | int | 当前页码 | 1 |
page_size | 否(默认10) | int | 当前页条目数量 (最大条目数量为100) | 10 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/media/motionDetection/getList",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"ipc_id": "549755805835",
"start_time": 1578969264,
"end_time": 1579055640,
"timestamp": 1578972864,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {
"total_num": 1,
"video_list": [{
"source": "1",
"detect_time": 1551854897,
"url": "http: //xxxxxxxx/VIDEO/IPC/SS101D8BS00087/39C1045AF2EA34B0CEA528FB228C8EDA"
}]
}
}
字段描述:source
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
7.3.6 获取指定时间的监控图片
接口描述:通过本接口调用,用户可以获取指定时间的监控图片。
请求链接:/media/playback/getSnapshot
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 15220 |
ipc_id | 是 | string | 摄像机设备唯一ID | 549755812970 |
time | 是 | int | 截图时间,Unix时间戳,秒级别 | 1579055640 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/media/playback/getSnapshot",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"ipc_id": "549755805835",
"time": 1579055640,
"timestamp": 1578972864,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {
"snapshot_url":"http://xxxxxxxx/VIDEO/IPC/SS101D8BS00087/39C1045AF2EA34B0CEA528FB228C8EDA"
}
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
7.3.7 获取实时监控图片
接口描述:通过本接口调用,用户可以获取实时监控图片, 图片有效期为一天。
请求链接:/media/live/getSnapshot
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项 ) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 10087 |
ipc_id | 是 | string | 摄像机设备唯一ID | 549755805835 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/media/live/getSnapshot",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"ipc_id": "549755805835",
"timestamp": 1578972864,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data":{
"snapshot_url":"http://xxxxxxxx/VIDEO/IPC/SS101D8BS00087/39C1045AF2EA34B0CEA528FB228C8EDA"
}
}
错误码:
错误码 | 说明 |
---|
5000 | 数据库错误 |
5011 | 与设备端通讯错误 |
5013 | 未找到数据 |
5041 | 请求中未找到shop_id参数 |
5501 | ipc设备不存在 |
5510 | 设备未绑定 |
5515 | 超出截图时常 |
7.3.8 开始远程回放
接口描述: 通过本接口调用,用户可以开始远程回放。
请求链接: /media/playback/start
接口版本:v2.0
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
sunmi_shop_no | 否 | string | 商米数字店铺平台唯一编号(v2.0之后为必填项) | 100939020409 |
shop_id | 否 | string | 店铺在SaaS体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 10087 |
ipc_id | 是 | string | 摄像机设备唯一ID | 549755805835 |
start_time | 是 | int | 开始查询时间,Unix时间戳,秒级别 | 1578969264 |
end_time | 是 | int | 结束查询时间,Unix时间戳,秒级别 | 1579055640 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/media/playback/start",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"app_id": "LMWWQVTW4QGCC",
"ipc_id": "549755805835",
"start_time": 1578969264,
"end_time": 1579055640,
"timestamp": 1578972864,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {
"url": "https://xxxxxxxx/SAAS-OpenAPI_1211497245552152576/1577092646.flv?auth_key=1577096246-57626095498907571693914212321441-0-",
"hls_url": "https://xxxxxxxx/SAAS-OpenAPI_1211497245552152576/1577092646.flv?auth_key=1577096246-57626095498907571693914212321441-0-",
"client_id": "SAAS-OpenAPI_1211497245552152576"
}
}
错误码:
错误码 | 说明 |
---|
5021 | 非法参数(时间区间超限) |
5041 | 请求中未找到shop_id参数 |
5087 | 无匹配数据 |
5088 | 数据库错误 |
5506 | 未查询到数据 |
7.3.9 结束远程回放
接口描述: 通过本接口调用,用户可以开始远程回放。
请求链接: /media/playback/stop
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
client_id | 是 | string | 用户client id | SAAS-OpenAPI_1211497245552152576 |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/media/playback/stop",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"client_id": "SAAS-OpenAPI_1211497245552152576",
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1578972864,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
"code": 0, /* 其他错误参考错误列表 */
"msg": "succeed",
"data": {}
}
错误码:
8 消息推送
8.1 接口描述
商米数字店铺平台可以在接收到设备相关消息后,根据合作平台需求订阅实时消息推送,将消息和事件推送给SaaS合作方。
8.2 接口列表
参考 《消息推送中心》文档
9 智能摄像机对接示范
9.1 店铺对齐
请参考《商米数字店铺开放平台 – > 商户店铺》 章节将用户在商米数字店铺上创建的门店与Saas合作伙伴平台上的同一家门店绑定对齐,之后的所有操作都是基于该门店内的设备和数据进行
9.2 设备配网
如果您的设备是通过有线连入互联网,则可以跳过该步骤。
如果您的设备通过无线网络连入互联网,请按照以下步骤使用android SDK进行配网。(对于其它操作系统或者设备,您也可以直接调用设备API进行配网)
如果设备上的蓝灯常亮,表明设备联网成功。
如果设备上显示为绿灯,则说明网络连接异常。
9.3 设备绑定
9.3.1 接口绑定(开发中)
IPC设备连入网络后,调用设备绑定接口 /device/ipc/bind 将设备绑定到指定店铺内。
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/device/ipc/bind",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "560279010307",
"ipc_sn": "C201D8BS00089",
"app_id": "LMWWQVTW4QGCC",
"mac":"0C25766F5705",
"timestamp": 1578972864,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
9.3.2 store页面绑定
通过下载商米助手,打开商米助手app页面,输入对应账号密码登录到已经对齐的门店下面。
到对应店铺下点击设备,添加设备,选择设备类型,这时接通摄像机电源,电源接通后,等待约20秒,摄像机指示灯呈[绿灯闪烁]后,点击下一步。
选择网络连接方式,有线网络连接和无线网路连接两种方式:
(1)有线网络连接需要为摄像机插入网线,并将手机连接至同一网络后点击下一步,待摄像机信号灯呈[蓝色常亮]状态后,点击下一步,找到对应的ipc设备即可绑定。
(2)无线网络连接需要将手机连接至摄像机得无线网络[SUNMI_XXXX](可以在机身或包装盒上找到),点击下一步,找到对应得ipc设备即可绑定。
添加成功之后,用户可以在手机和web上看到新添加的ipc设备。
9.4 设备配置
9.4.1 接口修改调焦(开发中)
在设备绑定之后,用户可以调用接口修改设备的调焦。
9.4.2 store页面设置进店划线
对于FS摄像机,用户需要首先设置进店划线。
打开商米助手app,输入账号密码进入对应门店,点击设备,然后点击屏幕右上角三个小点的图标进入摄像机设置,该页面点击调整画面。
这时画面会提示”请安排人员面向摄像机,站在需要识别人脸的位置”,然后点击屏幕右上角下一步,提示”调整画面大小并移动人脸框的位置,使人脸刚好填充整个人脸框”,这时相机会自动调整画面,然后提示”为保证识别精准性,您还可以移动已设置好的进店门槛线位置或拖拽门槛线端点更改门槛线的长度”,这是您可以手动在手机屏幕上划线来设置进店门槛的位置,然后点击完成即可。
9.5 查看直播
接口列表
详情可查看第7章直播回放接口
| |
---|
接口名称 | 接口描述 |
---|
/media/live/start | 开始远程直播 |
/media/live/stop | 结束远程直播 |
/media/playback/start | 开始远程回放 (开发中) |
/media/playback/stop | 结束远程回放 (开发中) |
/media/video/getList | 获取回放视频列表 |
/media/motionDetection/getList | 获取动态侦测视频列表 |
/media/playback/getSnapshot | 获取指定时间的监控图片 |
/media/live/getSnapshot | 获取实时监控图片 |
9.6 客流统计
接口列表
详情可查看第6章人流统计接口
| |
---|
接口名称 | 接口描述 |
---|
/passengerFlow/stat/today/getLatest | 获取当日实时人流量(实时总人流量) |
/passengerFlow/stat/today/groupByTag | 获取当日人流统计信息(按照年龄以及生熟客人脸分组) |
/passengerFlow/stat/today/groupByGender | 获取当日人流统计信息(按照年龄以及性别分组) |
/passengerFlow/stat/today/getTrendByHour | 获取当日人流变化趋势(人流总数,时间粒度为小时) |
/passengerFlow/stat/history/groupByTag | 获取历史人流统计信息(人流总数/生熟客/会员) |
/passengerFlow/stat/history/groupByGender | 获取历史客群详情(年龄以及性别) |
/passengerFlow/stat/history/getTrendByHour | 获取历史人流变化趋势(人流总数/生熟客,时间粒度为小时) |
/passengerFlow/stat/history/getTrendByDay | 获取历史人流变化趋势(人流总数/生熟客,时间粒度为天) |
/passengerFlow/stat/history/getTrendByWeek | 获取历史人流变化趋势(人流总数/生熟客,时间粒度为周)(开发中) |
/passengerFlow/stat/history/getTrendByMonth | 获取历史人流变化趋势(人流总数/生熟客,时间粒度为月)(开发中) |
9.7 实时获取进店 FaceID
请参考《商米数字店铺开放平台 – > 消息中心》 章节用户需要先添加消息监听地址, 用户将自己平台的相关HTTP地址添加到商米数字开放平台,并提供需要监听的设备以及 IPC实时获取人员消息事件就可以实时获取进店FaceID。
9.7.1 增加消息监听
接口描述: 通过本接口调用,用户可以增加消息监听的HTTP回调地址。 用户将自己平台的相关HTTP地址通过该接口添加到商米数字开放平台;并提供需要监听的设备以及事件。当商米数字开放平台收到该设备的该事件时,会调用该HTTP接口。
对于该回调HTTP回调的鉴权方式,遵照商米数字店铺开放平台的鉴权方式。
回调HTTP需要带以下接口参数:
参数名称 | 是否必须 | 类型 | 说明 |
sunmi_shop_no | 是 | string | 商米数字店铺的门店唯一标识,由商米数字店铺生成 |
shop_id | 是 | string | SaaS对接店铺标识,SaaS厂商提供 |
event | 是 | int | 触发消息的类型 |
payload | 是 | string | 消息的具体格式(根据消息不同会有不同的json) |
请求链接: /hook/add
接口参数:
| | | | |
---|
参数名称 | 是否必须 | 类型 | 说明 | 示例 |
---|
| | | | |
sunmi_shop_no
| 否 | string | 商米数字店铺平台门店唯一编号(v2.0之后为必填项)
| 100939070408 |
shop_id | 否 | string | 店铺在SaaS软件体系下的唯一标识(此参数为后向兼容v2.0之前版本的字段,在v2.0及以后版本使用sunmi_shop_no替代,作为门店唯一标识即可) | 15220 |
http_callback | 是 | string | HTTPS回调地址链接 | http://xxxxxxxx/api/testHook |
event_list | 是 | array[int] | 需要监听的事件的列表 | [2001] |
请求示例:
"method": "POST",
"url": "https://store.uat.sunmi.com/openapi/hook/add",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
formData: {
"sunmi_shop_no": "100939070408",
"http_callback": "http://xxxxxxxx/api/testHook",
"event_list": [2001],
"app_id": "LMWWQVTW4QGCC",
"timestamp": 1578972864,
"random": "5dsf6698",
"sign": "33C18A18282733A71F998BB5A5E4319D"
}
返回值:
{
code:0, /* 其他错误参考错误列表 */
msg: "succeed",
data: {}
}
字段描述: event
event 取值 | 说明 |
---|
1101 | 通过订单时间获取一段时间内人脸列表 |
2001 | IPC实时获取人员消息 |
payload(event=1101):
{
"order_id": "T929321362467651",
"purchase_time": 1594266755,
"face_list": [{
"face_id": 1,
"gender": 1,
"age_range": 3,
"group_type": 2
}, {
"face_id": 3,
"gender": 2,
"age_range": 5,
"group_type": 1
}]
}
payload(event=2001):
{
ipc_id: "928",
face_id: "29195",
gender: 1,
age_range: 4,
group_id: "8927",
group_name: "stranger",
group_type": 2
}
返回字段描述 : gender
字段描述 : age_range
age_range取值 | 说明 |
1 | 0~6岁 |
2 | 7~12岁 |
3 | 13~18岁 |
4 | 19~28岁 |
5 | 29~35岁 |
6 | 36~45岁 |
7 | 46~55岁 |
8 | 56~ 岁 |
返回字段描述: group_type
group_type取值 | 说明 |
1 | 生客人脸库 |
2 | 熟客人脸库 |
3 | 店员人脸库 |
4 | 黑名单人脸库 |
5 | 自定义人脸库 |
附录
更新记录
更新日期 | 更新内容 |
---|
2019-07-07 | 初版草稿 |
2019-07-17 | 暂时在所有接口中去除company_id字段,以shop_id作为唯一的门店对齐和标识,简化接口 |
2019-08-08 | 调整部分函数接口返回值 |
2019-08-23 | 更新通知接口 |
2020-04-01 | 取消开始远程回放与结束远程回放的“开发中”状态 |
2020-04-14 | 设备信息中添加connect_time |
2020-04-20 | 添加错误码 5518: 人脸库创建失败 |
2020-07-15 | 添加新hook event 1101 |
2020-09-07 | T+1人流数据添加UV统计字段 |
2020-09-14 | 更新绑定与解绑接口 |
(开发中)