Koala API V3.1.0

  • Online-权限接口
    • 登出[api]
    • 登录
  • Online-系统管理
    • 删除单个门禁设备
    • 新建门禁设备
    • 更新单个门禁设备
    • 获取单个门禁设备
    • 获取所有主机
    • 获取门禁设备列表
  • Online-识别记录
    • 删除单个识别记录
    • 历史记录遍历接口
    • 识别记录列表
    • 识别记录批量删除
  • Online-员工管理
    • 上传人员底库
    • 人员列表
    • 人员头像
    • 入库图片质量检查
    • 创建用户
    • 创建用户同时上传底库
    • 删除subject底库
    • 删除单个subject数据
    • 更新单个subject数据
    • 获取单个subject数据
  • Online-考勤管理
    • 考勤记录
  • Online-综合管理
    • 首页综合统计接口
  • Online-门禁分组
    • 获取门禁分组列表
    • 获取门禁组以及所属门禁
    • 创建门禁分组
    • 更新门禁分组
    • 删除门禁分组
    • 添加门禁到门禁分组
    • 从门禁分组中删除门禁
  • Online-人员分组
    • 获取人员分组列表
    • 获取人员组以及所属人员
    • 创建人员分组
    • 更新人员分组
    • 添加人员到人员分组
    • 从人员分组中删除人员
  • Online-门禁权限
    • 创建门禁设置
    • 删除门禁设置
    • 更新门禁设置
    • 获取门禁设置列表
  • Online-门禁时段&假日管理
    • 获取时段列表
    • 创建时段规则
    • 更新时段规则
    • 删除时段规则
    • 获取假日列表
    • 创建假日规则
    • 更新假日规则
    • 删除假日规则
  • 主机-系统管理
    • 主机NTP客户端控制
    • 主机NTP客户端配置
    • 回调抓拍图状态
    • 设置回调地址
  • 主机-识别
    • 1比1认证
    • 动态 1:1 接口
    • 识别结果获取
    • 静态1比N识别
  • 错误码定义

Koala API V3.1.0

发布日期: 2019-07-29

Online-权限接口

登出[api]

基本信息

Path: /api/v2/auth

Method: DELETE

Tag: open

接口描述:

退出登录接口,属于api v2。
与旧版/auth/logout相比,http方法切换为delete, 并且最后不在有redirect操作。

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/x-www-form-urlencoded 是

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
page object 否

登录

基本信息

Path: /auth/login

Method: POST

Tag: open,Koala3.1.0

接口描述:

登录并获取cookie,后面所有的接口都需要在请求时带入此cookie。
为更好的支持前后端分离,添加auth_token参数,系统支持header内传入auth_token来进行登录操作。

如果做为接口使用,此接口需要设置user-agent为 "Koala Admin", 否则不能登录成功
请用公司业务账户登陆,不要用admin@megvii.com账号登陆。

使用token请求头实例:头部新增参数:Authorization

Accept: application/json
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7
Authorization: e3f14076-571e-4243-b315-bbc4d34547d4
Cache-Control: no-cache
Connection: keep-alive
Cookie: session=b16dfe26-28ed-468b-8ed3-bbb2b4c3eb95
Host: dev.com:8867
Pragma: no-cache
Referer: http://dev.com:8867/api/v2/swagger/doc?_debug_mode=True
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

Body

名称 类型 是否必须 备注 示例 其他信息
username string 是 用户名,长度:64
captchas string 否 验证码
auth_token string 否 是否返回token
password string 是 密码

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ lang string 否
├─ username string 否
├─ password_reseted boolean 否
├─ permission array 否 array[string]
├─ verify boolean 否
├─ company object 否
├─ lang string 否
├─ remark string 否
├─ door_weekdays array 否 array[number]
├─ door_range array 否 array[array]
├─ name string 否
├─ notdetermined_on boolean 否
├─ logo string 否
├─ scenario string 否
├─ attendance_on boolean 否
├─ upload boolean 否
├─ id number 否
├─ feature_version number 否
├─ data_version number 否
├─ create_time number 否
├─ deployment number 否
├─ lang_code string 否
├─ attendance_weekdays array 否 array[number]
├─ consigner string 否
├─ full_day boolean 否
├─ fmp_on boolean 否
├─ yellowlist_warn boolean 否
├─ company_id number 否
├─ role_id number 否
├─ organization_id null 否
├─ avatar string 否
├─ lang_code string 否
├─ id number 否
page object 否

Online-系统管理

删除单个门禁设备

基本信息

Path: /system/screen/{sid}

Method: DELETE

Tag: open,Koala3.1.0

接口描述:

删除单个门禁设备

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/x-www-form-urlencoded 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
sid 否 Screen id,类型:Integer

返回数据

Body

{
   "code": 0,
   "data": {
      "box_address": null,
      "box_heartbeat": null,
      "box_id": null,
      "box_status": "1",
      "box_token": null,
      "camera_address": "8.7.6.5",
      "camera_name": null,
      "camera_position": "backdoor",
      "camera_status": "1",
      "description": null,
      "group_id": null,
      "group_name": "",
      "id": 16,
      "is_select": 0,
      "network_switcher": null,
      "network_switcher_drive": 1,
      "network_switcher_status": null,
      "network_switcher_token": null,
      "screen_token": "6daba724-e024-4efd-a091-0e368f005366",
      "type": 1
   },
   "page": {}
}

新建门禁设备

基本信息

Path: /system/screen

Method: POST

Tag: open,Koala3.1.0

接口描述:

新建一个视频流门禁设备
当box_token和box_id同时传入的时候,会优先使用box_id
当box_token并且box_id==""的时候会使用box_token

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

Body

名称 类型 是否必须 备注 示例 其他信息
network_switcher_drive number 否 开关类型
box_id number 否 绑定主机id
box_token string 否 绑定主机的token,长度:128
description string 否 描述,长度:128
network_switcher string 否 开关地址,长度:128
camera_name string 否 名称,长度:64
network_switcher_token string 否 开关token,长度:128
camera_address string 是 视频流地址,长度:4096
group_id number 否 门禁分组的id
camera_position string 是 位置,长度:128

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ network_switcher_status null 否 开关状态
├─ box_id string 否 主机id
├─ box_token string 否 主机token
├─ description null 否 描述
├─ box_heartbeat number 否 主机心跳
├─ network_switcher string 否 开关地址
├─ screen_token string 否 门禁设备token
├─ camera_name string 否 名称
├─ camera_status null 否 状态
├─ camera_position string 否 位置
├─ box_status string 否 主机状态
├─ network_switcher_token null 否 开关token
├─ box_address string 否 主机地址
├─ is_select number 否 是否绑定主机
├─ network_switcher_drive number 否 开关类型
├─ type number 否 门禁设备类型
├─ id number 否
├─ camera_address string 否 视频流地址
page object 否

更新单个门禁设备

基本信息

Path: /system/screen/{sid}

Method: PUT

Tag: open,Koala3.1.0

接口描述:

更新一个门禁设备,参数长度参照新建门禁设备,参数都为非必须,但操作至少需要有一个参数

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
sid 否 Screen id,类型:Integer

Body

名称 类型 是否必须 备注 示例 其他信息
network_switcher_drive number 否 开关类型
box_id number 否 绑定主机id
description string 否 描述
network_switcher string 否 开关地址
camera_name string 否 名称
network_switcher_token string 否 开关token
camera_address string 否 视频流地址
is_select number 否 是否绑定主机
group_id number 否 分组id
camera_position string 否 位置

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ network_switcher_status null 否 开关状态
├─ box_id string 否 主机id
├─ box_token string 否 主机token
├─ description null 否 描述
├─ box_heartbeat number 否 主机心跳
├─ network_switcher string 否 开关地址
├─ screen_token string 否 门禁设备token
├─ camera_name string 否 名称
├─ camera_status null 否 状态
├─ camera_position string 否 位置
├─ box_status string 否 主机状态
├─ network_switcher_token null 否 开关token
├─ box_address string 否 主机地址
├─ is_select number 否 是否绑定主机
├─ network_switcher_drive number 否 开关类型
├─ type number 否 门禁设备类型
├─ id number 否
├─ camera_address string 否 视频流地址
page object 否

获取单个门禁设备

基本信息

Path: /system/screen/{sid}

Method: GET

Tag: open,Koala3.1.0

接口描述:

使用screen.id获取一个特定设备信息

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

路径参数

名称 类型 是否必须 备注 示例 其他信息
sid 否 Screen id,类型:Integer

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ network_switcher_drive number 否 开关类型
├─ network_switcher_status null 否 开关状态
├─ box_id number 否 主机id
├─ box_token string 否 主机token
├─ description null 否 描述
├─ box_heartbeat number 否 主机心跳时间
├─ network_switcher string 否 开关地址
├─ screen_token string 否 设备token
├─ camera_name string 否 名称
├─ camera_status string 否 摄像头状态
├─ camera_position string 否 位置
├─ box_status string 否 主机状态
├─ group_name string 否 组名字
├─ network_switcher_token null 否 开关token
├─ box_address string 否 主机ip
├─ is_select number 否 是否估计主机
├─ group_id number 否 组id
├─ type number 否 设备类型
├─ id number 否 设备id
├─ camera_address string 否 视频流地址
page object 否

获取所有主机

基本信息

Path: /system/boxes

Method: GET

Tag: open,Koala3.1.0

接口描述:

