驾驶证OCR(备份)
<h3>接口描述</h3>
<ul>
<li>传入驾驶证照片,扫描识别驾驶证信息并返回,可以同时识别正页和副页</li>
<li>照片格式为 jpg(jpeg)、png、bmp,宽和高大于100px,小于4000px</li>
<li>文件大小不超过2MB</li>
</ul>
<h3>请求地址</h3>
<p><code>https://api.jumdata.com/ocr/driving-licence</code></p>
<h3>请求方式</h3>
<ul>
<li>POST</li>
</ul>
<h3>请求格式</h3>
<ul>
<li>form-data</li>
</ul>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必须</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>appId</td>
<td>String</td>
<td>是</td>
<td>服务商分配的唯一标识</td>
</tr>
<tr>
<td>timestamp</td>
<td>Long</td>
<td>是</td>
<td>当前时间的毫秒数</td>
</tr>
<tr>
<td>sign</td>
<td>String</td>
<td>是</td>
<td>签名,见签名算法说明</td>
</tr>
<tr>
<td>file</td>
<td>file</td>
<td>否</td>
<td>驾驶证照片,file、base64、url 必须提供一个</td>
</tr>
<tr>
<td>base64</td>
<td>String</td>
<td>否</td>
<td>照片base64字符串,file、base64、url 必须提供一个</td>
</tr>
<tr>
<td>url</td>
<td>String</td>
<td>否</td>
<td>照片 url,file、base64、url 必须提供一个</td>
</tr>
</tbody>
</table>
<h3>签名算法说明</h3>
<pre><code>sign = sha256(appId + appSecret + timestamp)</code></pre>
<p>用服务商分配的 appId、服务商分配的 appSecret,当前时间毫秒数 timestamp,按上述顺序拼接成字符串,再进行 sha256 哈希得到。如下:</p>
<pre><code class="language-java">String appId = &quot;xyzxy2121zxyz&quot;;
String timestamp = &quot;1555378976238&quot;;
String appSecret = &quot;efcefcef1121cefcefc1212121&quot;;
String str = appId + appSecret + timestamp;
String sign = sha256(str);</code></pre>
<h3>正确返回样例</h3>
<pre><code class="language-json">{
&quot;data&quot;: {
&quot;result&quot;: {
&quot;page_b&quot;: {
&quot;file_number&quot;: &quot;340808155496&quot;,
&quot;name&quot;: &quot;张亮&quot;,
&quot;id&quot;: &quot;320381199101152450&quot;
},
&quot;page_a&quot;: {
&quot;birthday&quot;: &quot;1991-01-15&quot;,
&quot;address&quot;: &quot;江苏省新沂市草桥镇古墩村许场队35号&quot;,
&quot;gender&quot;: &quot;男&quot;,
&quot;valid_from&quot;: &quot;&quot;,
&quot;type&quot;: &quot;C1&quot;,
&quot;version&quot;: &quot;2&quot;,
&quot;date_of_first_issue&quot;: &quot;2019-01-18&quot;,
&quot;valid_date&quot;: &quot;2019-01-18至2025-01-18&quot;,
&quot;nationality&quot;: &quot;中国&quot;,
&quot;name&quot;: &quot;张亮&quot;,
&quot;issue_by&quot;: &quot;安徽省安庆市公安局交通警察支队&quot;,
&quot;id&quot;: &quot;320381199101152450&quot;,
&quot;valid_for&quot;: &quot;&quot;
}
},
&quot;score&quot;: {
&quot;page_b&quot;: {
&quot;file_number&quot;: 99.997,
&quot;name&quot;: 99.998,
&quot;id&quot;: 99.982
},
&quot;page_a&quot;: {
&quot;birthday&quot;: 99.988,
&quot;address&quot;: 99.705,
&quot;gender&quot;: 100.0,
&quot;valid_from&quot;: 0.0,
&quot;type&quot;: 99.999,
&quot;version&quot;: 0.0,
&quot;date_of_first_issue&quot;: 99.98,
&quot;valid_date&quot;: 99.981,
&quot;nationality&quot;: 100.0,
&quot;name&quot;: 99.986,
&quot;issue_by&quot;: 99.314,
&quot;id&quot;: 99.82,
&quot;valid_for&quot;: 0.0
}
}
},
&quot;msg&quot;: &quot;成功&quot;,
&quot;code&quot;: 200,
&quot;taskNo&quot;: &quot;57514898542307901883&quot;
}</code></pre>
<h3>错误返回样例</h3>
<pre><code class="language-json">{
&quot;msg&quot;: &quot;照片格式不正确&quot;,
&quot;code&quot;: 400
}</code></pre>
<h3>返回字段说明</h3>
<table>
<thead>
<tr>
<th>字段名</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>code</td>
<td>返回码,详见code返回码说明</td>
</tr>
<tr>
<td>msg</td>
<td>code对应的描述</td>
</tr>
<tr>
<td>charge</td>
<td>是否计费</td>
</tr>
<tr>
<td>taskNo</td>
<td>本次请求号</td>
</tr>
<tr>
<td>data</td>
<td>返回具体结果,object类型,详见data返回字段描述</td>
</tr>
</tbody>
</table>
<h4>data返回字段说明</h4>
<pre><code class="language-json">{
&quot;result&quot;: { // 驾驶证文字信息
&quot;page_a&quot;: { //正页
&quot;birthday&quot;: String, //出生日期
&quot;address&quot;: String, //住址
&quot;gender&quot;: String, //性别
&quot;valid_from&quot;: String, //有效起始日期,`version`为1时返回此字段,其他情况此字段为空
&quot;type&quot;: String, //准驾车型
&quot;version&quot;: String, //版本号,2008或更早版本返回1,2013版本返回2
&quot;date_of_first_issue&quot;: String, //初次领证日期
&quot;valid_date&quot;: String, //有效期限,`version`为2时返回此字段,其他情况此字段为空
&quot;nationality&quot;: String, //国籍
&quot;name&quot;: String, //姓名
&quot;issue_by&quot;: String, //签发机关
&quot;id&quot;: String, //驾驶证号
&quot;valid_for&quot;: String //有效期限长度,`version`为1时返回此字段,其他情况此字段为空
},
&quot;page_b&quot;: { //副页
&quot;file_number&quot;: String, //档案编号
&quot;name&quot;: String, //姓名
&quot;id&quot;: String //驾驶证号
}
},
&quot;score&quot;: { //文字信息识别结果的置信度
&quot;page_a&quot;: { // 正页
&quot;id&quot;: float, // 驾驶证号
&quot;name&quot;: float, // 姓名
&quot;gender&quot;: float, // 性别
&quot;nationality&quot;: float, // 国籍
&quot;address&quot;: float, // 住址
&quot;birthday&quot;: float, // 出生日期
&quot;issue_by&quot;:float, // 签发机关
&quot;date_of_first_issue&quot;: float, // 初次领证日期
&quot;type&quot;: float, // 准驾车型
&quot;version&quot;: float, // 版本号,默认为0
&quot;valid_from&quot;: float, // 有效起始日期,`version`为1时返回此字段,其他情况此字段为0
&quot;valid_for&quot;: float, // 有效期限长度,`version`为1时返回此字段,其他情况此字段为0
&quot;valid_date&quot;: float //有效期限,`version`为2时返回此字段,其他情况此字段为0
},
&quot;page_b&quot;: { // 副页
&quot;id&quot;: float, // 驾驶证号
&quot;name&quot;: float, // 姓名
&quot;file_number&quot;: float//# 档案编号
}
}
}</code></pre>
<h4>code返回码说明</h4>
<table>
<thead>
<tr>
<th>code</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>200</td>
<td>成功 (计费)</td>
</tr>
<tr>
<td>400</td>
<td>参数错误</td>
</tr>
<tr>
<td>404</td>
<td>接口地址不正确</td>
</tr>
<tr>
<td>500</td>
<td>系统维护,请稍候再试</td>
</tr>
<tr>
<td>601</td>
<td>接口未开通</td>
</tr>
<tr>
<td>602</td>
<td>账号停用</td>
</tr>
<tr>
<td>603</td>
<td>余额不足请充值</td>
</tr>
<tr>
<td>604</td>
<td>接口停用</td>
</tr>
<tr>
<td>606</td>
<td>调用超限,请稍候再试</td>
</tr>
<tr>
<td>607</td>
<td>ip不在白名单</td>
</tr>
<tr>
<td>609</td>
<td>请求过于频繁,请稍候再试</td>
</tr>
<tr>
<td>610</td>
<td>请求超时</td>
</tr>
<tr>
<td>999</td>
<td>其他,以实际返回为准</td>
</tr>
</tbody>
</table>