API参数 身份证OCR 调用地址: http,https://jumkire.api.bdymkt.com/ocr/idcard
请求方式: POST 支持格式: application/json;charset=UTF-8 调用工具: 去调试 请求参数(Headers) 请求参数(Query)
- photoUrl
- string
- false
- 身份证照片url,photoBase64、photoUrl 必须提供一个
- --
请求参数(Body)
- photoBase64
- string
- false
- --
- 身份证照片base64串,photoBase64、photoUrl 必须提供一个
请求参数(Path) 请求示例 javapythongocurlphpnodejs
示例代码使用, 需要使用Maven加入依赖 <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;
public class RequestDemo {
public static void main(String[] args) {
String path = "//ocr/idcard";
ApiExplorerRequest request = new ApiExplorerRequest(HttpMethodName.POST, path);
request.setCredentials("您的 access key", "您的 secret key");
request.addHeaderParameter("Content-Type", "application/json;charset=UTF-8");
request.addQueryParameter("photoUrl", "");
ApiExplorerClient client = new ApiExplorerClient(new AppSigner());
try {
ApiExplorerResponse response = client.sendRequest(request);
System.out.println(response.getResult());
} catch (Exception e) {
e.printStackTrace();
}
}
}
点击复制代码
正常返回示例
#正面返回
{
"code": 200,
"data": {
"order_no": "611344112121216",
"result": 0,
"side": "front",
"image_url": ""
"info": {
"number": "330106198912014010",
"name": "赵宁宁",
"address": "浙江省杭州市西湖区文二路108号",
"year": "1989",
"month": "12",
"day": "1",
"nation": "汉",
"sex": "男",
},
"validity": {
"birthday": true,
"number": true,
"address": true,
"sex": true,
"name": true
}
}
}
#反面样例
{
"code": 200,
"taskNo": "074388502348792558",
"data": {
"result": 0,
"side": "back",
"info": {
"authority": "杭州市公安局余杭分局",
"timelimit": "20190806-20390806"
},
"validity": {
"authority": true,
"timelimit": true
}
}
}
失败返回示例
{
"msg": "照片格式不正确”,
"code": 400 // 请查阅错误码定义
}
错误码定义
- 500
- 服务商维护,请稍候再试
- 500
- 服务商维护,请稍候再试
- 999
- 其他,以实际返回为准
- 500
- 其他,以实际返回为准