获取所有可用本地主机
screen内type字段含义:

  • 1: 摄像头
  • 2: 门禁pad
  • 3: 前台pad
  • 4: 云离线pad

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data array 否 array[object]
├─ leaf_config object 否 固件配置
├─ verify number 否
├─ yaw number 否
├─ blurriness number 否
├─ fmp number 否
├─ unthreshold number 否
├─ facemin number 否
├─ pitch number 否
├─ threshold number 否
├─ roll number 否
├─ model number 否 模型版本
├─ box_token string 否 主机token
├─ dog_expiration string 否 加密狗过期时间
├─ company_id number 否 公司ID
├─ facemin number 否
├─ status string 否
├─ box_address string 否 主机地址
├─ heartbeat number 否 心跳时间戳
├─ all_screens array 否 主机绑定的所有screen array[object]
├─ network_switcher_status string 否 开关状态
├─ box_id number 否 绑定主机id
├─ box_token string 否 绑定主机token
├─ description string 否 描述
├─ box_heartbeat number 否 绑定主机心跳
├─ network_switcher string 否 开关地址
├─ screen_token string 否 设备token
├─ camera_name [u'string', u'null'] 否 名称
├─ camera_status string 否 状态
├─ camera_position string 否 位置
├─ box_status string 否 绑定主机状态
├─ network_switcher_token string 否 开关token
├─ box_address string 否 绑定主机地址
├─ is_select number 否 门禁机是否固定选中
├─ network_switcher_drive number 否 开关类型
├─ type number 否 类型:
├─ id number 否
├─ camera_address string 否 视频地址
├─ current_version string 否 local版本
├─ firmware_version string 否 固件版本
├─ id number 否
page object 否

获取门禁设备列表

基本信息

Path: /system/screen

Method: GET

Tag: open,Koala3.1.0

接口描述:

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

Query

名称 类型 是否必须 备注 示例 其他信息
device_name 否 设备位置或者设备地址 d
box_token 否 主机token token
device_status 否 设备状态: 1正常, 0故障 1
group_id 否 组id,可选值:-1全部,0未分组,对应组id
page 否 页数,默认:1
size 否 每页的条数,默认:500

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data array 否 array[object]
├─ network_switcher_drive number 否 开关类型
├─ network_switcher_status null 否 开关状态
├─ box_id number 否 主机id
├─ box_token string 否 绑定主机token
├─ description null 否
├─ box_heartbeat number 否 绑定主机心跳时间
├─ network_switcher null 否 开关地址
├─ screen_token string 否 设备token
├─ camera_name null 否 名称
├─ camera_status string 否 camera状态
├─ camera_position string 否 位置
├─ box_status string 否 绑定主机状态
├─ group_name string 否 组名
├─ network_switcher_token null 否 开关token
├─ box_address null 否 绑定主机地址
├─ is_select number 否 是否选定主机
├─ server_time number 否 系统时间
├─ group_id number 否 所属组id
├─ type number 否 类型
├─ id number 否 设备id
├─ camera_address null 否 地址
page object 否
├─ count number 否
├─ current number 否
├─ total number 否
├─ size number 否

Online-识别记录

删除单个识别记录

基本信息

Path: /event/events/{eid}

Method: DELETE

Tag: open,Koala3.1.0

接口描述:

删除单个识别记录,返回被删除的数据。

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/x-www-form-urlencoded 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
eid 否 类型:Integer 1

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ confidence number 否
├─ fmp_error boolean 否
├─ group number 否
├─ event_type number 否
├─ timestamp number 否
├─ gender number 否
├─ age number 否
├─ company_id number 否
├─ fmp number 否
├─ subject_id null 否
├─ photo string 否
├─ quality number 否
├─ id number 否
├─ uuid null 否
page object 否

历史记录遍历接口

基本信息

Path: /event/scan

Method: POST

Tag: open,Koala3.1.0

接口描述:

接口使用

首次使用

需要参数
  • event_type: 事件类型:默认全部类型记录,0:识别记录,1:未识别记录,2:密码开门
  • subject_tpe: 人员类型: 0:员工,1:访客(此接口包含vip),2:vip访客, 3:黄名单,100:陌生人
  • limit: 想要获取数据数量: 默认100, 最大不超过5000

再次使用

首次调用接口后会在结果中返回cursor来用于下次请求

需要参数
  • cursor: 游标参数,每次请求都会返回,下次请求需要使用上次请求返回的数据内的cursor
  • limit: 数量限制,每次都需要传入

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/x-www-form-urlencoded 是

Body

名称 类型 是否必须 备注 示例 其他信息
event_type text 否 记录类型: 0:识别记录,1:为识别记录,2:密码开门 0
subject_type text 否 类型: 0:员工,1:访客(此接口包含vip),2:vip访客, 3:黄名单,100:陌生人 0
cursor text 否 base64字符串 a29hbGFfLTFfLTFfODI5Nzc=\n
limit text 否 数量限制,不能大于5000 100

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ count number 否
├─ cursor string 否
├─ events array 否 array[object]
├─ confidence number 否
├─ fmp_error boolean 否
├─ group number 否
├─ event_type number 否
├─ timestamp number 否
├─ gender number 否
├─ age number 否
├─ company_id number 否
├─ fmp number 否
├─ subject_id null 否
├─ photo string 否
├─ screen object 否
├─ camera_position string 否
├─ quality number 否
├─ id number 否
├─ uuid null 否
page object 否

识别记录列表

基本信息

Path: /event/events

Method: GET

Tag: open,Koala3.1.0

接口描述:

获取识别记录列表

员工页面获取确定员工识别记录如: /event/events?subject_id=100248&size=5&_=1558319105303

  • event_type
    • 0:识别
    • 1:未识别
    • 2:密码开门
  • start 开始时间戳
  • end 结束时间戳
  • user_role subject和event_type合体过滤参数
    • 0: 员工
    • 1: 普通访客
    • 2: vip访客
    • 3: 黄名单
    • 4: 未识别类型数据,即event_type=1
  • category 分类
    • user: event_type 包括1, 0
    • warning: 陌生人
    • visitor: subject_type: 1: 普通访客
    • fmp: fmp_error = 1
    • yellowlist: subject_type: 3: 黄名单
    • 其他: subject_type: -1
  • screen_id 相机id,即搜索只能是现在未删除的相机
  • user_name 用户姓名
  • subject_id 用户id
  • page 页码
  • size 页内数据容量,最大不超过1000

返回结果中:
screen数据删除的情况下,只有camera_position字段,即前端显示使用,未删除情况下会更多screen字段,但是前端未使用。

{
	"allow_all_subjects": true,
	"allow_visitor": true,
	"box_address": "10.169.0.62",
	"box_heartbeat": 1557728671,
	"box_status": "0",
	"box_token": "b2790046-5250-4d78-a46f-d921a7bb4bec",
	"camera_address": "10.169.0.94",
	"camera_name": null,
	"camera_position": "15",
	"camera_status": "0",
	"description": null,
	"id": 16,
	"is_select": 0,
	"network_switcher": null,
	"network_switcher_drive": 1,
	"network_switcher_status": null,
	"network_switcher_token": null,
	"screen_token": "61a1f5fba371257a",
	"type": 2
}

subject数据删除情况,只有avatar, name, subject_type字段,同样也是前端显示需要的,未删除情况下会有更多字段。

{
	"avatar": "/static/upload/photo/2019-05-10/v2_c3fc49a1dca04ced42f7114ec453c9b01cfc85e3.jpg",
	"birthday": null,
	"come_from": "",
	"company_id": 3,
	"create_time": 1557475623,
	"department": "",
	"description": "",
	"email": "zhaohang@megvii.com",
	"end_time": 0,
	"entry_date": null,
	"gender": 0,
	"id": 2,
	"interviewee": "",
	"interviewee_pinyin": "",
	"job_number": "",
	"name": "1",
	"password_reseted": false,
	"phone": "",
	"photos": [{
		"company_id": 3,
		"id": 2,
		"quality": 0.99651,
		"subject_id": 2,
		"url": "/static/upload/photo/2019-05-10/v2_c3fc49a1dca04ced42f7114ec453c9b01cfc85e3.jpg",
		"version": 7
	}],
	"pinyin": "1",
	"purpose": 0,
	"remark": "",
	"start_time": 0,
	"subject_type": 0,
	"title": "",
	"visit_notify": false
}

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

Query

名称 类型 是否必须 备注 示例 其他信息
category 否 类型: String,可填值:user:全部; visitor:访客; fmp非活体; yellowlist:黄名单, warning:陌生人 user
start 否 开始时间戳, 类型:int,默认: 0 0
end 否 结束时间戳, 类型:Int,默认: 9999999999 9999999999
user_role 否 过滤条件: 用户类型&事件类型,类型:Int 2
user_name 否 用户名,类型:String user
screen_id 否 相机id,类型:Int 1
subject_id 否 subject id,类型:Int 1024
page 否 页数 2
size 否 页内数据数量 10

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data array 否 array[object]
├─ confidence number 否 置信度
├─ fmp_error boolean 否 是否活体
├─ group number 否
├─ event_type number 否 事件类型
├─ timestamp number 否
├─ gender number 否 性别
├─ age number 否 年龄
├─ company_id number 否 公司id
├─ fmp number 否 fmp分数
├─ subject_id null 否
├─ photo string 否 抓拍图路径
├─ screen object 否
├─ camera_position string 否 相机位置
├─ uuid [u'string', u'null'] 否
├─ quality number 否 质量
├─ id number 否
├─ subject object 否
├─ subject_type number 否 类型
├─ avatar string 否 头像
├─ name string 否 名字
page object 否
├─ count number 否
├─ current number 否
├─ total number 否
├─ size number 否

识别记录批量删除

基本信息

Path: /event/events

Method: DELETE

Tag: open,Koala3.1.0

接口描述:

批量删除识别记录接口,参数基本与获取识别记录列表相同。
请求后直接返回,后端由koala_worker执行任务来删除。
只有公司管理员能看到前端按钮,执行次任务

  • event_type
    • 0: 识别
    • 1: 未识别
    • 2: 密码开门
  • start 开始时间戳
  • end 结束时间戳
  • user_role subject和event_type合体过滤参数
    • 0: 员工
    • 1: 普通访客
    • 2: vip访客
    • 3: 黄名单
    • 4: 未识别类型数据,即event_type=1
  • category 分类
    • user: event_type 包括1, 0
    • visitor: subject_type: 1: 普通访客
    • fmp: fmp_error = 1
    • yellowlist: subject_type: 3: 黄名单
    • 其他: subject_type: -1
  • screen_id 相机id,即搜索只能是现在未删除的相机
  • user_name 用户姓名
  • subject_id 用户id,现在未使用

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/x-www-form-urlencoded 是

