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; // 驾驶证OCR识别 Java示例代码 public class RequestDemo { public static void main(String[] args) { String path = "http://gwgp-imzsxgkjsan.n.bdcloudapi.com/driving_licence/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, //code=200收费
"data":{
"order_no": "58113280528364****",//订单号
"result":{
"page_b":{ //副页
"file_number": "36240071****",//档案编号
"name": "谢**",//姓名
"id": "36242719930123****"//驾驶证号
},
"page_a":{//正页
"birthday": "1993-01-23",//生日
"address": "江西省吉安市遂川县***7号",//地址
"gender": "男",//性别
"valid_from": "",//有效起始⽇日期,`version`为1时返回此字段,其他情 况此字段为空
"type": "C1",//准驾⻋车型
"version": "2",//版本号,2008或更更早版本返回1,2013版本返回2
"date_of_first_issue": "2013-07-02",//初次领证⽇日期
"valid_date": "2013-07-02至2019-07-02",//有效期限,`version`为2时返回此字段,其他情况此字 段为空
"nationality": "中国",//国籍
"name": "谢**",//姓名
"issue_by": "江西省吉安市公安局交通警察支队",//签发机关
"id": "36242719930123****",//驾驶证号
"valid_for": ""//有效期限⻓长度,`version`为1时返回此字段,其他情况 此字段为空
}
}
}
}
{
"msg": "入参错误,
"success": false,
"code": 400,
"data": { }
}
数据准确,响应迅速,价格优惠
购买页面上有基于api接口的请求url,入参字段,响应接口结果,和返回错误码描述,请按照要求对接即可