产品详情
API参数 身份证识别 调用地址: http,https://sfzsb.api.bdymkt.com/idcard 请求方式: POST 支持格式: application/json;charset=UTF-8 调用工具: 去调试 请求参数(Headers) 请求参数(Query) 请求参数(Body)
- 名称
- 类型
- 是否必须
- 示例值
- 描述
- baseFile
- string
- false
- base64位加密图片字符串(必填)
- --
- header
- string
- false
- 是否返回头像图片流(base位),默认为0:否,1:是(非必填)
- --
<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-tduzzsteuft.n.bdcloudapi.com/idcard";
ApiExplorerRequest request = new ApiExplorerRequest(HttpMethodName.POST, path);
request.setCredentials("您的 access key", "您的 secret key");
request.addHeaderParameter("Content-Type", "application/json;charset=UTF-8");
ApiExplorerClient client = new ApiExplorerClient(new AppSigner());
try {
ApiExplorerResponse response = client.sendRequest(request);
// 返回结果格式为Json字符串
System.out.println(response.getResult());
} catch (Exception e) {
e.printStackTrace();
}
}
}
点击复制代码
正常返回示例 {
"status": "OK",
"data": {
"name": "田杰",
"cardno": "130105199004072413",
"sex": "男",
"folk": "汉",
"birthday": "1990年04月07日",
"address": "河北省石家庄市桥西区中山西路777号",
"header_pic": "base64位头像图片字符串",
"issue_authority":"上海市公安局",
"valid_period":"2008.02.14-2018.02.14"
}
}
失败返回示例 {
"status": "-101",
"info": "未找到上传的文件"
}
错误码定义