Query

名称 类型 是否必须 备注 示例 其他信息
category 否 类型: String,可填值:user:全部; visitor:访客; fmp非活体; yellowlist:黄名单 user
start 否 开始时间戳, 类型:Int,默认: 0 0
end 否 结束时间戳, 类型:Int,默认: 9999999999 9999999999
user_role 否 过滤条件: 用户类型&事件类型,类型:Int 2
user_name 否 用户名,类型:String user
screen_id 否 相机id,类型:Int 1
subject_id 否 subject id,类型:Int 1024

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
page object 否

Online-员工管理

上传人员底库

基本信息

Path: /subject/photo

Method: POST

Tag: open,Koala3.1.0

接口描述:

上传人员底库

  • 当subject_id, old_photo_id都不传入时
    • 只是将图片转为底库,并加入photo表
  • 当subject_id传入时
    • 表示该底库绑定了subject
  • 当subject_id, old_photo_id都传入时
    • 表示替换subject的特定底库

返回的photo_id,可以在创建用户,更新用户时使用

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type multipart/form-data 是

Body

名称 类型 是否必须 备注 示例 其他信息
photo file 是 subject底库图片
subject_id text 否 类型:Integer,默认0
old_photo_id text 否 类型:Integer,默认0

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ url string 否 底库保存路径
├─ subject_id null 否 subject id
├─ company_id number 否 公司id
├─ id number 否 photo id
├─ version number 否 版本
├─ quality number 否 质量
├─ origin_url string 否 原图保存地址
page object 否

人员列表

基本信息

Path: /subject/list

Method: GET

Tag: open,Koala3.1.0

接口描述:

3.1.0后之后,由于权限管理变化,screen_id和is_bind参数不在使用
员工查询

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

Query

名称 类型 是否必须 备注 示例 其他信息
category 是 employee员工, visitor访客, yellowlist黄名单 employee
name 否 人员姓名 赫广宇或者heguangyu
department 否 员工部门 QA
interviewee 否 邀请者姓名
start_time 否 注册开始时间, 即数据创建时间
end_time 否 注册结束时间, 即数据创建时间
screen_id 否 3.1.0后不在使用!屏幕id//前端没有传,暂时未使用
is_bind 否 3.1.0后不在使用!是否绑定用户,与screen_id配合查询绑定特定相机的用户 bool
filterstr 否 传入后会匹配subject姓名或者部门,or 姓名或者部门
remark 否 当category=="yellowlist"时,用来在搜索备注的黄名单人员 备注

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data array 否 员工列表 array[object]
├─ subject_type number 否 类型
├─ visit_notify boolean 否 是否来访推送,app 使用
├─ create_time number 否 创建时间
├─ id number 否 id
├─ title string 否 职位
├─ company_id number 否 公司id
├─ job_number string 否 工号
├─ entry_date null 否 入职日期
├─ department string 否 部门
├─ email string 否 邮箱
├─ end_time number 否 访客结束时间
├─ password_reseted boolean 否 是否重置密码
├─ description string 否 描述
├─ pinyin string 否 姓名拼音
├─ start_time number 否 访客开始时间
├─ interviewee string 否 要访问的员工姓名
├─ phone string 否 电话
├─ birthday null 否 生日
├─ purpose number 否 来访目的
├─ groups object 否 分组
├─ id integer 否 组id
├─ name string 否 组名字
├─ come_from string 否 来自于,访客字段
├─ remark string 否 备注
├─ name string 否 姓名
├─ photos array 否 底库列表 array[object]
├─ url string 否 图片地址
├─ subject_id number 否
├─ company_id number 否 公司id
├─ id number 否 id
├─ version number 否 版本
├─ quality number 否 图片质量
├─ origin_url string 否 原图
├─ gender number 否 性别
├─ avatar string 否 头像
├─ interviewee_pinyin string 否
page object 否
├─ count number 否 总页数
├─ current number 否 当前页数
├─ total number 否 总页数
├─ size number 否 页数量

人员头像

基本信息

Path: /subject/avatar

Method: POST

Tag: open,Koala3.1.0

接口描述:

修改subject 头像

如果传入subject_id,则更新此subject头像;如果没有传,则只保存图片。

放回数据实例:其中image_uri可在创建员工: /subject, **更新单个subject数据: /subject/int:sid**使用。

{
    "code": 0,
    "data": {
        "image_uri": "/static/upload/avatar/2019-05-16/v2_50414ce89d5834155a5513e71d41412f67622cd4.jpg",
        "url": "http://10.169.2.153/static/upload/avatar/2019-05-16/v2_50414ce89d5834155a5513e71d41412f67622cd4.jpg"
    },
    "page": {}
}

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type multipart/form-data 是

Body

名称 类型 是否必须 备注 示例 其他信息
avatar file 是 头像图片
subject_id text 否 subject id

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 是
data object 是
├─ url string 否  头像路径
├─ image_uri string 否 图片路径
page object 是

入库图片质量检查

基本信息

Path: /subject/photo/check

Method: POST

Tag: Koala3.1.0,open

接口描述:

入库图片质量检查

检查图片是否符合入库要求

  • 质量检查通过返回
{
  "code": 0,
  "data": {},
  "page": {}
}
  • 质量检查不通过返回错误信息,如
{
    "code": -300,
    "data": {},
    "desc": "没有检测到人脸 (error: 300)"
}

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type multipart/form-data 是

Body

名称 类型 是否必须 备注 示例 其他信息
photo file 是 图片文件

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
page object 否

创建用户

基本信息

Path: /subject

Method: POST

Tag: open,Koala3.1.0

接口描述:

subject创建接口, 员工,访客,黄名单均通过次接口创建
先调用 /subject/photo接口获取底库数据,然后在photo_ids里面传入。

avatar:3.1.0版本,此时avatar可以传入:图像base64编码(即兼容旧使用方式),可以传入头像路径 [参见: /subject/avatar]

当subject_type为0/3, 即员工/黄名单的时候,仅有name和subject_type即可完成创建。
当subject_type为1/2, 即访客/vip的时候,除name和subject_type外,还需要传入start_time和end_time

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

Body

名称 类型 是否必须 备注 示例 其他信息
subject_type number 是 类型,0员工,1访客,2vip,3黄名单
create_time number 否 创建时间
job_number string 否 工号,长度:64
visitor_type number 否 访客类型1访客, 2vip访客
title string 否 职位,长度:64
entry_date number 否 入职日期,传入时间戳,后端处理
department string 否 部门,长度:256
email string 否 邮箱,长度:64
photo_ids array 否 底库id列表 array[number]
avatar string 否 头像,图像base64编码,长度:256
description string 否 签名,长度:128
start_time number 否 访客开始时间,timestamp
interviewee string 否 访问人,长度:20
phone string 否 电话,长度:20
birthday number 否 生日,传入时间戳,后端处理
purpose number 否 来访目的
come_from string 否 来自,用于访客,长度:128
remark string 否 备注,长度:128
group_ids array 否 分组id array[integer]
name string 是 姓名,长度:64
gender number 否 性别,0未知,1男,2女
end_time number 否 访客结束时间,timestamp

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ subject_type number 否 类型
├─ visit_notify boolean 否 app是否推送字段
├─ create_time number 否 创建时间
├─ id number 否 id
├─ title string 否 职位
├─ company_id number 否 公司id
├─ job_number string 否 工号
├─ entry_date number 否 入职日期,时间戳
├─ department string 否 部门
├─ email string 否 邮箱
├─ end_time number 否 访客结束时间
├─ password_reseted boolean 否
├─ description string 否 签名
├─ pinyin string 否 姓名拼音
├─ start_time number 否 访客开始时间
├─ interviewee string 否 访问人姓名
├─ phone string 否 电话
├─ birthday number 否 生日,时间戳
├─ purpose number 否 来访目的
├─ groups object 否 分组
├─ id integer 否 组id
├─ name string 否 组名字
├─ come_from string 否 来自于
├─ remark string 否 备注
├─ name string 否 姓名
├─ photos array 否 底库列表 array[object]
├─ url string 否 图片地址
├─ subject_id number 否 subject id
├─ company_id number 否 公司id
├─ version number 否 版本
├─ quality number 否 质量
├─ id number 否 id
├─ gender number 否 性别
├─ avatar string 否 头像url地址
├─ interviewee_pinyin string 否 访问人姓名拼音
page object 否

创建用户同时上传底库

基本信息

Path: /subject/file

Method: POST

Tag: Koala3.1.0,open

接口描述:

纯后端subject创建接口,头像和底库参数以文件形式使用, 员工,访客,黄名单均通过此接口创建

当subject_type为0/3, 即员工/黄名单的时候,仅有name和subject_type即可完成创建。
当subject_type为1/2, 即访客/vip的时候,除name和subject_type外,还需要传入start_time和end_time

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type multipart/form-data 是

Body

