号码标记查询
<p>[TOC]</p>
<h3>简介</h3>
<ul>
<li>查询号码是否被标记,支持腾讯手机管家、360手机管家、电话邦、百度搜索、小米</li>
<li>本接口为异步方式,接入者先发起查询请求,服务商获取结果后将结果推送给接入者,推送时间约为发起请求后的1个小时</li>
</ul>
<h3>发起查询请求</h3>
<h4>请求地址</h4>
<p><code>https://api.jumdata.com/phone/mark/query</code></p>
<h4>请求方式</h4>
<ul>
<li>POST</li>
</ul>
<h4>请求格式</h4>
<ul>
<li>x-www-form-urlencoded</li>
</ul>
<h4>请求参数</h4>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必须</th>
<th><div style="width:420px;">说明</div></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>phone</td>
<td>String</td>
<td>是</td>
<td>号码,座机必须带上区号,不能带有“-”,请合并一起传入,比如: 0571-88991122, 传入 057188991122</td>
</tr>
<tr>
<td>callbackUrl</td>
<td>String</td>
<td>是</td>
<td>接收标记结果的地址</td>
</tr>
</tbody>
</table>
<h4>签名算法说明</h4>
<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 = &quot;xyzxy2121zxyz&quot;;
String timestamp = &quot;1555378976238&quot;;
String appSecret = &quot;efcefcef1121cefcefc1212121&quot;;
String str = appId + appSecret + timestamp;
String sign = sha256(str);</code></pre>
<h4>返回说明</h4>
<table>
<thead>
<tr>
<th>字段名</th>
<th><div style="width:420px">说明</div></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>
<h4>成功返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 200,// 返回码,详见返回码说明
&quot;msg&quot;: &quot;成功&quot;,// 返回码对应描述
&quot;taskNo&quot;: &quot;043439882226367117195632&quot;,// 本次请求号,推送的时候传回来
&quot;charge&quot;: true, // 计费标志
}</code></pre>
<h4>失败返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 400,// 返回码,详见返回码说明
&quot;charge&quot;: false,// 计费标志
&quot;msg&quot;: &quot;号码格式不正确&quot; // 返回码对应描述
}</code></pre>
<h4>code返回码说明</h4>
<table>
<thead>
<tr>
<th>code</th>
<th><div style="width:420px;">说明</div></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>
<pre><code class="language-json">{
&quot;phone&quot;: &quot;13926252622&quot;,
&quot;queryTaskNo&quot;: &quot;&quot;, // 发起查询请求接口返回的请求号
&quot;status&quot;: &quot;查询完成&quot;, // 状态 查询中, 查询完成
&quot;create_time&quot;: &quot;2024-06-14 11:49:35&quot;, // 号码导入时间
&quot;date&quot;: &quot;2024-06-14&quot;,
&quot;mobile_housekeeper_status&quot;: &quot;查询完成&quot;, // 腾讯手机状态
&quot;mobile_housekeeper_name&quot;: &quot;&quot;, // 腾讯手机管家内容
&quot;mobile_housekeeper_times&quot;: &quot;&quot;, // 腾讯手机管家次数
&quot;mobile_housekeeper_show_name&quot;: &quot;&quot;, // 腾讯手机管家展示名称
&quot;security_guard_status&quot;: &quot;查询完成&quot;, // 360 状态
&quot;security_guard_name&quot;: &quot;&quot;, // 360 搜索标记内容
&quot;security_guard_times&quot;: &quot;&quot;, // 360 搜索标记次数
&quot;security_guard_show_name&quot;: &quot;&quot;, // 360 搜索展示名称
&quot;mobile_guard_status&quot;: &quot;查询完成&quot;, // 百度状态
&quot;mobile_guard_name&quot;: &quot;&quot;, // 百度搜索标记内容
&quot;mobile_guard_times&quot;: &quot;&quot;, // 百度搜索标记次数
&quot;mobile_guard_show_name&quot;: &quot;&quot;, // 百度搜索展示名称
&quot;telephone_bond_status&quot;: &quot;查询完成&quot;, // 电话邦状态
&quot;telephone_bond_name&quot;: &quot;&quot;, // 电话邦标记内容
&quot;telephone_bond_times&quot;: &quot;&quot;, // 电话邦标记次数
&quot;telephone_bond_show_name&quot;: &quot;&quot;, // 电话邦展示名称
&quot;mi_name&quot;: &quot;&quot;, // 小米标记内容
&quot;mi_times&quot;: &quot;&quot;, // 小米标记次数
&quot;mi_show_name&quot;: &quot;&quot;, // 小米展示名称
&quot;other_name&quot;: &quot;&quot;, // OV 手机标记类型
&quot;other_times&quot;: &quot;&quot;, // OV 手机标记次数
&quot;other_show_name&quot;: &quot;&quot; // OV 手机展示名称
}</code></pre>
<h4>请求格式</h4>
<ul>
<li>application/json</li>
</ul>
<h4>签名验证</h4>
<p>为了防止推送过程中数据被篡改,聚美智数将推送数据进行签名,将签名和数据一并推送,具体步骤如下:</p>
<p>1、在推送数据前拼接appSecret,对拼接后的数据做SHA256哈希,得到sign</p>
<pre><code class="language-java">sign = sha256(appSecret + 推送数据)</code></pre>
<p>例如:
appSecret:312aadadas3123ddadas
推送数据: {"phone": "13926252622",...}
则拼接后数据为:312aadadas3123ddadas{"phone": "13926252622",...}
再将拼接后的数据进行SHA256哈希,得到sign:trtret31212aa2312312dadas3123ddadas</p>
<p>2、sign放置在请求header中推送至接入商,header name=sign
3、接入商接收到推送数据后,根据步骤1生成sign,与header中的sign进行比较是否一致,一致说明数据没有被篡改</p>
<h4>返回接收结果</h4>
<ul>
<li>接入者需要返回接收处理结果返回给聚美智数</li>
<li>如果是接收失败,聚美智能会再次推送,最多推送10次。推送失败10次,推送自动关闭,不在推送。</li>
</ul>
<pre><code class="language-json">//接收成功
{
&quot;success&quot;:true
}
// 接收失败
{
&quot;success&quot;:false,
&quot;msg&quot;: &quot;接收失败&quot;
} </code></pre>
<h4>接收示例(java)</h4>
<pre><code class="language-java">@PostMapping(&quot;callbackUrl&quot;)
public Map&lt;String,Object&gt; receive(@RequestBody String data, HttpServletRequest request) {
log.info(&quot;接收到号码标记推送数据: {}&quot;, data);
String signInHeader = request.getHeader(&quot;sign&quot;);
String signText = appSecret + data;
String sign = DigestUtils.sha256Hex(signText);
log.info(&quot;sign: {}&quot;, sign);
log.info(&quot;signInHeader: {}&quot;, signInHeader);
Map&lt;String,Object&gt; map = new HashMap&lt;&gt;();
if (StringUtils.equals(sign, signInHeader)) {
... // 处理自己的业务逻辑
if (处理成功) {
map.put(&quot;success&quot;,true);
} else {
map.put(&quot;success&quot;,false);
map.put(&quot;msg&quot;,&quot;接收失败, xxx&quot;);
}
} else {
map.put(&quot;success&quot;,false);
map.put(&quot;msg&quot;,&quot;接收失败,签名不正确&quot;);
}
return map;
}</code></pre>