产品详情
API参数 人脸认证 调用地址: http,https://facereginon.api.bdymkt.com/v1/idfaceIdentity 请求方式: POST 支持格式: application/x-www-form-urlencoded 调用工具: 去调试 请求参数(Headers) 请求参数(Query) 请求参数(Body)
- 名称
- 类型
- 是否必须
- 示例值
- 描述
- number
- string
- false
- 33032919900xxxxx
- 身份证号码
- base64Str
- string
- false
- XXXXXXX
- 人脸照片的base64位编码字符串(需utf8编码) 注:照片需要大于5kb,小于100kb 头像姿态建议:平面旋转:-15°~15°,俯仰变化:-10°~10°,姿态偏转:-15°~15°, 特别注意:图片中头像不可倒置 base64不需要带(data:image/png;base64,)
- name
- string
- false
- 李四
- 姓名
<dependency>
<groupId>com.baidubce</groupId>
<artifactId>api-explorer-sdk</artifactId>
<version>1.0.0</version>
</dependency>
import com.baidubce.http.ApiExplorerClient;
import com.baidubce.http.AppSigner;
import com.baidubce.http.HttpMethodName;
import com.baidubce.model.ApiExplorerRequest;
import com.baidubce.model.ApiExplorerResponse;
// 人脸认证 Java示例代码
public class RequestDemo {
public static void main(String[] args) {
String path = "http://gwgp-pvugirpt8gk.n.bdcloudapi.com/v1/idfaceIdentity";
ApiExplorerRequest request = new ApiExplorerRequest(HttpMethodName.POST, path);
request.setCredentials("您的 access key", "您的 secret key");
request.addHeaderParameter("Content-Type", "application/x-www-form-urlencoded");
ApiExplorerClient client = new ApiExplorerClient(new AppSigner());
try {
ApiExplorerResponse response = client.sendRequest(request);
// 返回结果格式为Json字符串
System.out.println(response.getResult());
} catch (Exception e) {
e.printStackTrace();
}
}
}
点击复制代码
正常返回示例 {
"error_code": 0,
"reason": "成功",
"result": {
"IdCardNo": "6101*********",
"Name": "李*",
"Validate_Result": 1,
"Similarity": 92
}
}
validate_result String 验证结果 -1,身份证和姓名不一致 -2,公安库中无此身份证记录 -3,公安身份证库中没有此号码的照片-4 照片参数不合格 -5 照片相片体积过大 -6,请检查图片编码 -7,照片相片体积过小 1,系统分析为同一人 ,2,系统分析可能为同一人 3, 系统分析为不是同人 4,没检测到人脸 5,疑似非活体 6,出现多张脸 7,身份证和姓名一致,官方人脸比对失败
similarity String 相似度 1~100 (当validate_result>0时,本值才有效(相似度>=45 为同一人; 40<=相似度<45 不确定为同一人; 相似度<40 确定为不同人))
失败返回示例 错误码定义