名称 类型 是否必须 备注 示例 其他信息
avatar file 否 头像
birthday text 否 生日,传入时间戳,后端处理
come_from text 否 来自,用于访客,长度:128
department text 否 部门,长度:256
description text 否 签名,长度:128
email text 否 邮箱,长度:64
end_time text 否 访客结束时间,timestamp
entry_date text 否 入职日期,传入时间戳,后端处理
gender text 否 性别,0未知,1男,2女
group_ids text 否 分组id
interviewee text 否 访问人,长度:20
job_number text 否 工号,长度:64
name text 是 姓名,长度:64
phone text 否 电话,长度:20
photo file 否 底库图片
purpose text 否 来访目的
remark text 否 备注,长度:128
start_time text 否 访客开始时间,timestamp
subject_type text 是 类型,0员工,1访客,2vip,3黄名单
title text 否 职位,长度:64
visitor_type text 否 访客类型1访客, 2vip访客

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ subject_type number 否 类型
├─ visit_notify boolean 否 app是否推送字段
├─ create_time number 否 创建时间
├─ id number 否 id
├─ title string 否 职位
├─ company_id number 否 公司id
├─ job_number string 否 工号
├─ entry_date number 否 入职日期,时间戳
├─ department string 否 部门
├─ email string 否 邮箱
├─ end_time number 否 访客结束时间
├─ password_reseted boolean 否
├─ description string 否 签名
├─ pinyin string 否 姓名拼音
├─ start_time number 否 访客开始时间
├─ interviewee string 否 访问人姓名
├─ phone string 否 电话
├─ birthday number 否 生日,时间戳
├─ purpose number 否 来访目的
├─ groups object 否 分组
├─ id integer 否 组id
├─ name string 否 组名字
├─ come_from string 否 来自于
├─ remark string 否 备注
├─ name string 否 姓名
├─ photos array 否 底库列表 array[object]
├─ url string 否 图片地址
├─ subject_id number 否 subject id
├─ company_id number 否 公司id
├─ version number 否 版本
├─ quality number 否 质量
├─ id number 否 id
├─ gender number 否 性别
├─ avatar string 否 头像url地址
├─ interviewee_pinyin string 否 访问人姓名拼音
page object 否

删除subject底库

基本信息

Path: /subject/photo

Method: DELETE

Tag: open,Koala3.1.0

接口描述:

删除指定subject的全部底库

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/x-www-form-urlencoded 是

Body

名称 类型 是否必须 备注 示例 其他信息
subject_id text 是 类型:Integer

返回数据

Body

{
   "code": 0,
   "data": {},
   "page": {}
}

删除单个subject数据

基本信息

Path: /subject/{sid}

Method: DELETE

Tag: open,Koala3.1.0

接口描述:

删除subject接口
返回数据参见: 创建接口: POST /subject

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/x-www-form-urlencoded 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
sid 否 subject id,类型:Integer

Body

名称 类型 是否必须 备注 示例 其他信息
visitor_type null 否 访客时间
remark string 否 备注
subject_type number 否 类型
start_time number 否 访客开始时间
description string 否 签名
title string 否 职位
gender number 否 性别
purpose number 否 来访目的
interviewee string 否 访问人
name string 否 姓名
phone string 否 电话
birthday number 否 生日,时间戳
create_time number 否 创建时间
end_time number 否 访客结束时间
department string 否 部门
job_number string 否 工号
entry_date number 否 入职日期,时间戳
photo_ids array 否 底库列表 array[number]
email string 否 邮箱
come_from string 否 来自于
avatar string 否 头像base64

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息

更新单个subject数据

基本信息

Path: /subject/{sid}

Method: PUT

Tag: open,Koala3.1.0

接口描述:

更新subject接口
返回数据参见: 创建接口: POST /subject

avatar:为支持3.1.0前端分离版本,此时avatar可以传入:图像base64编码(即兼容旧使用方式),可以传入头像路径参见: /subject/avatar。

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
sid 否 subject id,类型:Integer

Body

名称 类型 是否必须 备注 示例 其他信息
subject_type number 是 类型
create_time number 否 创建时间
job_number string 否 工号
visitor_type null 否 访客时间
title string 否 职位
entry_date number 否 入职日期,时间戳
department string 否 部门
email string 否 邮箱
photo_ids array 是 底库列表,空列表会删除用户所有底库 array[number]
avatar string 否 头像base64
description string 否 签名
start_time number 否 访客开始时间
interviewee string 否 访问人
phone string 否 电话
birthday number 否 生日,时间戳
purpose number 否 来访目的
come_from string 否 来自于
remark string 否 备注
group_ids array 否 分组id array[integer]
name string 否 姓名
gender number 否 性别
end_time number 否 访客结束时间

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ subject_type number 否
├─ visit_notify boolean 否
├─ create_time number 否
├─ id number 否
├─ title string 否
├─ company_id number 否
├─ job_number string 否
├─ entry_date number 否
├─ department string 否
├─ email string 否
├─ end_time number 否
├─ password_reseted boolean 否
├─ description string 否
├─ pinyin string 否
├─ start_time number 否
├─ interviewee string 否
├─ phone string 否
├─ birthday number 否
├─ purpose number 否
├─ groups object 否
├─ id integer 否
├─ name string 否
├─ come_from string 否
├─ remark string 否
├─ name string 否
├─ photos array 否 array[object]
├─ url string 否
├─ subject_id number 否
├─ company_id number 否
├─ version number 否
├─ quality number 否
├─ id number 否
├─ gender number 否
├─ avatar string 否
├─ interviewee_pinyin string 否
page object 否

获取单个subject数据

基本信息

Path: /subject/{sid}

Method: GET

Tag: open,Koala3.1.0

接口描述:

返回数据参见: 创建接口: POST /subject

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

路径参数

名称 类型 是否必须 备注 示例 其他信息
sid 否 subject id,类型:Integer

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ subject_type number 否
├─ visit_notify boolean 否
├─ create_time number 否
├─ id number 否
├─ title string 否
├─ company_id number 否
├─ job_number string 否
├─ entry_date number 否
├─ department string 否
├─ email string 否
├─ end_time number 否
├─ password_reseted boolean 否
├─ description string 否
├─ pinyin string 否
├─ start_time number 否
├─ interviewee string 否
├─ phone string 否
├─ birthday number 否
├─ purpose number 否
├─ groups object 否
├─ id integer 否
├─ name string 否
├─ come_from string 否
├─ remark string 否
├─ name string 否
├─ photos array 否 array[object]
├─ url string 否
├─ subject_id number 否
├─ company_id number 否
├─ version number 否
├─ quality number 否
├─ id number 否
├─ gender number 否
├─ avatar string 否
├─ interviewee_pinyin string 否
page object 否

Online-考勤管理

考勤记录

基本信息

Path: /attendance/records

Method: GET

Tag: open,Koala3.1.0

接口描述:

考勤记录接口
clock_in, clock_out取值范围:

  • 0: 漏打卡
  • 1: 正常
  • 2: 迟到
  • 3: 早退
  • 4: 缺勤

返回数据实例:

{
    "code": 0,
    "data": [
        {
            "check_in_time": 0,
            "check_out_time": 0,
            "clock_in": 4,
            "clock_out": 4,
            "date": 1534867200,
            "id": 0,
            "subject": {
                "avatar": "/static/upload/photo/2019-03-28/v2_d9d287af957602a0844fc036e275329806cb0e2d.jpg",
                "birthday": null,
                "create_time": 1553751285,
                "department": "QA",
                "description": "",
                "end_time": null,
                "entry_date": null,
                "id": 65030,
                "interviewee": "",
                "interviewee_pinyin": "",
                "inviter_id": null,
                "job_number": "",
                "name": "11133",
                "remark": "",
                "start_time": null,
                "subject_type": 0,
                "title": ""
            },
            "worktime": "0小時0分"
        }
    ],
    "page": {
        "count": 8712,
        "current": 1,
        "size": 1,
        "total": 8712
    }
}

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

Query

名称 类型 是否必须 备注 示例 其他信息
start_time 是 开始时间,类型:Integer
end_time 是 结束时间,类型:Integer
user_name 是 用户姓名
department 是 部门
subject_id 是 员工id,类型:Integer
page 是 页码,类型:Integer 1
size 是 页数据容量,类型:Integer 10

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data array 否 array[object]
├─ clock_in number 否 上班状态
├─ worktime string 否 工作时常
├─ id number 否
├─ check_in_time number 否 上班时间
├─ clock_out number 否 下班状态
├─ date number 否 日期
├─ check_out_time number 否 下班时间
├─ subject object 否 参见subject相关
├─ remark string 否
├─ subject_type number 否
├─ description string 否
├─ name string 否
├─ inviter_id null 否
├─ start_time null 否
├─ title string 否
├─ interviewee string 否
├─ job_number string 否
├─ entry_date null 否
├─ birthday null 否
├─ create_time number 否
├─ end_time null 否
├─ department string 否
├─ interviewee_pinyin string 否
├─ id number 否
├─ avatar string 否
page object 否
├─ count number 否
├─ current number 否
├─ total number 否
├─ size number 否

Online-综合管理

首页综合统计接口

基本信息

Path: /overview/statistics

Method: GET

Tag: open

接口描述:

首页综合统计接口

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ num_yellowlist number 否 今日告警:黄名单
├─ video_can_use string 否 相机绑定情况:剩余
├─ subject_count number 否 底库使用情况:人数
├─ num_visitor number 否 今日访客
├─ feature_count number 否 底库使用情况:Feature
├─ video_use number 否 相机绑定情况:使用
├─ num_fmp number 否 今日告警:非活体
├─ num_stranger number 否 今日告警:陌生人
├─ all_video_limit string 否 相机绑定情况:总数
├─ num_employee number 否 今日员工记录
page object 否

Online-门禁分组

获取门禁分组列表

基本信息

Path: /devices/screens/group/list

Method: GET

Tag: open

接口描述:

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

Query

名称 类型 是否必须 备注 示例 其他信息
page 否 默认1 1
size 否 默认10 10
name 否 最长40 abc
comment 否 最长120 abc
update_user_name 否 admin@megvii.com
order_by 否 enum: 'id', 'name', 'update_time', 'update_by', 'screens_count' update_time
order 否 enum: 'asc', 'desc' desc

返回数据

Body

