聚美智数


活体检测H5-V2(备份)

<p>[TOC]</p> <h3>简介</h3> <ul> <li>活体检测H5是通过引入H5页面实现人像活体检测的RESTful Web Service接口</li> <li>本接口支持静默、动作、闪光</li> <li>检测成功之后提取一张人像照片</li> </ul> <h3>接入流程</h3> <p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=86965a43d2d43576f7f25a9b6374ed5c&amp;amp;file=file.png" alt="" /></p> <ol> <li>接入者服务端通过调用聚美智数活体检测初始化接口获取token,并将token返回给浏览器端; </li> <li>浏览器端获取token之后,调用聚美智数获取检测页面接口获取检测页面的html;</li> <li>浏览器端根据获取到的检测页面的html,渲染活体检测H5页面,进行活体检测;检测结束后,会自动跳转至初始化时指定的地址;</li> <li>接入者服务端通过调用聚美智数获取检测结果接口获取结果;</li> </ol> <h3>接口调用说明</h3> <h4>请求方式</h4> <p>如接口没有单独说明,所有接口均为:<strong>POST</strong></p> <h4>请求格式</h4> <p>如接口没有单独说明,所有接口均为:<strong>application/x-www-form-urlencoded</strong></p> <h4>请求参数</h4> <p>请求参数均包括公共参数和业务参数(业务参数见具体接口说明) 如接口没有单独说明,所有接口调用时,均需要把<strong>公共参数</strong>和<strong>业务参数</strong>一并放在<strong>请求参数</strong>中提交</p> <p>&lt;a name=&quot;公共请求参数&quot;&gt;&lt;/a&gt;</p> <h5>公共请求参数</h5> <table> <thead> <tr> <th>名称</th> <th>类型</th> <th>必须</th> <th>&lt;div style=&quot;width:420px;&quot;&gt;说明&lt;/div&gt;</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> </tbody> </table> <h5>签名算法说明</h5> <pre><code>sign = sha256(appId + appSecret + timestamp)</code></pre> <p>用服务商分配的 <strong>appId</strong>、服务商分配的 <strong>appSecret</strong>,当前时间戳(毫秒) <strong>timestamp</strong>,按上述顺序拼接成字符串,再进行 <strong>sha256</strong> 哈希得到。如下:</p> <pre><code class="language-java">String appId = &amp;quot;xyzxy2121zxyz&amp;quot;; String timestamp = &amp;quot;1555378976238&amp;quot;; String appSecret = &amp;quot;efcefcef1121cefcefc1212121&amp;quot;; String str = appId + appSecret + timestamp; String sign = sha256(str);</code></pre> <h4>返回说明</h4> <h5>公共返回字段说明</h5> <p>所有接口均返回以下公共字段:</p> <table> <thead> <tr> <th>字段名</th> <th>&lt;div style=&quot;width:420px&quot;&gt;说明&lt;/div&gt;</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>计费标志 true为计费,false为不计费</td> </tr> <tr> <td>taskNo</td> <td>本次请求号</td> </tr> <tr> <td>data</td> <td>返回具体结果,object类型,详见data返回字段描述</td> </tr> </tbody> </table> <p>&lt;a name=&quot;公共code返回码说明&quot;&gt;&lt;/a&gt;</p> <h5>公共code返回码说明</h5> <p>所有接口公共返回码如下:</p> <table> <thead> <tr> <th>code</th> <th>&lt;div style=&quot;width:420px;&quot;&gt;说明&lt;/div&gt;</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>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> <hr /> <h3>活体检测初始化</h3> <h4>请求地址</h4> <p><code>https://api.jumdata.com/lifecheck/h5/v2/init</code></p> <h4>业务参数</h4> <table> <thead> <tr> <th>名称</th> <th>类型</th> <th>必须</th> <th>&lt;div style=&quot;width:420px;&quot;&gt;说明&lt;/div&gt;</th> </tr> </thead> <tbody> <tr> <td>returnUrl</td> <td>String</td> <td>是</td> <td>检测完成后页面自动重定向地址,以http或https开头,长度不超过128字符。接口者需要在该地址的页面去获取检测结果</td> </tr> <tr> <td>colors</td> <td>String</td> <td>否</td> <td>闪光颜色,多个按 , 分割。默认不开启。&lt;br&gt;闪光活体通过亮色和暗色交替闪烁进行活体判断。数组颜色指定两个或多个颜色时,须同时包含亮色和暗色,系统将随机在提交的颜色中选取亮色光和暗色光交替闪烁。颜色数组不区分顺序,从系统提供的颜色中配置。&lt;br&gt;推荐使用亮色:#FFFFFF和暗色:#000000。&lt;br&gt;系统提供14种闪光颜色:&lt;br&gt;亮色:#FFFFFF,#FFD9E3,#D8D6FF,#CFF9FF,#FFCEFD,#D8FFCD,#FFF4CB。&lt;br&gt;暗色:#000000,#3B3C04,#183C03,#063C28,#063C3A,#060D3C,#3C0636</td> </tr> <tr> <td>actions</td> <td>String</td> <td>否</td> <td>动作,多个按 , 分割,并区分顺序。默认不开启,指定一个或多个动作时开启。&lt;br&gt;动作参数如下:&lt;br&gt;LookFront:直视摄像头&lt;br&gt;LookLeft:向左转头&lt;br&gt;LookRight:向右转头&lt;br&gt;LookUp:抬头&lt;br&gt;LookDown:低头&lt;br&gt;OpenMouth:张嘴&lt;br&gt;BlinkEye:眨眼&lt;br&gt;ShakeHead:摇头&lt;br&gt;NodHead:点头</td> </tr> </tbody> </table> <p>&gt; 闪光和动作(LookFront直视除外)同时使用时,必须在actions参数中设置LookFront直视动作,在直视摄像头时启动。单独使用闪光活体时,可不设置动作活体参数。</p> <p>公共请求参数请参阅:&lt;a href=&quot;#公共请求参数&quot;&gt;公共请求参数&lt;/a&gt;</p> <h4>成功返回样例</h4> <pre><code class="language-json">{ &amp;quot;code&amp;quot;: 200, &amp;quot;msg&amp;quot;: &amp;quot;成功&amp;quot;, &amp;quot;taskNo&amp;quot;: &amp;quot;043439882226367117195632&amp;quot;, &amp;quot;charge&amp;quot;: true, &amp;quot;data&amp;quot;: { &amp;quot;token&amp;quot;: &amp;quot;xxx&amp;quot; // 本次检测的token,有效期为10分钟,用于后续接口 } }</code></pre> <h4>code返回码说明</h4> <p>本接口没有特殊返回码,请参阅:&lt;a href=&quot;#公共code返回码说明&quot;&gt;公共code返回码说明&lt;/a&gt;</p> <hr /> <h3>获取获取检测h5页面html</h3> <h4>请求地址</h4> <p><code>https://api.jumdata.com/lifecheck/h5/v2/html</code></p> <h4>请求方式</h4> <ul> <li>GET</li> </ul> <h4>请求参数</h4> <table> <thead> <tr> <th>名称</th> <th>类型</th> <th>必须</th> <th>&lt;div style=&quot;width:420px;&quot;&gt;说明&lt;/div&gt;</th> </tr> </thead> <tbody> <tr> <td>token</td> <td>String</td> <td>是</td> <td>初始化接口返回的token</td> </tr> </tbody> </table> <p>&gt; 该接口无需传入公共参数,可在浏览器端直接调用</p> <h4>返回说明</h4> <p>请求成功时返回检测页面html内容,失败则返回相应错误信息 本接口返回不是json格式</p> <hr /> <h3>获取活体检测结果</h3> <h4>请求地址</h4> <p><code>https://api.jumdata.com/lifecheck/h5/v2/result</code></p> <table> <thead> <tr> <th>名称</th> <th>类型</th> <th>必须</th> <th>&lt;div style=&quot;width:420px;&quot;&gt;说明&lt;/div&gt;</th> </tr> </thead> <tbody> <tr> <td>token</td> <td>String</td> <td>是</td> <td>初始化接口返回的token</td> </tr> </tbody> </table> <p>公共请求参数请参阅:&lt;a href=&quot;#公共请求参数&quot;&gt;公共请求参数&lt;/a&gt;</p> <h4>检测通过返回样例</h4> <pre><code class="language-json">{ &amp;quot;code&amp;quot;: 200, &amp;quot;msg&amp;quot;: &amp;quot;活体检测通过&amp;quot;, &amp;quot;taskNo&amp;quot;: &amp;quot;043439882226367117195632&amp;quot;, &amp;quot;data&amp;quot;: { &amp;quot;faceImageUrl&amp;quot;: &amp;quot;xxx&amp;quot; // 检测通过时返回人像照片 } }</code></pre> <h4>检测不通过返回样例</h4> <pre><code class="language-json">{ &amp;quot;code&amp;quot;: 202, &amp;quot;msg&amp;quot;: &amp;quot;活体检测未通过&amp;quot;, &amp;quot;taskNo&amp;quot;: &amp;quot;043439882226367117195632&amp;quot;, }</code></pre> <h4>未查询到检测结果返回样例</h4> <pre><code class="language-json">{ &amp;quot;code&amp;quot;: 201, &amp;quot;msg&amp;quot;: &amp;quot;未查询到检测结果&amp;quot;, &amp;quot;taskNo&amp;quot;: &amp;quot;043439882226367117195632&amp;quot;, }</code></pre> <h4>检测失败样例</h4> <pre><code class="language-json">{ &amp;quot;code&amp;quot;: 203, &amp;quot;msg&amp;quot;: &amp;quot;检测失败&amp;quot;, &amp;quot;taskNo&amp;quot;: &amp;quot;043439882226367117195632&amp;quot;, }</code></pre> <h4>code返回码说明</h4> <table> <thead> <tr> <th>code</th> <th>&lt;div style=&quot;width:120px;&quot;&gt;说明&lt;/div&gt;</th> <th>&lt;div style=&quot;width:420px;&quot;&gt;原因说明&lt;/div&gt;</th> </tr> </thead> <tbody> <tr> <td>200</td> <td>活体检测通过(计费)</td> <td></td> </tr> <tr> <td>202</td> <td>活体检测未通过(计费)</td> <td>1.检测到摄像头视频劫持攻击&lt;br&gt;2.在视频中用户做出的动作不符合给定的序列&lt;br&gt;3.人脸未通过活体判断&lt;br&gt;</td> </tr> <tr> <td>201</td> <td>未查询到检测结果</td> <td></td> </tr> <tr> <td>203</td> <td>活体检测失败</td> <td>1.浏览器缺少进行活体采集的特性或出现软硬件故障&lt;br&gt;2.用户拒绝进行活体采集,例如摄像头权限被禁止&lt;br&gt;3.动作参数错误 &lt;br&gt;4.其它错误</td> </tr> <tr> <td>301</td> <td>token已过期</td> <td>指初始化之后未在10分钟内获取结果</td> </tr> </tbody> </table> <p>公共返回码请参阅:&lt;a href=&quot;#公共code返回码说明&quot;&gt;公共code返回码说明&lt;/a&gt;</p>

页面列表

ITEM_HTML