POST

工作日历查询

查询指定年份或月份中每一天是否为工作日、节假日(含调休)

接口路径 /open/v1/workday

完整调用地址请登录控制台,在「我的密钥」页查看。

请求说明

查询指定年份、月份或单日的工作日/节假日信息。需先在管理后台录入该年国务院放假通知。

扣费:1 点/次。

调用地址:请登录控制台,在「我的密钥」页查看完整 API 调用地址。公开文档仅展示接口路径 /open/v1/{slug}。示例中的 <调用地址> 请替换为控制台中的实际地址。

请求体 (JSON)

参数类型必填说明
yearinteger年份,如 2026;与 date 二选一
monthinteger月份 1-12,与 year 配合使用
datestring单日,格式 YYYY-MM-DD;与 year 二选一

dayType 说明

  • workday — 普通工作日
  • holiday — 法定节假日放假
  • adjusted_workday — 调休上班(周末需上班)

holidayType 枚举

  • new_year — 元旦
  • spring_festival — 春节
  • qingming — 清明节
  • labor_day — 劳动节
  • dragon_boat — 端午节
  • mid_autumn — 中秋节
  • national_day — 国庆节

days[] 元素字段

  • date — 日期 YYYY-MM-DD
  • weekdayName — 中文星期
  • isWorkday — 是否工作日
  • dayType — 日类型
  • holidayType — 节假日类型
  • holidayName — 节假日名称

响应字段

字段类型说明
daysCalendarDay[]日历明细列表
countinteger返回天数
yearinteger按年查询时返回
monthinteger按月查询时返回
datestring按日查询时返回

调用示例

curl -X POST -H "Content-Type: application/json" -H "X-API-Key: sk-your-key" -d '{"year":2026,"month":1}' "<调用地址>/workday"
package main

import (
    "bytes"
    "fmt"
    "io"
    "net/http"
)

func main() {
    req, _ := http.NewRequest(http.MethodPost, "<调用地址>/workday", bytes.NewBufferString(`{"year":2026,"month":1}`))
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("X-API-Key", "sk-your-key")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
<?php
$ch = curl_init('<调用地址>/workday');
curl_setopt_array($ch, [
    CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'X-API-Key: sk-your-key'],
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => '{"year":2026,"month":1}',
    CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("<调用地址>/workday"))
    .header("Content-Type", "application/json")
    .header("X-API-Key", "sk-your-key")
    .POST(HttpRequest.BodyPublishers.ofString("{"year":2026,"month":1}"))
    .build();

HttpResponse<String> response = client.send(
    request,
    HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
const response = await fetch('<调用地址>/workday', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'sk-your-key',
  },
  body: JSON.stringify({"year":2026,"month":1}),
});

const data = await response.json();
console.log(data);

响应示例

{
  "year": 2026,
  "month": 1,
  "count": 31,
  "days": [
    {
      "date": "2026-01-01",
      "weekdayName": "星期四",
      "isWorkday": false,
      "dayType": "holiday",
      "holidayType": "new_year",
      "holidayName": "元旦"
    }
  ]
}

补充说明

  • year 与 date 至少提供一个;仅 date 时可不依赖节假日年度配置。
  • 响应头 Cache-Control: public, max-age=3600。