{
   "code": 0,
   "data": [
      {
         "comment": "string",
         "id": 16,
         "name": "group_a",
         "screens": [
            {
               "box_address": "10.169.5.147",
               "box_heartbeat": 1561446293,
               "box_id": 1,
               "box_status": "0",
               "box_token": "acd93630-3cbc-482d-94ef-f7a9cc1371ef",
               "camera_address": "rtsp://10.169.1.135/video_low_f.264",
               "camera_name": null,
               "camera_position": "live555",
               "camera_status": "111",
               "description": null,
               "id": 8,
               "is_select": 0,
               "network_switcher": null,
               "network_switcher_drive": 0,
               "network_switcher_status": null,
               "network_switcher_token": null,
               "screen_token": "4fdd1b32-07f5-4115-af4c-2cf511270cb4",
               "type": 1
            }
         ],
         "screens_count": 1,
         "update_by": "1@qq.com",
         "update_time": 1561446307
      }
   ],
   "page": {
      "count": 1,
      "current": 1,
      "size": 10,
      "total": 1
   }
}

获取门禁组以及所属门禁

基本信息

Path: /devices/screens/group/{gid}

Method: GET

Tag: open

接口描述:

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

路径参数

名称 类型 是否必须 备注 示例 其他信息
gid 否 门禁分组id,类型:int

Query

名称 类型 是否必须 备注 示例 其他信息
page 否 下属门禁的分页参数, 默认1 1
size 否 下属门禁的分页参数, 默认10 10

返回数据

Body

{
   "code": 0,
   "data": {
      "comment": "this is a group",
      "id": 1,
      "name": "whatever",
      "screens": [
         {
            "allow_all_subjects": false,
            "allow_visitor": true,
            "box_address": "10.169.1.79",
            "box_heartbeat": 1554358182,
            "box_status": "1",
            "box_token": "0a873411-2ef3-456b-849e-a449943ec5bf",
            "camera_address": "rtsp://10.1.2.3:8554/live.sdp",
            "camera_name": "no",
            "camera_position": "asdasd",
            "camera_status": "1",
            "description": null,
            "id": 1,
            "is_select": 1,
            "network_switcher": "",
            "network_switcher_drive": 0,
            "network_switcher_status": null,
            "network_switcher_token": null,
            "screen_token": "6834542a-fb31-442e-bea7-258090ae2b3a",
            "type": 1
         }
      ]
   },
   "page": {
      "count": 1,
      "current": 1,
      "size": 50,
      "total": 1
   }
}

创建门禁分组

基本信息

Path: /devices/screens/group

Method: PUT

Tag: open

接口描述:

也支持POST方法

参数说明:
  • name: string,最大长度40,必填
  • comment: string,最大长度120,非必填

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

Body

名称 类型 是否必须 备注 示例 其他信息
comment string 否
name string 是

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ comment string 否
├─ update_by string 否
├─ update_time number 否
├─ id number 否
├─ name string 否
page object 否

更新门禁分组

基本信息

Path: /devices/screens/group/{gid}

Method: POST

Tag: open

接口描述:

参数:
name: string,最大长度40,非必填
comment: string,最大长度120,非必填

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
gid 否 门禁分组id,类型:int

Body

{
   "name": "group_0",
   "comment": "update group info"
}

返回数据

Body

{
   "code": 0,
   "data": {
      "comment": "update group info",
      "id": 1,
      "name": "group_0"
   },
   "page": {}
}

删除门禁分组

基本信息

Path: /devices/screens/group/{gid}

Method: DELETE

Tag: open

接口描述:

参数:
extra: 删除时的备注信息,json序列化后长度不超过1024

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
gid 否 门禁分组id,类型:int

Body

{
   "extra": {
      "screens_count": 10000,
      "screens": "a/b/c"
   }
}

返回数据

添加门禁到门禁分组

基本信息

Path: /devices/screens/group/{gid}/insert

Method: POST

Tag: open

接口描述:

参数:
screen_ids: list<integer>, 必填

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
gid 否 门禁分组id,类型:int

Body

{
   "screen_ids": [
      1,
      3
   ]
}

返回数据

Body

{
   "code": 0,
   "data": {},
   "page": {}
}

从门禁分组中删除门禁

基本信息

Path: /devices/screens/group/{gid}/delete

Method: POST

Tag: open

接口描述:

参数:
screen_ids: list<integer>, 必填

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
gid 否 门禁分组id,类型:int

Body

名称 类型 是否必须 备注 示例 其他信息
screen_ids array 是 屏幕id列表 array[number]

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
page object 否

Online-人员分组

获取人员分组列表

基本信息

Path: /subjects/group/list

Method: GET

Tag: open

接口描述:

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

Query

名称 类型 是否必须 备注 示例 其他信息
page 否 默认1 1
size 否 默认10 10
name 否 最长40 abc
comment 否 最长120
update_user_name 否 megvii
order_by 否 enum: 'id', 'name', 'subject_type', 'update_time', 'update_by', 'subject_count' update_time
order 否 enum: 'asc', 'desc' desc
subject_type 否 0: 员工 1:访客 不传或者其他: 全部 0

返回数据

Body

{
   "code": 0,
   "data": [
      {
         "comment": null,
         "id": 5,
         "name": "another",
         "subject_count": 24,
         "subject_type": 0,
         "update_by": "29@megvii.com",
         "update_time": "2019-06-11 18:24:45"
      }
   ],
   "page": {
      "count": 1,
      "current": 1,
      "size": 10,
      "total": 1
   }
}

获取人员组以及所属人员

基本信息

Path: /subjects/group/{gid}

Method: GET

Tag: open

接口描述:

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

路径参数

名称 类型 是否必须 备注 示例 其他信息
gid 否 人员分组id,类型:int

Query

名称 类型 是否必须 备注 示例 其他信息
page 否 默认1 1
size 否 默认10 10

返回数据

Body

{
   "code": 0,
   "data": {
      "comment": "",
      "id": 3,
      "name": "simple",
      "subject_type": 1,
      "subjects": [
         {
            "avatar": "",
            "birthday": null,
            "come_from": "",
            "company_id": 8,
            "create_time": 1553751290,
            "department": "QA",
            "description": "",
            "email": "",
            "end_time": null,
            "entry_date": null,
            "gender": 1,
            "id": 65045,
            "interviewee": "",
            "interviewee_pinyin": "",
            "job_number": "",
            "name": "11127",
            "password_reseted": false,
            "phone": "",
            "pinyin": "11127",
            "purpose": 0,
            "remark": "",
            "start_time": null,
            "subject_type": 0,
            "title": "",
            "visit_notify": false
         },
         {
            "avatar": "",
            "birthday": null,
            "come_from": "",
            "company_id": 8,
            "create_time": 1553751291,
            "department": "QA",
            "description": "",
            "email": "",
            "end_time": null,
            "entry_date": null,
            "gender": 1,
            "id": 65047,
            "interviewee": "",
            "interviewee_pinyin": "",
            "job_number": "",
            "name": "1116",
            "password_reseted": false,
            "phone": "",
            "pinyin": "1116",
            "purpose": 0,
            "remark": "",
            "start_time": null,
            "subject_type": 0,
            "title": "",
            "visit_notify": false
         },
         {
            "avatar": "",
            "birthday": null,
            "come_from": "",
            "company_id": 8,
            "create_time": 1553751292,
            "department": "QA",
            "description": "",
            "email": "",
            "end_time": null,
            "entry_date": null,
            "gender": 1,
            "id": 65050,
            "interviewee": "",
            "interviewee_pinyin": "",
            "job_number": "",
            "name": "11132",
            "password_reseted": false,
            "phone": "",
            "pinyin": "11132",
            "purpose": 0,
            "remark": "",
            "start_time": null,
            "subject_type": 0,
            "title": "",
            "visit_notify": false
         }
      ]
   },
   "page": {
      "count": 3,
      "current": 1,
      "size": 50,
      "total": 1
   }
}

创建人员分组

基本信息

Path: /subjects/group

Method: PUT

Tag: open

接口描述:

参数:
name: string,最大长度40,必填
comment: string,最大长度120,非必填
subject_type: int,  0:员工 1:访客,非必填,默认0

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

Body

名称 类型 是否必须 备注 示例 其他信息
comment string 否
subject_type number 否
name string 是

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ comment string 否
├─ subject_count number 否
├─ update_time number 否
├─ subject_type number 否
├─ name string 否
├─ update_by string 否
├─ id number 否
page object 否

更新人员分组

基本信息

Path: /subjects/group/{gid}

Method: POST

Tag: open

接口描述:

name: string,最大长度40,非必填
comment: string,最大长度120,非必填
(subject_type 不可更新)

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
gid 否 人员分组id,类型:int

Body

{
   "name": "another_group_name",
   "comment": "blablabla"
}

返回数据

Body

{
   "code": 0,
   "data": {
      "comment": "blablabla",
      "id": 6,
      "name": "another_group_name"
   },
   "page": {}
}

添加人员到人员分组

基本信息

Path: /subjects/group/{gid}/insert

Method: POST

Tag: open

接口描述:

参数:
subject_ids: list<integer>, 必填

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
gid 否 人员分组id,类型:int

Body

{
   "subject_ids": [
      100000,
      100001
   ]
}

返回数据

Body

{
   "code": 0,
   "data": {},
   "page": {}
}

从人员分组中删除人员

基本信息

Path: /subjects/group/{id}/delete

Method: POST

Tag: open

接口描述:

参数:
subject_ids: list<integer>, 必填

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
id 否 人员分组id,类型:int

Body

名称 类型 是否必须 备注 示例 其他信息
subject_ids array 是 人员id列表 array[number]

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
page object 否

Online-门禁权限

创建门禁设置

基本信息

Path: /access/setting

Method: PUT

Tag: open

接口描述:

参数:
name: string,最大长度40,必填
comment: string,最大长度120,非必填
subject_group_id:int, 非必填,特殊值 全员工:0 全访客: 1
screen_group_ids: list<int>, 非必填, 可以传空列表
schedule_ids: list<int>, 非必填,可以传空列表
calendar_ids: list<int>, 非必填,可以传空列表

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

