产品详情
API参数 身份证单双面识别 调用地址: http,https://idcardocr.api.bdymkt.com/idcard/ocr 请求方式: POST 支持格式: application/x-www-form-urlencoded 调用工具: 去调试 请求参数(Headers) 请求参数(Query) 请求参数(Body)
- 名称
- 类型
- 是否必须
- 示例值
- 描述
- image
- string
- true
- --
- 图片base64字符串
<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-ksbcdfjvde6.n.bdcloudapi.com/idcard/ocr";
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();
}
}
}
点击复制代码
正常返回示例 正面
{
"msg": "",
"success": true,
"code": 200,
"data": {
"order_no": "634416423342575616",
"result": 0,
"side": "front",
"info": {
"number": "320382198912010000",
"address": "江苏省苏州市岔河镇东沙庄村黄庄190号",
"month": "12",
"nation": "汉",
"year": "1989",
"sex": "男",
"name": "赵某宁",
"day": "1"
},
"validity": {
"birthday": true,
"number": true,
"address": true,
"sex": true,
"name": true
},
"image_url": "http://shumai-picture.oss-cn-hangzhou.aliyuncs.com/%E5%95%86%E7%9B%9F/20.png"
}
}
反面
{
"msg": "",
"success": true,
"code": 200,
"data": {
"order_no": "634436714873622528",
"result": 0,
"side": "back",
"info": {
"authority": "杭州市公安局余杭分局",
"timelimit": "20180806-20380806"
},
"validity": {
"authority": true,
"timelimit": true
},
"image_url": null
}
}
失败返回示例 {
"msg": "入参错误,
"success": false,
"code": 400,
"data": { }
}
错误码定义
