<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 = "https://gwgp-dmgjrjt5y5f.n.bdcloudapi.com/s/api/ocr/policy/autoInsurance";
ApiExplorerRequest request = new ApiExplorerRequest(HttpMethodName.POST, path);
request.setCredentials("您的 access key", "您的 secret key");
request.addHeaderParameter("Content-Type", "application/json;charset=UTF-8");
request.addQueryParameter("imgBase64", "");
request.addQueryParameter("imgUrl", "");
ApiExplorerClient client = new ApiExplorerClient(new AppSigner());
try {
ApiExplorerResponse response = client.sendRequest(request);
// 返回结果格式为Json字符串
System.out.println(response.getResult());
} catch (Exception e) {
e.printStackTrace();
}
}
}
点击复制代码
正常返回示例 {
"data": {
"policyNo": "2012-330110-00000487-2",
"underWriteDate": "2012年06月14日",
"effectiveStartDate": "2012年06月15日",
"chargePeriodType": "年交",
"chargeDate": "每年的06月15日",
"premium": "",
"currency": "人民币",
"insurer": {
"customerNo": "2010-330110-50016219-5",
"name": "钱少娟"
},
"insuredList": [
{
"customerNo": "2012-330110-50005973-0",
"name": "林恩羽"
}
],
"benefitList": [],
"productList": [
{
"name": "国寿福满一生两全保险(分红型)",
"mainPrd": "",
"basicAmnt": "40000.00",
"prem": "",
"payYears": "2022年06月14日",
"coverYears": "74年"
},
{
"name": "国寿长久呵护住院费用补偿医疗保险0000.00",
"mainPrd": "",
"basicAmnt": "",
"prem": "",
"payYears": "2013年06月14日",
"coverYears": "1年"
},
{
"name": "国寿长久呵护意外伤害费用补偿医殉0000.00",
"mainPrd": "",
"basicAmnt": "",
"prem": "",
"payYears": "2013年06月14日",
"coverYears": "1年"
}
]
},
"serialNo": "343860514712977408",
"message": "success",
"code": 0,
"reqId": "e684abe0-b3b2-11eb-82a1-b42e99a9afd7",
"status": 200
}
失败返回示例 {
"serialNo": "343841871253995520",
"message": "检测文字失败,请确认上传的文件是否合法",
"status": 400,
"code": 3000
}
错误码定义 0 (0%) 好评 | 0 (0%) 中评 | 0 (0%) 差评 |