Body

{
   "name": "rule_no_1",
   "comment": "...",
   "subject_group_id": 3,
   "screen_group_ids": [
      1,
      4
   ],
   "schedule_ids": [
      1,
      5
   ],
   "calendar_ids": []
}

返回数据

Body

{
  "code": 0,
  "data": {
    "id": 3,
    "name": "rule_no_2",
    "schedule_ids": [
      1,
      5
    ],
    "calendar_ids": [],
    "screen_groups": [
      {
        "comment": "update group info",
        "id": 1,
        "name": "group_0"
      },
      {
        "comment": "group info",
        "id": 4,
        "name": "group_2"
      }
    ],
    "subject_group": {
      "comment": "",
      "id": 3,
      "name": "simple"
    },
    "status": 1,
  },
  "page": {}
}

删除门禁设置

基本信息

Path: /access/setting/{id}

Method: DELETE

Tag: open

接口描述:

参数:
extra: 删除时的备注信息,json序列化后长度不超过1024

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
id 否 门禁设置id, 类型 int

Body

{
   "extra": {
      "screen_group": "全门禁",
      "calendar": "全时段",
      "schedule": "-"
   }
}

返回数据

Body

{
   "code": 0,
   "data": {},
   "page": {}
}

更新门禁设置

基本信息

Path: /access/setting/{id}

Method: POST

Tag: open

接口描述:

status字段不能和其他字段一同更新

参数:
status: int, 1: 启用 2: 禁用,非必填
name: string,最大长度40,非必填
comment: string,最大长度120,非必填
subject_group_id:int, 非必填,特殊值 全员工:0 全访客: 1 不设置: null
screen_group_ids: list<int>, 非必填, 可以传空列表
schedule_ids: list<int>, 非必填,可以传空列表
calendar_ids: list<int>, 非必填,可以传空列表

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
id 否 门禁设置id, 类型 int

Body

{
   "name": "rule_no_2",
   "comment": "...",
   "subject_group_id": 3,
   "screen_group_ids": [
      1,
      4
   ],
   "schedule_ids": [
      1,
      5
   ],
   "calendar_ids": [],
   "status": 0
}

返回数据

Body

{
   "code": 0,
   "data": {
      "calendar_ids": [],
      "id": 3,
      "name": "rule_no_2",
      "schedule_ids": [
         1,
         5
      ],
      "screen_groups": [
         {
            "comment": "update group info",
            "id": 1,
            "name": "group_0"
         },
         {
            "comment": "group info",
            "id": 4,
            "name": "group_2"
         }
      ],
      "status": 0,
      "subject_group": {
         "comment": "",
         "id": 3,
         "name": "simple"
      }
   },
   "page": {}
}

获取门禁设置列表

基本信息

Path: /access/setting/list

Method: GET

Tag: open

接口描述:

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

Query

名称 类型 是否必须 备注 示例 其他信息
page 否 默认 1 1
size 否 默认 10 10
subject_id 否 筛选的人员id 12345
screen_group_id 否 筛选的门禁组id 123
schedule_id 否 筛选的时段规则d 456
calendar_id 否 筛选的假日规则d 789
order_by 否 有效值:'name', 'subject_group_id', 'update_time', 'update_by' name
order 否 有效值:'asc', 'desc' desc
name 否 模糊搜索:规则名称 abc
subject_group_name 否 模糊搜索:人员分组名 abc
update_user_name 否 模糊搜索:操作员用户名 admin

返回数据

Body

{
   "code": 0,
   "data": [
      {
         "calendar_ids": [],
         "id": 1,
         "name": "nameless",
         "schedule_ids": [
            1
         ],
         "screen_groups": [
            {
               "comment": "update group info",
               "id": 1,
               "name": "group_0"
            }
         ],
         "status": 1,
         "subject_group": {
            "comment": "",
            "id": 3,
            "name": "simple"
         },
         "update_by": "29@megvii.com",
         "update_time": "2019-05-29 20:21:36"
      },
      {
         "calendar_ids": [],
         "id": 3,
         "name": "rule_no_2",
         "schedule_ids": [
            1,
            5
         ],
         "screen_groups": [
            {
               "comment": "update group info",
               "id": 1,
               "name": "group_0"
            },
            {
               "comment": "group info",
               "id": 4,
               "name": "group_2"
            }
         ],
         "status": 1,
         "subject_group": {
            "comment": "",
            "id": 3,
            "name": "simple"
         },
         "update_by": "29@megvii.com",
         "update_time": "2019-05-30 16:15:08"
      }
   ],
   "page": {
      "count": 2,
      "current": 1,
      "size": 10,
      "total": 1
   }
}

Online-门禁时段&假日管理

获取时段列表

基本信息

Path: /access/schedule/list

Method: GET

Tag: open

接口描述:

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

Query

名称 类型 是否必须 备注 示例 其他信息
page 否 默认 1 1
size 否 默认 10 50
id 否 筛选单条 1
status 否 0 删除 1生效 1
name 否 模糊搜索: 规则名称 abc
update_user_name 否 模糊搜索: 操作用户名 admin
order_by 否 enum: 'id', 'name', 'update_time', 'update_by' update_time
order 否 enum: 'asc', 'desc' desc

返回数据

Body

{
   "code": 0,
   "data": [
      {
         "comment": "what the",
         "end_time": "2019-10-01",
         "id": 1,
         "name": "test_schedule_2",
         "start_time": "2019-05-29",
         "time_range": [
            [
               [
                  1,
                  2
               ],
               [
                  3,
                  4
               ]
            ],
            [],
            [
               [
                  2000,
                  3000
               ],
               [
                  7000,
                  80000
               ]
            ],
            [],
            [],
            [],
            [
               [
                  1,
                  2
               ],
               [
                  2,
                  3
               ],
               [
                  3,
                  4
               ]
            ]
         ]
      },
      {
         "comment": "no comment",
         "end_time": "2019-09-01",
         "id": 2,
         "name": "first_schedule",
         "start_time": "2019-06-01",
         "time_range": [
            [
               [
                  39216,
                  46911
               ],
               [
                  48494,
                  62614
               ]
            ],
            [
               [
                  43753,
                  43824
               ],
               [
                  52533,
                  75469
               ],
               [
                  80957,
                  82878
               ]
            ],
            [
               [
                  39054,
                  47995
               ],
               [
                  51790,
                  57973
               ],
               [
                  74060,
                  83615
               ]
            ],
            [
               [
                  26476,
                  30670
               ],
               [
                  46794,
                  52777
               ],
               [
                  53303,
                  76750
               ]
            ],
            [
               [
                  76921,
                  78375
               ]
            ],
            [],
            []
         ]
      },
      {
         "comment": "comment here",
         "end_time": "2019-07-01",
         "id": 5,
         "name": "test_schedule_",
         "start_time": "2019-01-01",
         "time_range": [
            [
               [
                  16512,
                  26370
               ],
               [
                  33716,
                  34645
               ],
               [
                  0,
                  0
               ]
            ],
            [
               [
                  34333,
                  36367
               ]
            ],
            [
               [
                  20316,
                  36497
               ],
               [
                  49312,
                  68899
               ],
               [
                  72438,
                  75984
               ]
            ],
            [
               [
                  16373,
                  29782
               ],
               [
                  33024,
                  34070
               ]
            ],
            [
               [
                  47184,
                  48145
               ],
               [
                  63733,
                  68268
               ]
            ],
            [
               [
                  21206,
                  36286
               ],
               [
                  57982,
                  60134
               ]
            ],
            [
               [
                  32353,
                  49341
               ],
               [
                  70852,
                  77301
               ],
               [
                  78225,
                  79578
               ]
            ]
         ]
      }
   ],
   "page": {
      "count": 3,
      "current": 1,
      "size": 50,
      "total": 1
   }
}

创建时段规则

基本信息

Path: /access/schedule

Method: PUT

Tag: open

接口描述:

参数说明:
  • name: string,最大长度40,必填
  • comment: string,最大长度120,非必填
  • start_time: string,  按照"%Y-%m-%d"格式化的日期,非必填,默认当天
  • end_time: string,  按照"%Y-%m-%d"格式化的日期,必填
  • time_range 必填, list <list<pair(int, int)>>, 长度等于7的三维数组。

pair = time_range[i][j]表示每周第i天的第j项设置
pair[0]是开始时间,pair[1]为结束时间。值为距离0点经过的秒数。

请求参数示范:
{
  "name": "test_schedule",
  "comment": "comment here",
  "time_range": [
    [
      [
        16512,
        26370
      ],
      [
        33716,
        34645
      ],
      [
        0,
        0
      ]
    ],
    [
      [
        34333,
        36367
      ]
    ],
    [
      [
        20316,
        36497
      ],
      [
        49312,
        68899
      ],
      [
        72438,
        75984
      ]
    ],
    [
      [
        16373,
        29782
      ],
      [
        33024,
        34070
      ]
    ],
    [
      [
        47184,
        48145
      ],
      [
        63733,
        68268
      ]
    ],
    [
      [
        21206,
        36286
      ],
      [
        57982,
        60134
      ]
    ],
    [
      [
        32353,
        49341
      ],
      [
        70852,
        77301
      ],
      [
        78225,
        79578
      ]
    ]
  ],
  "start_time": "2019-01-01",
  "end_time": "2019-07-01"
}

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

Body

名称 类型 是否必须 备注 示例 其他信息
comment string 否
start_time string 否
end_time string 否
name string 是
time_range array 是 array[array]

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ comment string 否
├─ name string 否
├─ start_time string 否
├─ time_range array 否 array[array]
├─ end_time string 否
├─ id number 否
page object 否

更新时段规则

基本信息

Path: /access/schedule/{id}

Method: POST

Tag: open

接口描述:

参数同创建

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
id 否 时段规则id, 类型 int 1

Body

