人脸识别

    接口文档

    在使用该接口文档前,请先完成如下操作:

    • 前往https://ai.baidu.com/docs#/Auth/top获取access_token
    • 在各接口的请求路径后缀处,以该样式https://xxx.xxx.xxx?access_token=xxx将access_token进行拼接

    1 人员管理

    1.1 人员注册

    请求路径

    https://aip.baidubce.com/rest/2.0/face-link/v1/face/user/create

    请求参数

    {
        "name":"张三",
        "employeeId":"A0001",
        "appId":"fd612b7057d34d00a52b85ac94e93aa6",
        "accessKey":"baiduAdmin",
        "userTypeIdList":[
            "689d53a5-f8d9-458b-b324-7d7c724a5995"
        ],
        "distribute":true,
        "deviceIdList":[
            "LX001"
        ],
        "avatar":"iVBORw0KGgoAA...."
    }

    参数说明

    参数名 类型 含义 是否必填 示例
    appId String 应用编号 fd612b7057d34d00a52b85ac94e93aa6
    accessKey String 用户名 baiduAdmin
    name String 姓名 "刘某"
    employeeId String 人员id "B001"(数字字母组合,不支持特殊字符)
    avatar String 注册头像 "iVBORw0KGgoAA...." 图片base64
    department String 部门 "百度"
    distribute Boolean 是否下发给离线设备 true表示下发
    deviceIdList List 下发设备id列表 ["LX001"],distribute为true时,需要该字段
    userTypeIdList List 人员类型id列表 ["a0fc3f90-85e0-4523-a1cd-ff4da1bd7c00"]

    返回结果

    {
        "success": true,
        "result": {
            "name": "张三",
            "department": "",
            "employeeId": "A0001",
            "avatarPath": "http://127.0.0.1:8322/Face-Link-Platform/image/533b85736e0f46c1b55e887e3aab50b7",
            "userTypeList": [
                {
                    "userTypeId": "689d53a5-f8d9-458b-b324-7d7c724a5995",
                    "userTypeName": "员工",
                    "appId": "fd612b7057d34d00a52b85ac94e93aa6"
                }
            ],
            "userTypeIdList": [
                "689d53a5-f8d9-458b-b324-7d7c724a5995"
            ],
            "createTime": "2020-07-22T06:27:35Z",
            "updateTime": "2020-07-22T06:27:36Z",
            "employeeStatus": "valid",
            "id": "5f17dc58528ba73edcbbf5b8",
            "desc": "",
            "distribute": true,
            "visited": 0,
            "feature": null,
            "appId": "fd612b7057d34d00a52b85ac94e93aa6",
            "mask": false,
            "ttsPath": null,
            "attendancePolicy": {
                "attendancePolicyName": "ff",
                "attendanceId": "894ec154-f163-42d6-9219-fe4da5be9189",
                "workStartTime": {
                    "startTime": "07:11:00",
                    "endTime": "11:11:00"
                },
                "workEndTime": {
                    "startTime": "12:11:00",
                    "endTime": "13:13:00"
                },
                "weekDayList": [
                    1
                ],
                "supplementList": [
                    "2020-07-01",
                    "2020-07-02"
                ],
                "vacationList": [
                    "2020-07-08",
                    "2020-07-09"
                ],
                "userTypeList": [
                    {
                        "userTypeId": "689d53a5-f8d9-458b-b324-7d7c724a5995",
                        "userTypeName": "员工",
                        "appId": "fd612b7057d34d00a52b85ac94e93aa6"
                    }
                ],
                "appId": "fd612b7057d34d00a52b85ac94e93aa6"
            },
            "accessControlPolicy": [
                {
                    "trafficPolicyId": "d397497e-be9d-44fb-a76b-a4f764acd6b4",
                    "trafficPolicyName": "111",
                    "userTypeList": [
                        {
                            "userTypeId": "689d53a5-f8d9-458b-b324-7d7c724a5995",
                            "userTypeName": "员工",
                            "appId": "fd612b7057d34d00a52b85ac94e93aa6"
                        }
                    ],
                    "startTime": "00:00:00",
                    "endTime": "23:59:59",
                    "fullDay": true,
                    "locations": [
                        {
                            "id": "5f104bf9a0b2dd29d0289a11",
                            "name": "all",
                            "appId": "fd612b7057d34d00a52b85ac94e93aa6",
                            "locationId": "000000000000000000000000fd612b7057d34d00a52b85ac94e93aa6",
                            "parent": null,
                            "ancestors": null
                        },
                        {
                            "id": "5f104bfaa0b2dd29d0289a12",
                            "name": "自动注册设备节点",
                            "appId": "fd612b7057d34d00a52b85ac94e93aa6",
                            "locationId": "111111111111111111111111fd612b7057d34d00a52b85ac94e93aa6",
                            "parent": {
                                "id": "5f104bf9a0b2dd29d0289a11",
                                "name": "all",
                                "appId": "fd612b7057d34d00a52b85ac94e93aa6",
                                "locationId": "000000000000000000000000fd612b7057d34d00a52b85ac94e93aa6",
                                "parent": null,
                                "ancestors": null
                            },
                            "ancestors": [
                                "5f104bf9a0b2dd29d0289a11"
                            ]
                        }
                    ]
                }
            ],
            "deviceIdList": null,
            "allDeviceList": null,
            "boxIdList": [],
            "allBoxList": [],
            "distributeBox": false
        }
    }

    参数说明

    参数名 类型 含义
    success Boolean 是否请求成功
    result Object 结果详情
    appId String 应用编号
    +name String 姓名
    +department String 部门
    +employeeId String 人员id
    +avatarPath String 头像绝对地址
    +userTypeList List 人员类型列表
    ++userTypeId String 人员类型id
    ++userTypeName String 人员类型名
    ++appId String 人员类型的appId
    +userTypeIdList List 人员类型id列表
    +createTime Date 人员创建时间UTC格式 例:2020-01-09T08:12:36Z)
    +updateTime Date 人员更新时间(UTC格式 例:2020-01-09T08:12:36Z)
    +employeeStatus String valid表示有效 invalid表示无效
    +id String 人员存储主键
    +desc String 描述
    +distribute Boolean 下发状态 true下发 false不下发
    +deviceIdList List 下发的设备编号列表
    +visited int 是否访客 1访客 0非访客
    +feature String 头像特征值
    +mask Boolean 是否佩戴口罩
    +ttsPath String tts地址
    +attendancePolicy Object 生效的考勤策略(有多个时第一个生效)
    ++appId String 考勤测试的appId
    ++attendanceId String 考勤策略id
    ++attendancePolicyName String 考勤策略名
    ++workStartTime Object 有效上班打卡时间段
    +++startTime String 有效上班打卡时间起点 格式:22:11:00
    +++endTime String 有效上班打卡时间终点 格式:22:11:00
    ++workEndTime Object 有效下班打卡时间段
    +++startTime String 有效下班打卡时间起点 格式:22:11:00
    +++endTime String 有效下班打卡时间终点 格式:22:11:00
    ++userTypeList List 考勤策略绑定的人员标签列表
    +++userTypeId String 人员标签id
    +++userTypeName String 人员标签名
    +++appId String 人员类型的appId
    ++weekDayList List 每周里考勤生效日 1表示周一,2表示周二依次类推
    ++supplementList List 考勤日期补充列表,节假日上班。格式:"2020-01-28"
    ++vacationList List 休假日期补充列表,工作日放假。格式:"2020-01-28"
    +accessControlPolicy List 通行策略列表
    ++trafficPolicyId String 通行策略id
    ++trafficPolicyName String 通行策略名
    ++userTypeList List 通行策略绑定的人员类型列表
    +++userTypeId String 人员类型id
    +++userTypeName String 人员类型名
    +++appId String 人员类型的appId
    ++startTime String 允许通行的开始时间 格式:"00:00:00"
    ++endTime String 允许通行的结束时间 格式:"23:59:00"
    ++fullDay Boolean 是否为全天通行
    ++locations List 允许通行的位置列表
    +++id String 位置主键id
    +++name String 位置名称
    +++appId String 位置的appId
    +++locationId String 位置编号
    +++parent Object 位置父节点
    +++ancestors List 该位置祖先节点id列表

    请求失败

    {
        "success":false,
        "message":{
            "global":"失败原因"
        }
    }

    1.2 人员更新

    字段释义同上

    请求路径

    https://aip.baidubce.com/rest/2.0/face-link/v1/face/user/update

    请求参数

    {
        "distribute":true,
        "name":"rr",
        "appId":"fd612b7057d34d00a52b85ac94e93aa6",
        "accessKey":"baiduAdmin",
        "userTypeIdList":[
            "5751223c-5871-4f7a-8fc9-e3758517e1f5"
        ],
        "department":"tt",
        "deviceIdList":[
            "LX001"
        ],
        "employeeId":"tttg",
        "avatar":"base64 ... "
    }

    返回结果

    {
        "success": true,
        "result": {
            "name": "张三",
            "department": "",
            "employeeId": "A0001",
            "avatarPath": "http://127.0.0.1:8322/Face-Link-Platform/image/533b85736e0f46c1b55e887e3aab50b7",
            "userTypeList": [
                {
                    "userTypeId": "689d53a5-f8d9-458b-b324-7d7c724a5995",
                    "userTypeName": "员工",
                    "appId": "fd612b7057d34d00a52b85ac94e93aa6"
                }
            ],
            "userTypeIdList": [
                "689d53a5-f8d9-458b-b324-7d7c724a5995"
            ],
            "createTime": "2020-07-22T06:27:35Z",
            "updateTime": "2020-07-22T06:27:36Z",
            "employeeStatus": "valid",
            "id": "5f17dc58528ba73edcbbf5b8",
            "desc": "",
            "distribute": true,
            "visited": 0,
            "feature": null,
            "appId": "fd612b7057d34d00a52b85ac94e93aa6",
            "mask": false,
            "ttsPath": null,
            "attendancePolicy": {
                "attendancePolicyName": "ff",
                "attendanceId": "894ec154-f163-42d6-9219-fe4da5be9189",
                "workStartTime": {
                    "startTime": "07:11:00",
                    "endTime": "11:11:00"
                },
                "workEndTime": {
                    "startTime": "12:11:00",
                    "endTime": "13:13:00"
                },
                "weekDayList": [
                    1
                ],
                "supplementList": [
                    "2020-07-01",
                    "2020-07-02"
                ],
                "vacationList": [
                    "2020-07-08",
                    "2020-07-09"
                ],
                "userTypeList": [
                    {
                        "userTypeId": "689d53a5-f8d9-458b-b324-7d7c724a5995",
                        "userTypeName": "员工",
                        "appId": "fd612b7057d34d00a52b85ac94e93aa6"
                    }
                ],
                "appId": "fd612b7057d34d00a52b85ac94e93aa6"
            },
            "accessControlPolicy": [
                {
                    "trafficPolicyId": "d397497e-be9d-44fb-a76b-a4f764acd6b4",
                    "trafficPolicyName": "111",
                    "userTypeList": [
                        {
                            "userTypeId": "689d53a5-f8d9-458b-b324-7d7c724a5995",
                            "userTypeName": "员工",
                            "appId": "fd612b7057d34d00a52b85ac94e93aa6"
                        }
                    ],
                    "startTime": "00:00:00",
                    "endTime": "23:59:59",
                    "fullDay": true,
                    "locations": [
                        {
                            "id": "5f104bf9a0b2dd29d0289a11",
                            "name": "all",
                            "appId": "fd612b7057d34d00a52b85ac94e93aa6",
                            "locationId": "000000000000000000000000fd612b7057d34d00a52b85ac94e93aa6",
                            "parent": null,
                            "ancestors": null
                        },
                        {
                            "id": "5f104bfaa0b2dd29d0289a12",
                            "name": "自动注册设备节点",
                            "appId": "fd612b7057d34d00a52b85ac94e93aa6",
                            "locationId": "111111111111111111111111fd612b7057d34d00a52b85ac94e93aa6",
                            "parent": {
                                "id": "5f104bf9a0b2dd29d0289a11",
                                "name": "all",
                                "appId": "fd612b7057d34d00a52b85ac94e93aa6",
                                "locationId": "000000000000000000000000fd612b7057d34d00a52b85ac94e93aa6",
                                "parent": null,
                                "ancestors": null
                            },
                            "ancestors": [
                                "5f104bf9a0b2dd29d0289a11"
                            ]
                        }
                    ]
                }
            ],
            "deviceIdList": null,
            "allDeviceList": null,
            "boxIdList": [],
            "allBoxList": [],
            "distributeBox": false
        }
    }

    请求失败

    {
        "success":false,
        "message":{
            "global":"失败原因"
        }
    }

    1.3 人员删除

    请求路径

    https://aip.baidubce.com/rest/2.0/face-link/v1/face/user/delete

    请求参数

    {
        "ids":[
            "A001",
            "A002"
        ],
        "accessKey":"baiduAdmin",
        "appId":"fd612b7057d34d00a52b85ac94e93aa6"
    }

    参数说明

    参数名 类型 含义 是否必填 示例
    accessKey String 用户名 baiduAdmin
    appId String 应用编号 fd612b7057d34d00a52b85ac94e93aa6
    ids List 待删除人员id列表 ["001"]

    返回结果

    {
        "success":true,
        "result":["删除成功"]
    }

    请求失败

    {
        "success":false,
        "message":{
            "global":"失败原因"
        }
    }

    1.4 人员检索

    请求路径

    https://aip.baidubce.com/rest/2.0/face-link/v1/face/verify

    请求参数

    {
        "gateId":"AG0001",
        "image":"base64 ... ",
        "trackId":"",
        "appId":"fd612b7057d34d00a52b85ac94e93aa6"
    }

    参数说明

    参数名 类型 含义 是否必填 示例
    gateId String 设备id "AG0002"
    image String 图片base64 "base64 ... "
    appId String 应用编号 fd612b7057d34d00a52b85ac94e93aa6
    trackId String

    返回结果

    {
        "result": 0,
        "desc": "姓名:111\n部门:\n工号:sdsdsd\n",
        "employee": {
            "name": "111",
            "department": "",
            "employeeId": "sdsdsd",
            "avatarPath": "http://127.0.0.1:8329/Face-Link-Platform/image/e0ed9cdb51d6439fb9ff364e171396a5",
            "userTypeList": [
                {
                    "userTypeId": "689d53a5-f8d9-458b-b324-7d7c724a5995",
                    "userTypeName": "员工",
                    "appId": "fd612b7057d34d00a52b85ac94e93aa6"
                }
            ],
            "userTypeIdList": [
                "689d53a5-f8d9-458b-b324-7d7c724a5995"
            ],
            "createTime": "2020-07-22T12:11:53Z",
            "updateTime": "2020-07-22T12:25:37Z",
            "employeeStatus": "valid",
            "id": "5f182d0b528ba73edcbbf5f1",
            "desc": "",
            "distribute": false,
            "visited": 0,
            "feature": null,
            "appId": "fd612b7057d34d00a52b85ac94e93aa6",
            "mask": false,
            "ttsPath": null,
            "attendancePolicy": {
                "attendancePolicyName": "ff",
                "attendanceId": "894ec154-f163-42d6-9219-fe4da5be9189",
                "workStartTime": {
                    "startTime": "07:11:00",
                    "endTime": "11:11:00"
                },
                "workEndTime": {
                    "startTime": "12:11:00",
                    "endTime": "13:13:00"
                },
                "weekDayList": [
                    1
                ],
                "supplementList": [
                    "2020-07-01",
                    "2020-07-02"
                ],
                "vacationList": [
                    "2020-07-08",
                    "2020-07-09"
                ],
                "userTypeList": [
                    {
                        "userTypeId": "689d53a5-f8d9-458b-b324-7d7c724a5995",
                        "userTypeName": "员工",
                        "appId": "fd612b7057d34d00a52b85ac94e93aa6"
                    }
                ],
                "appId": "fd612b7057d34d00a52b85ac94e93aa6"
            },
            "accessControlPolicy": [
                {
                    "trafficPolicyId": "d397497e-be9d-44fb-a76b-a4f764acd6b4",
                    "trafficPolicyName": "111",
                    "userTypeList": [
                        {
                            "userTypeId": "689d53a5-f8d9-458b-b324-7d7c724a5995",
                            "userTypeName": "员工",
                            "appId": "fd612b7057d34d00a52b85ac94e93aa6"
                        }
                    ],
                    "startTime": "00:00:00",
                    "endTime": "23:59:59",
                    "fullDay": true,
                    "locations": [
                        {
                            "id": "5f104bf9a0b2dd29d0289a11",
                            "name": "all",
                            "appId": "fd612b7057d34d00a52b85ac94e93aa6",
                            "locationId": "000000000000000000000000fd612b7057d34d00a52b85ac94e93aa6",
                            "parent": null,
                            "ancestors": null
                        },
                        {
                            "id": "5f104bfaa0b2dd29d0289a12",
                            "name": "自动注册设备节点",
                            "appId": "fd612b7057d34d00a52b85ac94e93aa6",
                            "locationId": "111111111111111111111111fd612b7057d34d00a52b85ac94e93aa6",
                            "parent": {
                                "id": "5f104bf9a0b2dd29d0289a11",
                                "name": "all",
                                "appId": "fd612b7057d34d00a52b85ac94e93aa6",
                                "locationId": "000000000000000000000000fd612b7057d34d00a52b85ac94e93aa6",
                                "parent": null,
                                "ancestors": null
                            },
                            "ancestors": [
                                "5f104bf9a0b2dd29d0289a11"
                            ]
                        }
                    ]
                }
            ],
            "deviceIdList": null,
            "allDeviceList": null,
            "boxIdList": [],
            "allBoxList": [],
            "distributeBox": false
        }
    }

    结果说明

    参数名 类型 含义
    result int 检索结果
    desc String 描述
    employee List 人员详情
    +name String 姓名
    +department String 部门
    +employeeId String 人员id
    +appId String 人员的应用id
    +avatarPath String 头像绝对地址
    +userTypeList List 人员类型列表
    ++userTypeId String 人员类型id
    ++userTypeName String 人员类型名
    ++appId String 人员类型的appId
    +userTypeIdList List 人员类型id列表
    +createTime Date 人员创建时间UTC格式 例:2020-01-09T08:12:36Z)
    +updateTime Date 人员更新时间(UTC格式 例:2020-01-09T08:12:36Z)
    +employeeStatus String valid表示有效 invalid表示无效
    +id String 人员存储主键
    +desc String 描述
    +distribute Boolean 下发状态 true下发 false不下发
    +deviceIdList List 下发的设备编号列表
    +visited int 是否访客 1访客 0非访客
    +feature String 头像特征值
    +mask Boolean 是否佩戴口罩
    +ttsPath String tts地址
    +attendancePolicy Object 生效的考勤策略(有多个时第一个生效)
    ++appId String 考勤测试的appId
    ++attendanceId String 考勤策略id
    ++attendancePolicyName String 考勤策略名
    ++workStartTime Object 有效上班打卡时间段
    +++startTime String 有效上班打卡时间起点 格式:22:11:00
    +++endTime String 有效上班打卡时间终点 格式:22:11:00
    ++workEndTime Object 有效下班打卡时间段
    +++startTime String 有效下班打卡时间起点 格式:22:11:00
    +++endTime String 有效下班打卡时间终点 格式:22:11:00
    ++userTypeList List 考勤策略绑定的人员标签列表
    +++userTypeId String 人员标签id
    +++userTypeName String 人员标签名
    +++appId String 人员类型的appId
    ++weekDayList List 每周里考勤生效日 1表示周一,2表示周二 依次类推
    ++supplementList List 考勤日期补充列表,节假日上班。格式:"2020-01-28"
    ++vacationList List 休假日期补充列表,工作日放假。格式:"2020-01-28"
    +accessControlPolicy List 通行策略列表
    ++trafficPolicyId String 通行策略id
    ++trafficPolicyName String 通行策略名
    ++userTypeList List 通行策略绑定的人员类型列表
    +++userTypeId String 人员类型id
    +++userTypeName String 人员类型名
    +++appId String 人员类型的appId
    ++startTime String 允许通行的开始时间 格式:"00:00:00"
    ++endTime String 允许通行的结束时间 格式:"23:59:00"
    ++fullDay Boolean 是否为全天通行
    ++locations List 允许通行的位置列表
    +++id String 位置主键id
    +++name String 位置名称
    +++appId String 位置的appId
    +++locationId String 位置编号
    +++parent Object 位置父节点
    +++ancestors List 该位置祖先节点id列表

    请求失败

    {
        "result": 1,
        "desc": "检测失败",
        "employee": null
    }

    2 设备管理

    2.1 设备注册(更新)

    请求路径

    https://aip.baidubce.com/rest/2.0/face-link/v1/face/device/create

    请求参数

    {
        "deviceId":"AG001",
        "direction":"out",
        "name":"设备名称",
        "sceneIdList":[
            "GATE_PASS",
            "ATTENDANCE"
        ],
        "accessKey":"baiduAdmin",
        "appId":"fd612b7057d34d00a522b85ac94e93aa6"
    }

    参数说明

    参数名 类型 含义 是否必填 示例
    deviceId String 设备编号 "AG001"
    name String 设备名称 设备1
    direction String 进出方向 in进,out出
    sceneIdList List 应用场景 ["GATE_PASS"] //GATE_PASS为通行;ATTENDANCE为考勤
    accessKey String 用户名 baiduAdmin
    appId String 应用id fd612b7057d34d00a522b85ac94e93aa6

    返回结果

    {
        "success": true,
        "result": {
            "value": "5f104bfaa0b2dd29d0289a12",
            "location": {
                "id": "5f104bfaa0b2dd29d0289a12",
                "name": "自动注册设备节点",
                "appId": "fd612b7057d34d00a52b85ac94e93aa6",
                "locationId": "111111111111111111111111fd612b7057d34d00a52b85ac94e93aa6",
                "parent": {
                    "id": "5f104bf9a0b2dd29d0289a11",
                    "name": "all",
                    "appId": "fd612b7057d34d00a52b85ac94e93aa6",
                    "locationId": "000000000000000000000000fd612b7057d34d00a52b85ac94e93aa6",
                    "parent": null,
                    "ancestors": null
                },
                "ancestors": [
                    "5f104bf9a0b2dd29d0289a11"
                ]
            },
            "deviceId": "1234123",
            "name": "haha",
            "sceneList": [
                {
                    "sceneId": "GATE_PASS",
                    "sceneName": "闸机(门禁)"
                }
            ],
            "direction": "in",
            "status": null,
            "appId": "fd612b7057d34d00a52b85ac94e93aa6",
            "createTime": "2020-07-22T08:03:14Z",
            "updateTime": "2020-07-22T08:03:14Z",
            "offsetThreshold": 0.0
        }
    }

    结果说明

    参数名 类型 含义
    success Boolean 是否请求成功
    result Object 结果详情
    +appId String 应用编号
    +value String 位置id
    +deviceId String 设备id
    +name String 设备名称
    +sceneList List 应用场景对象
    ++sceneId String 应用场景id
    ++sceneName String 应用场景名称
    +direction String 进出方向
    +createTime Date 设备创建时间UTC格式 例:2020-01-09T08:12:36Z)
    +updateTime Date 设备更新时间(UTC格式 例:2020-01-09T08:12:36Z)
    +location Object 允许通行的位置列表
    ++id String 位置id
    ++name String 位置名称
    ++appId String 位置的appId
    ++locationId String 位置编号
    ++parent Object 位置父节点
    ++ancestors List 该位置祖先节点id列表

    请求失败

    {
        "success":false,
        "message":{
            "global":"失败原因"
        }
    }

    2.2 设备删除

    字段释义同上

    请求路径

    https://aip.baidubce.com/rest/2.0/face-link/v1/face/device/delete 

    请求参数

    {
        "deviceId":"AG001",
        "accessKey":"baiduAdmin",
        "appId":"fd612b7057d34d00a522b85ac94e93aa6"
    }

    返回结果

    {
        "success":true,
        "result":["删除成功"]
    }

    请求失败

    {
        "success":false,
        "message":{
            "global":"失败原因"
        }
    }

    2.3 设备详情

    字段释义同上

    请求路径

    https://aip.baidubce.com/rest/2.0/face-link/v1/face/device/details

    请求参数

    {
        "deviceId":"AG001",
        "accessKey":"baiduAdmin",
        "appId":"fd612b7057d34d00a522b85ac94e93aa6"
    }

    返回结果

    {
        "success": true,
        "result": {
            "value": "5f104bfaa0b2dd29d0289a12",
            "location": {
                "id": "5f104bfaa0b2dd29d0289a12",
                "name": "自动注册设备节点",
                "appId": "fd612b7057d34d00a52b85ac94e93aa6",
                "locationId": "111111111111111111111111fd612b7057d34d00a52b85ac94e93aa6",
                "parent": {
                    "id": "5f104bf9a0b2dd29d0289a11",
                    "name": "all",
                    "appId": "fd612b7057d34d00a52b85ac94e93aa6",
                    "locationId": "000000000000000000000000fd612b7057d34d00a52b85ac94e93aa6",
                    "parent": null,
                    "ancestors": null
                },
                "ancestors": [
                    "5f104bf9a0b2dd29d0289a11"
                ]
            },
            "deviceId": "1234123",
            "name": "haha",
            "sceneList": [
                {
                    "sceneId": "GATE_PASS",
                    "sceneName": "闸机(门禁)"
                }
            ],
            "direction": "in",
            "status": null,
            "appId": "fd612b7057d34d00a52b85ac94e93aa6",
            "createTime": "2020-07-22T08:03:14Z",
            "updateTime": "2020-07-22T08:03:14Z",
            "offsetThreshold": 0.0
        }
    }

    请求失败

    {
        "success":false,
        "message":{
            "global":"失败原因"
        }
    }

    2.4 设备列表

    字段释义同上

    请求路径

    https://aip.baidubce.com/rest/2.0/face-link/v1/face/device/list

    请求参数

    {
        "id":"",
        "accessKey":"baiduAdmin",
        "appId":"fd612b7057d34d00a522b85ac94e93aa6"
    }

    参数说明

    参数名 类型 含义 是否必填 示例
    id String 设备编号 位置id,查询所有是传空字符串
    accessKey String 用户名 baiduAdmin
    appId String 应用id fd612b7057d34d00a522b85ac94e93aa6

    返回结果

    {
        "success":true,
        "result":{
            "name":"",
            "deviceList":[
                {
                    "value":"5f104bfaa0b2dd29d0289a12",
                    "location":{
                        "id":"5f104bfaa0b2dd29d0289a12",
                        "name":"自动注册设备节点",
                        "appId":"fd612b7057d34d00a52b85ac94e93aa6",
                        "locationId":"111111111111111111111111fd612b7057d34d00a52b85ac94e93aa6",
                        "parent":{
                            "id":"5f104bf9a0b2dd29d0289a11",
                            "name":"all",
                            "appId":"fd612b7057d34d00a52b85ac94e93aa6",
                            "locationId":"000000000000000000000000fd612b7057d34d00a52b85ac94e93aa6",
                            "parent":null,
                            "ancestors":null
                        },
                        "ancestors":[
                            "5f104bf9a0b2dd29d0289a11"
                        ]
                    },
                    "deviceId":"LX222",
                    "name":"LX222",
                    "sceneList":[
                        {
                            "sceneId":"GATE_PASS",
                            "sceneName":"闸机(门禁)"
                        }
                    ],
                    "direction":"in",
                    "status":"abnormal",
                    "appId":"fd612b7057d34d00a52b85ac94e93aa6",
                    "createTime":"2020-07-17T09:33:47Z",
                    "updateTime":"2020-07-17T09:33:47Z",
                    "offsetThreshold":0
                },
                {
                    "value":"5f104bfaa0b2dd29d0289a12",
                    "location":{
                        "id":"5f104bfaa0b2dd29d0289a12",
                        "name":"自动注册设备节点",
                        "appId":"fd612b7057d34d00a52b85ac94e93aa6",
                        "locationId":"111111111111111111111111fd612b7057d34d00a52b85ac94e93aa6",
                        "parent":{
                            "id":"5f104bf9a0b2dd29d0289a11",
                            "name":"all",
                            "appId":"fd612b7057d34d00a52b85ac94e93aa6",
                            "locationId":"000000000000000000000000fd612b7057d34d00a52b85ac94e93aa6",
                            "parent":null,
                            "ancestors":null
                        },
                        "ancestors":[
                            "5f104bf9a0b2dd29d0289a11"
                        ]
                    },
                    "deviceId":"LX111",
                    "name":"LX111",
                    "sceneList":[
                        {
                            "sceneId":"GATE_PASS",
                            "sceneName":"闸机(门禁)"
                        }
                    ],
                    "direction":"in",
                    "status":"abnormal",
                    "appId":"fd612b7057d34d00a52b85ac94e93aa6",
                    "createTime":"2020-07-17T09:32:00Z",
                    "updateTime":"2020-07-17T09:32:00Z",
                    "offsetThreshold":0
                }
            ]
        }
    }

    请求失败

    {
        "success":false,
        "message":{
            "global":"失败原因"
        }
    }

    2.5 设备监控心跳接口

    请求路径

    https://aip.baidubce.com/rest/2.0/face-link/v1/face/device/heartbeat

    请求参数(GET请求)

    {
        "appId":"fd612b7057d34d00a52b85ac94e93aa6",
        "deviceId":"BBb",
        "type":"shoot",
        "status":"normal"
    }

    参数说明

    参数名 类型 含义 是否必填 示例
    appId String 应用id fd612b7057d34d00a52b85ac94e93aa6
    deviceId String 设备编号 设备id
    type String 设备类型 抓拍:shoot,展示:show
    status String 设备状态 异常:abnormal,正常:normal

    返回结果

    {
        "success":true,
        "result":"heartbeat detection ok"
    }

    请求失败

    {
        "success":false,
        "message":{
            "global":"失败原因"
        }
    }

    3 识别日志

    3.1 识别记录查询

    请求路径

    https://aip.baidubce.com/rest/2.0/face-link/v1/face/log/verify/list

    请求参数

    参数名 类型 含义 是否必填 示例
    accessKey String 用户名 baiduAdmin
    appId String 应用id fd612b7057d34d00a52b85ac94e93aa6
    pageNo int 当前页数 1,表示第一页,默认1
    pageSize int 行数 10,表示展示10条数据,最大查询条数为100
    orderBy String 排序字段 填写 time 表示抓拍时间
    order String 排序顺序 asc 表示正序,desc 表示倒序
    beginTime String 查询开始时间 "2019-07-22T04:08:54Z"
    endTime String 结束时间 "2019-07-23T04:08:54Z"
    locationId String 所在位置ID "000000000000000000000000"
    userTypeId String 人员类型ID "001"
    result String 识别结果 granted 表示通过, denied 表示不通过
    name String 人员姓名 "张三",正则匹配
    department String 人员部门 "百度",正则匹配

    返回结果

    {
        "success": true,
        "page": {
            "pageNo": 1,
            "pageSize": 10,
            "totalCount": 1,
            "result": [                    
                {
                    "id": "5e044dab60ef280b0eb84ce0",
                    "appId": "fd612b7057d34d00a52b85ac94e93aa6",
                    "logId": "logid123",
                    "employee": {
                        "name": "jh",
                        "department": "",
                        "employeeId": "jlk",
                        "avatarPath": null,
                        "userTypeList": [
                            {
                                "userTypeId": "5751223c-5871-4f7a-8fc9-e3758517e1f5",
                                "userTypeName": "员工"
                            }
                        ],
                        "userTypeIdList": [
                            "5751223c-5871-4f7a-8fc9-e3758517e1f5"
                        ],
                        "createTime": "2019-12-26T05:59:42Z",
                        "updateTime": "2019-12-26T05:59:42Z",
                        "employeeStatus": "invalid",
                        "id": "5e044c4e60ef280b0eb84cde",
                        "desc": "",
                        "distribute": false,
                        "visited": 0,
                        "feature": null,
                        "attendancePolicy": null,
                        "accessControlPolicy": null,
                        "deviceIdList": null,
                        "allDeviceList": null
                    },
                    "picture": "http://10.31.76.145:8326/image//traffic/be807a8f-6810-485c-b698-89e365c0a254.jpg",
                    "time": "2019-12-26T06:05:31Z",
                    "result": "granted",
                    "direction": "in",
                    "base64Picture": null,
                    "description": "",
                    "location": "all",
                    "locationId": "000000000000000000000000",
                    "deviceId": "LX001",
                    "timeConsuming": 229,
                    "score": 99.952621459961,
                    "name": "jh",
                    "department": "",
                    "userTypeIdList": [
                        "5751223c-5871-4f7a-8fc9-e3758517e1f5"
                    ],
                    "userTypeList": [
                        {
                            "userTypeId": "5751223c-5871-4f7a-8fc9-e3758517e1f5",
                            "userTypeName": "员工"
                        }
                    ]
                }
            ]
        }
    }

    结果说明

    参数名 类型 含义
    success Boolean 是否请求成功
    page Object
    +pageNo int 当前页
    +pageSize int 当前页数据条数
    +totalCount int 数据总条数
    +result List 结果详情
    ++id String 识别记录存储主键
    ++employee Object 人员详情
    +++name String 姓名
    +++department String 部门
    +++employeeId String 人员id
    +++appId String 人员的应用id
    +++avatarPath String 头像绝对地址
    +++userTypeList List 人员类型列表
    ++++userTypeId String 人员类型id
    ++++userTypeName String 人员类型名
    +++userTypeIdList List 人员类型id列表
    +++createTime Date 人员创建时间UTC格式 例:2020-01-09T08:12:36Z)
    +++updateTime Date 人员更新时间(UTC格式 例:2020-01-09T08:12:36Z)
    +++employeeStatus String valid表示有效 invalid表示无效
    +++id String 人员存储主键
    +++desc String 描述
    +++distribute Boolean 下发状态 true下发 false不下发
    +++visited int 是否访客 1访客 0非访客
    +++feature String 头像特征值
    +++attendancePolicy
    +++accessControlPolicy
    +++deviceIdList
    +++allDeviceList
    ++picture String 抓拍照片绝对路径
    ++time String 识别时间
    ++result String 识别结果 granted 表示通过, denied 表示不通过
    ++direction String 出入方向, in 表示进, out 表示出
    ++description String 描述
    ++location String 位置名称
    ++locationId String 位置ID
    ++deviceId String 设备ID
    ++deviceName String 设备名称
    ++timeConsuming Long 响应时间
    ++score Double 识别分数
    ++logId String 日志id
    ++appId String 应用id

    请求失败

    {
        "success":false,
        "message":{
            "global":"失败原因"
        }
    }

    3.2 通行记录查询

    字段释义同识别记录查询接口 请求路径

    https://aip.baidubce.com/rest/2.0/face-link/v1/face/log/traffic/list

    请求参数

    {
        "accessKey":"baiduAdmin",
        "appId":"fd612b7057d34d00a52b85ac94e93aa6",
        "beginTime":"2020-07-21T16:00:00Z",
        "endTime":"2020-07-22T09:25:36Z",
        "locationId":"5f104bfaa0b2dd29d0289a12",
        "pageNo":1,
        "pageSize":10,
        "department":"百度事业部",
        "name":"张三",
        "result":"granted",
        "userTypeId":"689d53a5-f8d9-458b-b324-7d7c724a5995"
    }

    返回结果

    {
        "success": true,
        "page": {
            "pageNo": 1,
            "pageSize": 10,
            "totalCount": 1,
            "result": [                    
                {
                    "id": "5e044dab60ef280b0eb84ce0",
                    "appId": "fd612b7057d34d00a52b85ac94e93aa6",
                    "logId": "logid123",
                    "employee": {
                        "name": "jh",
                        "department": "",
                        "employeeId": "jlk",
                        "avatarPath": null,
                        "userTypeList": [
                            {
                                "userTypeId": "5751223c-5871-4f7a-8fc9-e3758517e1f5",
                                "userTypeName": "员工"
                            }
                        ],
                        "userTypeIdList": [
                            "5751223c-5871-4f7a-8fc9-e3758517e1f5"
                        ],
                        "createTime": "2019-12-26T05:59:42Z",
                        "updateTime": "2019-12-26T05:59:42Z",
                        "employeeStatus": "invalid",
                        "id": "5e044c4e60ef280b0eb84cde",
                        "desc": "",
                        "distribute": false,
                        "visited": 0,
                        "feature": null,
                        "attendancePolicy": null,
                        "accessControlPolicy": null,
                        "deviceIdList": null,
                        "allDeviceList": null
                    },
                    "picture": "http://10.31.76.145:8326/image//traffic/be807a8f-6810-485c-b698-89e365c0a254.jpg",
                    "time": "2019-12-26T06:05:31Z",
                    "result": "granted",
                    "direction": "in",
                    "base64Picture": null,
                    "description": "",
                    "location": "all",
                    "locationId": "000000000000000000000000",
                    "deviceId": "LX001",
                    "timeConsuming": 229,
                    "score": 99.952621459961,
                    "name": "jh",
                    "department": "",
                    "userTypeIdList": [
                        "5751223c-5871-4f7a-8fc9-e3758517e1f5"
                    ],
                    "userTypeList": [
                        {
                            "userTypeId": "5751223c-5871-4f7a-8fc9-e3758517e1f5",
                            "userTypeName": "员工"
                        }
                    ]
                }
            ]
        }
    }

    请求失败

    {
        "success":false,
        "message":{
            "global":"失败原因"
        }
    }

    3.3 考勤记录查询

    请求路径

    https://aip.baidubce.com/rest/2.0/face-link/v1/face/log/attendance/list

    请求参数

    {
        "accessKey":"baiduAdmin",
        "appId":"fd612b7057d34d00a52b85ac94e93aa6",
        "date":"2020-07",
        "pageNo":1,
        "pageSize":10,
        "department":"百度事业部",
        "name":"张三"
    }

    参数说明

    参数名 类型 含义 是否必填 示例
    accessKey String 用户名 baiduAdmin
    appI String 应用id fd612b7057d34d00a52b85ac94e93aa6
    pageNo int 当前页数 1,表示第一页,默认1
    pageSize int 行数 10,表示展示10条数据,最大查询条数为100
    date String 日期 2020-07
    name String 人员姓名 "张三",正则匹配
    department String 人员部门 "百度",正则匹配

    返回结果

    {
        "success": true,
        "page": {
            "pageNo": 1,
            "pageSize": 10,
            "totalCount": 1,
            "result": [                    
                {
                    "name": "张三",
                    "employeeId": "A001",
                    "department": "百度",
                    "normalCount": "1",
                    "lateCount": "2",
                    "leaveEarlyCount": "3",
                    "forgetCount": "4",
                    "absenceCount": "5"
                }
            ]
        }
    }

    结果说明

    参数名 类型 含义
    success Boolean 是否请求成功
    page Object
    +pageNo int 当前页
    +pageSize int 当前页数据条数
    +totalCount int 数据总条数
    +result List 结果详情
    ++name String 姓名
    ++department String 部门
    ++normalCount int 正常天数
    ++lateCount int 迟到天数
    ++leaveEarlyCount int 早退天数
    ++forgetCount int 漏打卡次数
    ++absenceCount int 缺勤次数

    请求失败

    {
        "success":false,
        "message":{
            "global":"失败原因"
        }
    }

    3.4 识别记录上传

    请求路径

    https://aip.baidubce.com/rest/2.0/face-link/v1/face/device/uploadLog

    请求参数

    {
        "accessKey":"baiduAdmin",
        "appId":"fd612b7057d34d00a52b85ac94e93aa6",
        "deviceId": "AG0001",
        "logList":[
            {
                "logId":"log672224",
                "userId":"sas",
                "time":"2020-07-16 21:06:00",
                "result":"0",
                "image":"/9j/4AAQSkZJRgABAQEASABIAAD ... "
            }      
        ]  
    }

    参数说明

    参数名 类型 含义 是否必填 示例
    accessKey String 用户名 baiduAdmin
    appId String 应用id fd612b7057d34d00a52b85ac94e93aa6
    deviceId String 设备编号 "AG0001"
    logList List 日志信息
    +logId String 人员部门 "logid0001"
    +userId String 人员编号 "zhangsan"
    +time String 日志产生时间 "2020-07-16 21:06:00"
    +result String 结果 "0" //0表示通过,-1表示不通过
    +image String 图片base64 图片的base64值

    返回结果

    {
        "success": true,
        "result": {
            "deviceId": "LX111",
            "logList": [
                "log672224"
            ]
        }
    }

    结果说明

    参数名 类型 含义
    success Boolean 是否请求成功
    +result List 结果详情
    ++deviceId String 设备编号
    ++logList List 日志编号列表

    请求失败

    {
        "success":false,
        "message":{
            "global":"失败原因"
        }
    }
    上一篇
    使用手册
    下一篇
    配套APK使用手册