聚美智数


节假日查询

<p>[TOC]</p> <h3>1 简介</h3> <ul> <li>查询一年中的节假日、调休日期</li> <li>查询每个日期的对应的国际日和我国传统节日的简介</li> <li>广泛使用于日程安排、证券投资、日历等功能的应用中展示</li> </ul> <h3>2 接口调用说明</h3> <h4>2.1 请求方式</h4> <p>如接口没有单独说明,所有接口均为:<strong>POST</strong></p> <h4>2.2 请求格式</h4> <p>如接口没有单独说明,所有接口均为:<strong>application/x-www-form-urlencoded</strong></p> <h4>2.3 请求参数</h4> <p>请求参数包括公共参数和业务参数(业务参数见具体接口说明) 调用接口时,需要把<strong>公共参数</strong>和<strong>业务参数</strong>一并放在<strong>请求参数</strong>中提交</p> <h5>2.3.1 公共请求参数</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> <p>&lt;a name=&quot;签名算法&quot;&gt;&lt;/a&gt;</p> <h5>2.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 = &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>2.4 返回说明</h4> <h5>2.4.1 公共返回字段说明</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>2.4.2 code返回码说明</h5> <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>3 假日列表</h3> <h4>3.1 接口描述</h4> <ul> <li>根据年份查询节假日列表</li> </ul> <h4>3.2 请求地址</h4> <p><code>https://api.jumdata.com/holiday/list</code></p> <h4>3.3 业务参数</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>year</td> <td>String</td> <td>否</td> <td>需要查询的年份, 默认查询当年的节假日列表</td> </tr> </tbody> </table> <h4>3.4 成功返回样例</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;526782409178028989145499&amp;quot;, // 请求号 &amp;quot;charge&amp;quot;: true, // 计费标识 &amp;quot;data&amp;quot;: { &amp;quot;count&amp;quot;: 12, // 一年的节假日数量 &amp;quot;items&amp;quot;: [ // 一年的节假日列表 { &amp;quot;begin&amp;quot;: &amp;quot;20181230&amp;quot;, // 节假日的开始时间 &amp;quot;end&amp;quot;: &amp;quot;20190101&amp;quot;, // 节假日的结束时间 &amp;quot;holiday&amp;quot;: &amp;quot;元旦&amp;quot;, // 节假日名称 &amp;quot;holiday_remark&amp;quot;: &amp;quot;放假3天,其中2018年12月30日至2019年1月1日放假调休,2018年12月29日(周六)正常上班&amp;quot;, // 节假日描述 &amp;quot;inverse_days&amp;quot;: [ // 调修日列表,只有2021年之后的数据有值 &amp;quot;20181229&amp;quot; ] } ] } }</code></pre> <h4>3.5 失败返回样例</h4> <pre><code class="language-json">{ &amp;quot;code&amp;quot;: 400, &amp;quot;msg&amp;quot;: &amp;quot;参数错误&amp;quot;, &amp;quot;charge&amp;quot;: false }</code></pre> <hr /> <h3>4 假日详细信息</h3> <h4>4.1 接口描述</h4> <ul> <li>根据日期查询是否为节假日,如是,返回节假日详细信息</li> </ul> <h4>4.2 请求地址</h4> <p><code>https://api.jumdata.com/holiday/detail</code></p> <h4>4.3 业务参数</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>date</td> <td>String</td> <td>否</td> <td>查询的日期,默认当天</td> </tr> <tr> <td>needDesc</td> <td>String</td> <td>否</td> <td>是否需要返回当日公众日、国际日和我国传统节日的简介,1-返回,默认不返回</td> </tr> </tbody> </table> <h4>4.4 成功返回样例</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;526782409178028989145499&amp;quot;, // 请求号 &amp;quot;charge&amp;quot;: true, // 计费标识 &amp;quot;data&amp;quot;: { &amp;quot;day&amp;quot;: &amp;quot;20210501&amp;quot;, // 查询的日期 &amp;quot;holiday&amp;quot;: &amp;quot;劳动节&amp;quot;, // 节日名称,工作日时显示“无”,周末时显示“周末”,节日时显示节日名称 &amp;quot;type&amp;quot;: &amp;quot;3&amp;quot;, // 1为工作日,2为周末,3为节假日 &amp;quot;begin&amp;quot;: &amp;quot;20210501&amp;quot;, // 节日或周末开始时间,如果是工作日,此字段为空串 &amp;quot;end&amp;quot;: &amp;quot;20210503&amp;quot;, // 节日或周末结束时间,如果是工作日,此字段为空串 &amp;quot;holiday_remark&amp;quot;: &amp;quot;5月1日—5月3日放假,共3天,5月8日(星期六)要上班。&amp;quot;, // 节日备注 &amp;quot;weekDay&amp;quot;: 6, // 星期几的数字 &amp;quot;cn&amp;quot;: &amp;quot;周六&amp;quot;, // 英期几的中文名 &amp;quot;en&amp;quot;: &amp;quot;Saturday&amp;quot;, // 星期几的英文名 &amp;quot;h&amp;quot;: [ // 如果当日没有节日则返回空List,该字段需要请求参数中needDesc上传1才返回 { &amp;quot;name&amp;quot;: &amp;quot;世界文化发展日&amp;quot;, // 节日名称 &amp;quot;genus&amp;quot;: &amp;quot;public&amp;quot;, // 节日种类,public表示公众日或国际日,traditional表示传统节日 &amp;quot;day&amp;quot;: &amp;quot;0521&amp;quot;, // 节日公历日期 &amp;quot;lunaDay&amp;quot;: &amp;quot;&amp;quot;, // 节日的农历日期 &amp;quot;info&amp;quot;: &amp;quot;&amp;quot;, // 节日的简介 &amp;quot;origin&amp;quot;: &amp;quot;&amp;quot; // 节日的起源 } ] } }</code></pre> <h4>4.5 失败返回样例</h4> <pre><code class="language-json">{ &amp;quot;msg&amp;quot;: &amp;quot;参数错误&amp;quot;, &amp;quot;code&amp;quot;: 400, &amp;quot;charge&amp;quot;: false }</code></pre>

页面列表

ITEM_HTML