{
   "name": "first_schedule",
   "comment": "no comment",
   "time_range": [
      [
         [
            39216,
            46911
         ],
         [
            48494,
            62614
         ]
      ],
      [
         [
            43753,
            43824
         ],
         [
            52533,
            75469
         ],
         [
            80957,
            82878
         ]
      ],
      [
         [
            39054,
            47995
         ],
         [
            51790,
            57973
         ],
         [
            74060,
            83615
         ]
      ],
      [
         [
            26476,
            30670
         ],
         [
            46794,
            52777
         ],
         [
            53303,
            76750
         ]
      ],
      [
         [
            76921,
            78375
         ]
      ],
      [],
      []
   ],
   "start_time": "2019-06-01",
   "end_time": "2019-09-01"
}

返回数据

Body

{
   "code": 0,
   "data": {
      "id": 2,
      "comment": "no comment",
      "end_time": "2019-09-01",
      "name": "first_schedule",
      "start_time": "2019-06-01",
      "time_range": [
         [
            [
               39216,
               46911
            ],
            [
               48494,
               62614
            ]
         ],
         [
            [
               43753,
               43824
            ],
            [
               52533,
               75469
            ],
            [
               80957,
               82878
            ]
         ],
         [
            [
               39054,
               47995
            ],
            [
               51790,
               57973
            ],
            [
               74060,
               83615
            ]
         ],
         [
            [
               26476,
               30670
            ],
            [
               46794,
               52777
            ],
            [
               53303,
               76750
            ]
         ],
         [
            [
               76921,
               78375
            ]
         ],
         [],
         []
      ]
   },
   "page": {}
}

删除时段规则

基本信息

Path: /access/schedule/{id}

Method: DELETE

Tag: open

接口描述:

参数:
extra: 删除时的备注信息,json序列化后长度不超过1024

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
id 否 时段规则id, 类型 int

Body

{
   "extra": {
      "start_time": "2000-01-01",
      "end_time": "2020-01-01"
   }
}

返回数据

Body

{
   "code": 0,
   "data": {},
   "page": {}
}

获取假日列表

基本信息

Path: /access/calendar/list

Method: GET

Tag: open

接口描述:

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

Query

名称 类型 是否必须 备注 示例 其他信息
id 否 筛选单条 1
page 否 默认 1 1
size 否 默认 10 10
name 否 模糊搜索: 规则名称 abc
update_user_name 否 模糊搜索: 操作用户名 admin
order_by 否 enum: 'id', 'name', 'update_time', 'update_by' update_time
order 否 enum: 'asc', 'desc' desc

返回数据

Body

{
   "code": 0,
   "data": [
      {
         "comment": "",
         "date_range": [
            [
               2019,
               1,
               1
            ],
            [
               0,
               12,
               25
            ],
            [
               0,
               0,
               7
            ],
            [
               2020,
               1,
               1
            ]
         ],
         "id": 1,
         "name": "calendar_x"
      },
      {
         "comment": "nothing",
         "date_range": [
            [
               2019,
               1,
               1
            ],
            [
               2019,
               1,
               2
            ],
            [
               2019,
               1,
               3
            ],
            [
               0,
               12,
               25
            ],
            [
               0,
               0,
               10
            ]
         ],
         "id": 2,
         "name": "test"
      },
      {
         "comment": "nothing",
         "date_range": [
            [
               0,
               0,
               1
            ]
         ],
         "id": 3,
         "name": "test2"
      }
   ],
   "page": {
      "count": 3,
      "current": 1,
      "size": 50,
      "total": 1
   }
}

创建假日规则

基本信息

Path: /access/calendar

Method: PUT

Tag: open

接口描述:

参数:

  • name: string,最大长度40,必填
  • comment: string,最大长度120,非必填
  • date_range 必填, list, 二维数组。

date = date_range[i]表示一组设置中的第i个
date[0],date[1],date[2]依次表示年,月,日,0为通配符。
例如 [0, 0, 1]表示每个月的1号,[2019, 7, 0]表示2019年7月的任意一天。

参数示范:

{
  "name": "test",
  "comment": "nothing",
  "date_range": [
    [
      2019,
      1,
      1
    ],
    [
      2019,
      1,
      2
    ],
    [
      0,
      12,
      25
    ],
    [
      0,
      0,
      10
    ]
  ]
}

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

Body

名称 类型 是否必须 备注 示例 其他信息
comment string 否
date_range array 是 array[array]
name string 是

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ comment string 否
├─ date_range array 否 array[array]
├─ id number 否
├─ name string 否
page object 否

更新假日规则

基本信息

Path: /access/calendar/{id}

Method: POST

Tag: open

接口描述:

参数要求同创建规则

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
id 否 假日规则id, 类型 int

Body

{
   "name": "test4",
   "comment": "nothing",
   "date_range": [
      [
         2020,
         1,
         31
      ]
   ]
}

返回数据

Body

{
   "code": 0,
   "data": {
      "comment": "nothing",
      "date_range": [
         [
            2020,
            1,
            31
         ]
      ],
      "id": 4,
      "name": "test4"
   },
   "page": {}
}

删除假日规则

基本信息

Path: /access/calendar/{id}

Method: DELETE

Tag: open

接口描述:

参数:
extra: 删除时的备注信息,json序列化后长度不超过1024

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是

路径参数

名称 类型 是否必须 备注 示例 其他信息
id 否 假日规则id, 类型 int

Body

{
   "extra": {
      "重复": "年",
      "假日": "10月1日/10月2日"
   }
}

返回数据

Body

{
   "code": 0,
   "data": {},
   "page": {}
}

主机-系统管理

主机NTP客户端控制

基本信息

Path: /api/v2/system/ntp-client-service

Method: POST

Tag:

接口描述:

主机NTP客户端控制

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是
Authorization 是

Body

名称 类型 是否必须 备注 示例 其他信息
cmd string 否 start, stop

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
page object 否

主机NTP客户端配置

基本信息

Path: /api/v2/system/ntp-client

Method: POST

Tag:

接口描述:

主机NTP客户端配置

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是
Authorization 是

Body

名称 类型 是否必须 备注 示例 其他信息
server_address string 否
range_m number 否
port number 否

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
page object 否

回调抓拍图状态

基本信息

Path: /api/v2/system/callback/photo

Method: PUT

Tag:

接口描述:

回调抓拍图状态
即回调的时候是否返回抓拍图

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是
Authorization 是

Body

名称 类型 是否必须 备注 示例 其他信息
status number 否 1返回,0不返回

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
page object 否

设置回调地址

基本信息

Path: /api/v2/system/callback

Method: PUT

Tag:

接口描述:

设置回调地址

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type application/json 是
Authorization 是

Body

名称 类型 是否必须 备注 示例 其他信息
callback_url string 是

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
page object 否

主机-识别

1比1认证

基本信息

Path: /checkin

Method: POST

Tag:

接口描述:

1比1认证

person_id: 确定在底库内的人员Id

  • 当person_id传入时候
    • 使用verify接口对比图片和指定人员Id
  • 当person_id不传入时候
    • 使用recognize接口识别图片,返回人员Id

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type multipart/form-data 是

Body

名称 类型 是否必须 备注 示例 其他信息
image file 是 图片
person_id text 否 人员ID,即subject.id 42

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
code number 否
data object 否
├─ person_id number 否 人员ID
page object 否

动态 1:1 接口

基本信息

Path: /video_verify

Method: POST

Tag:

接口描述:

  • 描述:

检查视频画面中是否有图像或 Feature 中的人物。

  • 参数:

参数 类型 描述
url str 视频流地址, 例如 rtsp://10.101.1.60/live1.sdp。这个参数必须经过url encode再传到服务器
rect (optional) string/JSON rect 表示人脸位置,传入4个数字,格式 100,110,120,130(四个数字分别表示左、上、右、下)。如果传入了 rect,则会略过人脸检测一步,直接使用 rect 指定的人脸位置进行计算。
image file 图片
  • 返回值说明:

{
  "face_info": {
    "rect": {
      "left": 197,
      "top": 454,
      "right": 752,
      "bottom": 1009
    },
  }
  "result": {
    "confidence": 92.330423,
    "result": {
      "track": 7,
      "quality": 0.975,
      "rect": {
        "left": 688,
        "top": 394,
        "right": 1028,
        "bottom": 734
      },
      "image": "Base64 encoded JPEG image"
    },
    "recognized": true
  },
}

result.confidence 代表置信度,result.result 代表检查结果,result.recognized 代表是否与图像/Feature 中的人物匹配。face_info 代表输入图像的信息。

该接口会首先检查不早于请求时刻 time.gate_reserve 时间之前的人脸,如果这段时间内包含匹配的人脸,就直接输出;如果没有,就等待最多 time.gate_wait 时间;如果仍没有,就输出最相似的人脸。这两个时间默认配置分别是3秒和2秒,相当于检索会在5s的时间范围内进行。如果在这段时间内没有出现任何人脸,则 result.confidence 和 result.result 均不存在。

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type multipart/form-data 是

Body

名称 类型 是否必须 备注 示例 其他信息
image file 是
url text 是 视频流地址, 例如 rtsp://10.101.1.60/live1.sdp。这个参数必须经过url encode再传到服务器
rect text 否 rect 表示人脸位置,传入4个数字,格式 100,110,120,130(四个数字分别表示左、上、右、下)。如果传入了 rect,则会略过人脸检测一步,直接使用 rect 指定的人脸位置进行计算。

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
result object 否
├─ confidence number 否
├─ result object 否
├─ track number 否
├─ image string 否
├─ quality number 否
├─ rect object 否
├─ top number 否
├─ right number 否
├─ bottom number 否
├─ left number 否
├─ recognized boolean 否
face_info object 否
├─ rect object 否
├─ top number 否
├─ right number 否
├─ bottom number 否
├─ left number 否

识别结果获取

基本信息

Path: /video

Method: GET

Tag:

