健康知识
<p>[TOC]</p>
<h3>1 接口调用说明</h3>
<p>健康知识查询</p>
<h4>1.1 请求方式</h4>
<p>如接口没有单独说明,所有接口均为:<strong>POST</strong></p>
<h4>1.2 请求格式</h4>
<p>如接口没有单独说明,所有接口均为:<strong>application/x-www-form-urlencoded</strong></p>
<h4>1.3 请求参数</h4>
<p>请求参数包括公共参数和业务参数(业务参数见具体接口说明)
调用接口时,需要把<strong>公共参数</strong>和<strong>业务参数</strong>一并放在<strong>请求参数</strong>中提交</p>
<h5>1.3.1 公共请求参数</h5>
<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>签名,详见<a href="#签名算法">签名算法说明</a></td>
</tr>
</tbody>
</table>
<p><a name="签名算法"></a></p>
<h5>1.3.2 签名算法说明</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 = &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>1.4 返回说明</h4>
<h5>1.4.1 公共返回字段说明</h5>
<p>所有接口均返回以下公共字段:</p>
<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>
<p><a name="code返回码说明"></a></p>
<h5>1.4.2 code返回码说明</h5>
<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>2 分类列表</h3>
<h4>2.1 接口描述</h4>
<ul>
<li>用于查询健康知识类型</li>
</ul>
<h4>2.2 请求地址</h4>
<p><code>https://api.jumdata.com/health-know-ledge/type</code></p>
<h4>2.3 业务参数</h4>
<p>无</p>
<h4>2.4 成功返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 200,
&quot;msg&quot;: &quot;成功&quot;,
&quot;taskNo&quot;: &quot;526782409178028989145499&quot;,
&quot;charge&quot;: true, //计费标识
&quot;data&quot;: {
&quot;totalCount&quot;: 12,
&quot;items&quot;: [
{
&quot;name&quot;: &quot;慢病预防&quot;,//名称
&quot;id&quot;: 112//id
}
]
}
}</code></pre>
<h4>2.6 失败返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 404,
&quot;msg&quot;: &quot;接口地址不正确&quot;,
&quot;taskNo&quot;: &quot;487974114181909820820522&quot;,
&quot;charge&quot;: false
}</code></pre>
<hr />
<h3>3 搜索健康知识</h3>
<h4>3.1 接口描述</h4>
<ul>
<li>根据关键字查询健康知识数据</li>
</ul>
<h4>3.2 请求地址</h4>
<p><code>https://api.jumdata.com/health-know-ledge/query</code></p>
<h4>3.3 业务参数</h4>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必须</th>
<th><div style="width:420px;">说明</div></th>
</tr>
</thead>
<tbody>
<tr>
<td>typeId</td>
<td>String</td>
<td>否</td>
<td>类型id</td>
</tr>
<tr>
<td>keyword</td>
<td>String</td>
<td>否</td>
<td>关键字</td>
</tr>
<tr>
<td>pageNo</td>
<td>Number</td>
<td>否</td>
<td>页数,默认1,每页最多20条</td>
</tr>
</tbody>
</table>
<h4>3.4 成功返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 200,
&quot;msg&quot;: &quot;成功&quot;,
&quot;taskNo&quot;: &quot;526782409178028989145499&quot;,
&quot;charge&quot;: true, //计费标识
&quot;data&quot;: {
&quot;page&quot;: 1,//当前页
&quot;pageSize&quot;: 20,//每页条数
&quot;totalPage&quot;: 37,//总页数
&quot;totalCount&quot;: 730,//总条数
&quot;items&quot;: [
{
&quot;id&quot;: &quot;65ffa68a9d9f1b1c295d6e3d&quot;,//id
&quot;tid&quot;: &quot;110&quot;,//分类id
&quot;tname&quot;: &quot;疾病&quot;,//分类类目
&quot;title&quot;: &quot;男女学生断崖式身高差?做到这“三好”,不愁个头长不高&quot;,//标题
&quot;url&quot;: &quot;https://www.sohu.com/a/766435294_121014589&quot;,//地址
&quot;keywords&quot;: &quot;睡眠,家长,个头,断崖,男生,营养,女生,心情,身高,男孩子,男女生&quot;,//关键字
&quot;wapurl&quot;: &quot;https://www.sohu.com/a/766435294_121014589&quot;,//知识的url地址
&quot;intro&quot;: &quot;男女学生断崖式身高差?做到这“三好”,不愁个头长不高&quot;,//知识简介
&quot;ctime&quot;: &quot;2024-03-24 12:02:03&quot;,//创建时间
&quot;media_name&quot;: &quot;情感七席&quot;//媒体名称
}
]
}
}</code></pre>
<h4>3.6 失败返回样例</h4>
<pre><code class="language-json">{
&quot;msg&quot;: &quot;参数错误&quot;,
&quot;code&quot;: 400,
&quot;charge&quot;: false
}</code></pre>
<h3>4 查看单条知识详情</h3>
<h4>4.1 接口描述</h4>
<ul>
<li>查询健康知识详细信息</li>
</ul>
<h4>4.2 请求地址</h4>
<p><code>https://api.jumdata.com/health-know-ledge/detail</code></p>
<h4>4.3 业务参数</h4>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必须</th>
<th><div style="width:420px;">说明</div></th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>String</td>
<td>是</td>
<td>知识id</td>
</tr>
</tbody>
</table>
<h4>4.4 成功返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 200,
&quot;msg&quot;: &quot;成功&quot;,
&quot;taskNo&quot;: &quot;526782409178028989145499&quot;,
&quot;charge&quot;: true, //计费标识
&quot;data&quot;: {
&quot;id&quot;: &quot;65ffa68a9d9f1b1c295d6e3d&quot;,//id
&quot;tid&quot;: &quot;110&quot;,//分类id
&quot;tname&quot;: &quot;疾病&quot;,//分类类目
&quot;title&quot;: &quot;男女学生断崖式身高差?做到这“三好”,不愁个头长不高&quot;,//标题
&quot;stitle&quot;: &quot;副标题&quot;,
&quot;summary&quot;: &quot;摘要&quot;,
&quot;url&quot;: &quot;https://www.sohu.com/a/766435294_121014589&quot;,//地址
&quot;keywords&quot;: &quot;睡眠,家长,个头,断崖,男生,营养,女生,心情,身高,男孩子,男女生&quot;,//关键字
&quot;wapurl&quot;: &quot;https://www.sohu.com/a/766435294_121014589&quot;,//知识的url地址
&quot;intro&quot;: &quot;男女学生断崖式身高差?做到这“三好”,不愁个头长不高&quot;,//知识简介
&quot;ctime&quot;: &quot;2024-03-24 12:02:03&quot;,//创建时间
&quot;media_name&quot;: &quot;情感七席&quot;,//媒体名称
&quot;content&quot;: &quot;情感七席&quot;,//内容摘要。详细内容需要到原网址查看。
&quot;img&quot;: &quot;https://www.sohu.com/a/766435294_121014589&quot;,//图片(或图片列表)
&quot;media_name&quot;: &quot;情感七席&quot;//媒体名称
}
}</code></pre>
<h4>4.5 失败返回样例</h4>
<pre><code class="language-json">{
&quot;msg&quot;: &quot;id不能为空&quot;,
&quot;code&quot;: 400,
&quot;charge&quot;: false
}</code></pre>