接口描述:

注意:此请求参数为GET参数,形如: ws://192.168.1.50:9000/video?url=rtsp%3A%2F%2F192.169.1.60%2Fuser%3Dadmin%26password%3D%26channel%3D1%26stream%3D0.sdp

  • 返回值说明:

  • 算法会将一个人在视频中出现到离开的所有图片当做一个track,每个track有个id,同一个track的信息都代表一个人
  • 算法处理的流程有可能有三种:
字段 类型 说明
screen Screen 识别位置的信息,只有type不为gone时才会有
person Person 和底库里相似的人,只有type为recognized时才会有
open_door bool 是否开门,只有type为recognized时才会有
error string 如果open_door为false,这个字段就是不能开门的原因
type string 本条信息的类型,4种,lastface(识别中)、recognized、unrecognized、gone
data RecognizeInfo 算法识别的底层信息,无特殊需求的话不用处理,其中track为track id。只有当type为gone的时候,这里才包含年龄性别信息。
  • recognizing...recognizing...gone
    • recognizing...recognizing...recognized,gone
    • recognizing...recognizing...unrecognized,gone
  • 对于2.8版之后的固件,data中值的变化:

    status的值从字符串变成一个字典
	'status': {
	  'recognize_status’:’not_determined’,
	  'snapshot_status': 'ongoing'
	}

recognize_status 取值为stranger, not_determined 和 recognized,分别表示陌生人,未定和已识别。
snapshot_status 取值为 为 ongoing,gone,如果为 ongoing,则程序发送对实时人脸的计算结果。如果 recognize_status 不为 not_determined,说明已经判定完毕,则程序不再发送后续的实时人脸计算结果。如果为 gone,说明该 Track 已经结束。程序会发送质量最好的人脸的计算结果。
person 中增加feature_id,目前不使用,取值固定为0
因为foliage会延迟(直到track结束)单独发送attr,所以在识别消息里取消attr字段

  • #####Person(未列出说明的字段与subject相同)
    | 字段 | 类型 | 说明 |
    | :--| :--| :--|
    | src | base64 image | 实时抓拍的照片 |
  • ####返回结果
	{
	  "data": {
	    "status": {
	        'recognize_status’:'recognized',
	        'snapshot_status': 'ongoing'
	    },
	    "track": 0,
	    "timestamp": 1474454214,
	    "face": {
	      "image": "",
	      "rect": {
	        "top": 207,
	        "right": 913,
	        "bottom": 775,
	        "left": 345
	      }
	    },
	    "person": {
	      "feature_id": 0,
	      "confidence": 79.35476,
	      "tag": "{\"subject_type\": 0, \"description\": \"\", \"start_time\": 0, \"birthday\": null, \"id\": 103821, \"remark\": \"\", \"name\": \"\\u5218\\u5b9a\\u5cf0\", \"title\": \"\", \"job_number\": \"\", \"entry_date\": null, \"end_time\": 0, \"department\": \"\", \"avatar\": \"http://10.201.105.140:8867/static/upload/photo/2016-09-21/12345f1ea4fff5df02edadffa37c82308bde0e63.jpg\"}",
	      "id": "103821"
	    },
	    "quality": 0.7678973
	  },
	  "screen": {
	    "camera_address": "rtsp://10.101.1.66/live1.sdp",
	    "allowed_subject_ids": [],
	    "network_switcher_status": "0",
	    "box_token": "66666666-f988-4fc9-8a67-6a4c4220dd8a",
	    "description": "",
	    "box_heartbeat": 1474454143,
	    "network_switcher": "10.201.105.47",
	    "camera_name": "",
	    "camera_status": "0",
	    "allow_visitor": true,
	    "screen_token": "55VkFeQOHzgoIMQe",
	    "network_switcher_token": null,
	    "box_status": "0",
	    "allow_all_subjects": true,
	    "type": 1,
	    "id": 243,
	    "camera_position": "\u4e0a\u65b9\u540a\u88c5",
	    "box_address": "10.201.105.140"
	  },
	  "person": {
	    "src": "data:image/jpeg;base64...",
	    "remark": "",
	    "subject_type": 0,
	    "description": "",
	    "title": "",
	    "timestamp": 1474454214,
	    "start_time": 0,
	    "avatar": "http://10.201.105.140:8867/static/upload/photo/2016-09-21/12345f1ea4fff5df02edadffa37c82308bde0e63.jpg",
	    "job_number": "",
	    "birthday": null,
	    "entry_date": null,
	    "department": "",
	    "end_time": 0,
	    "id": 103821,
	    "name": "\u5218\u5b9a\u5cf0"
	  },
	  "error": "\u5141\u8bb8\u8fdb\u5165",
	  "open_door": true,
	  "type": "recognized"
	}

请求参数

Headers

参数名称 参数值 是否必须 示例 备注

Query

名称 类型 是否必须 备注 示例 其他信息
url 是 视频流地址, 例如 rtsp://10.101.1.60/live1.sdp。这个参数必须经过url encode再传到服务器

返回数据

静态1比N识别

基本信息

Path: /recognize

Method: POST

Tag:

接口描述:

1:N识别

访问地址为: {主机IP}:8866{path}
example: http://192.168.1.50:8866/recognize

请求参数

Headers

参数名称 参数值 是否必须 示例 备注
Content-Type multipart/form-data 是

Body

名称 类型 是否必须 备注 示例 其他信息
image file 是 图片
screen_token text 是 设备 token 735cd0be-779a-4ad1-8de0-b6e768c3c4e4

返回数据

Body

名称 类型 是否必须 备注 示例 其他信息
person object 否 识别出来的用户, confidence表示相似度,tag表示用户信息
├─ confidence number 否
├─ tag string 否
├─ id string 否
can_door_open boolean 否 综合考虑门禁设置、当前时间、识别用户后是否可以开门
error number 否 0:允许进入, 1:不允许访客进入, 2:来访时间未到或已过期, 3:此门只允许部分员工进入, 4:此刻门禁设置为关闭, 5:此刻门禁设置为关闭, 6:设置找不到, 7:陌生人,8:黄名单

错误码定义

错误码信息

错误码 说明
1000 未知错误
1001 请求方法不允许
1002 参数错误
1003 数据库错误
1004 操作不允许
1005 网络错误
1006 无效主题
1007 密码需要更改
1008 二次验证错误
1009 抽取人脸特征服务压力过大,请重试
1010 图片文件格式不正确
1011 core down
1012 禁止使用删除操作
1013 不支持的SEARCH MODEL
1014 无权限
1015 密码为弱密码
1016 添加任务失败
1017 上传文件失败
1018 磁盘空间不足
2000 用户不存在
2001 Group 不存在
2002 Group 已存在
2003 相机不存在
2004 Core 不存在
2005 用户不存在
2006 照片不存在
2007 主机不存在
2008 屏幕不存在
2009 公司不存在
2010 历史记录不存在
2011 用户名已存在
2012 公司已存在
2013 设备不存在,请刷新
2014 该设备已经登录其它公司
2015 参数长度错误
2016 解压错误
2105 访客机不存在
2106 访客机已经被禁用
2107 拜访的用户不存在
2108 短信发送失败
2109 DevicdID已经被注册
2110 用户没有此访客机使用权限
2111 错误的photo_id
20011 主机已经存在
20012 主机已绑定
20013 主机未绑定
20014 主机与用户公司不符
20015 该主机已绑定**路相机,已达最高限制,无法继续绑定
20110 姓名已存在
20120 照片已满
20130 Excel 包含错误
20140 文件不存在
20141 文件格式错误
20150 邮箱已存在
20160 权限不足
20170 上传图片过大
20171 上传图片过小
20172 有其他任务正在运行,无法上传
3000 密码不正确
3001 验证码不正确
3002 两次密码不一致
3003 请登录
3004 该账号未绑定本主机
4001 获取天气信息失败
5000 未检测到人脸
5001 摄像头配置不正确
5002 不是有效的 JSON 格式
5003 名称已存在
5004 人脸质量太低
5005 人脸的亮度过低
5006 人脸的亮度过高
5007 人脸的亮度不均匀 ,请提供脸部光照均匀的图片
5008 人脸角度过大,请提供正脸图片
5009 人脸角度过大,请提供正脸图片
5010 人脸角度过大,请提供正脸图片
5011 人脸不清晰,请提供清晰人脸图片
5012 眼部有遮挡,请提供无遮挡的人脸图片
5013 人脸过小,请提供足够像素的人脸图片
5014 眼部有遮挡,请提供无遮挡的人脸图片
5015 请提供彩色人脸图片
5016 脸部缺失,请提供完整的人脸图片
6000 相机正在删除中,请稍后刷新页面查看
6001 密码错误次数过多,请10分钟后重试
6002 由于您连续输错3次密码,账号已经锁定,请等待10分钟再登陆
6013 组织已存在
6014 组织不存在
6015 公司不在组织内
6016 用户未绑定公司
7001 下载队列未处于活跃状态
7002 下载队列正在全部停止中
7003 队列超过预设最大, 无法添加数据
7004 设备不在下载队列内
7005 设备已经处于下载队列中
7006 未知文件类型
7007 未知设备升级状态
7008 设备升级文件无法使用
7009 等待队列非空无法直接进入下载
7010 状态机内部错误
8001 类型错误, 无法修改状态
8002 升级状态变化不符合规则
8003 设备类型不匹配
9001 MD5校验失败
9002 解压失败
9003 安装包信息错误
9004 上传版本过低,可先删除当前版本再上传
9005 升级文件打开失败
9006 升级文件保存失败, 磁盘空间不足
9007 升级文件保存失败, 请检查网络
9008 请确保升级任务全部停止后再上传升级包
9009 请确保升级任务全部停止后再删除
9010 请停止其他上传任务
9011 文件类型不匹配,请检查后再试
10001 导入人员, 文件名过长

© 2015-2019 Megvii Tech Inc.