API 文档
-
接口地址:
https://apicx.asia/api/holiday
-
返回格式:
JOSN
-
请求方式:
GET
-
请求示例:
https://apicx.asia/api/holiday?action=year&year=2026
请求参数说明:
| 名称 |
必填 |
类型 |
说明 |
|
token
|
是
|
string
|
登录获取token
|
| action | 是 | string | 接口类型标识:year(全年节假日查询)/lunar2solar(农历转阳历)/solar2lunar(阳历转农历);第4个接口无需传此参数 |
| year | 是 | int | 仅action=year时必传,要查询的年份(如2026) |
| lunar_year | 是 | int | 仅action=lunar2solar时必传,农历年(如2026) |
| lunar_month | 是 | int | 仅action=lunar2solar时必传,农历月(如1) |
| lunar_day | 是 | int | 仅action=lunar2solar时必传,农历日(如1) |
| date | 是 | string | action=solar2lunar时:阳历日期(格式YYYY-MM-DD,如2026-02-17);第4个接口时:任意值(会被lunar参数覆盖) |
| lunar | 是 | string | 仅第4个接口必传,农历日期(格式YYYY-MM-DD,如2026-01-01),优先级高于date |
返回参数说明:
| 名称 |
类型 |
说明 |
| code |
integer |
返回的状态码 |
| data |
object |
返回的数据/数据对象 |
| msg |
string |
返回的消息 |
| time |
string |
请求时间 |
| data.query_year | number | query_year |
| data.holiday_count | number | holiday_count |
| data.holidays[].date | string | date |
| data.holidays[].name | string | name |
| data.holidays[].type | string | type |
| data.holidays[].type_cn | string | type_cn |
| data.holidays[].off | boolean | off |
| data.holidays[].off_cn | string | off_cn |
| data.holidays[].lunar | boolean | lunar |
| data.holidays[].lunar_date | string | lunar_date |
{
"code": 200,
"msg": "操作成功!",
"time": "2026-02-13 10:17:05",
"api_source": "API官网:apicx.asia",
"data": {
"query_year": 2026,
"holiday_count": 32,
"holidays": [
{
"date": "2026-01-01",
"name": "元旦",
"type": "legal",
"type_cn": "法定节假日",
"off": true,
"off_cn": "是",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-02-14",
"name": "情人节",
"type": "custom",
"type_cn": "自定义节日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-02-16",
"name": "除夕",
"type": "legal",
"type_cn": "法定节假日",
"off": true,
"off_cn": "是",
"lunar": true,
"lunar_date": "腊月三十"
},
{
"date": "2026-02-17",
"name": "春节",
"type": "legal",
"type_cn": "法定节假日",
"off": true,
"off_cn": "是",
"lunar": true,
"lunar_date": "正月初一"
},
{
"date": "2026-03-03",
"name": "元宵节",
"type": "traditional",
"type_cn": "传统节日",
"off": false,
"off_cn": "否",
"lunar": true,
"lunar_date": "正月十五"
},
{
"date": "2026-03-08",
"name": "妇女节",
"type": "legal",
"type_cn": "法定节假日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-03-12",
"name": "植树节",
"type": "custom",
"type_cn": "自定义节日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-03-15",
"name": "消费者权益日",
"type": "custom",
"type_cn": "自定义节日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-03-20",
"name": "龙抬头",
"type": "traditional",
"type_cn": "传统节日",
"off": false,
"off_cn": "否",
"lunar": true,
"lunar_date": "二月初二"
},
{
"date": "2026-04-01",
"name": "愚人节",
"type": "custom",
"type_cn": "自定义节日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-04-05",
"name": "清明节",
"type": "legal",
"type_cn": "法定节假日",
"off": true,
"off_cn": "是",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-05-01",
"name": "劳动节",
"type": "legal",
"type_cn": "法定节假日",
"off": true,
"off_cn": "是",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-05-04",
"name": "青年节",
"type": "legal",
"type_cn": "法定节假日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-05-10",
"name": "母亲节",
"type": "custom",
"type_cn": "自定义节日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-06-01",
"name": "儿童节",
"type": "legal",
"type_cn": "法定节假日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-06-19",
"name": "端午节",
"type": "legal",
"type_cn": "法定节假日",
"off": true,
"off_cn": "是",
"lunar": true,
"lunar_date": "五月初五"
},
{
"date": "2026-06-21",
"name": "父亲节",
"type": "custom",
"type_cn": "自定义节日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-07-01",
"name": "建党节",
"type": "legal",
"type_cn": "法定节假日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-08-01",
"name": "建军节",
"type": "legal",
"type_cn": "法定节假日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-08-19",
"name": "七夕节",
"type": "traditional",
"type_cn": "传统节日",
"off": false,
"off_cn": "否",
"lunar": true,
"lunar_date": "七月初七"
},
{
"date": "2026-08-27",
"name": "中元节",
"type": "traditional",
"type_cn": "传统节日",
"off": false,
"off_cn": "否",
"lunar": true,
"lunar_date": "七月十五"
},
{
"date": "2026-09-10",
"name": "教师节",
"type": "legal",
"type_cn": "法定节假日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-09-25",
"name": "中秋节",
"type": "legal",
"type_cn": "法定节假日",
"off": true,
"off_cn": "是",
"lunar": true,
"lunar_date": "八月十五"
},
{
"date": "2026-10-01",
"name": "国庆节",
"type": "legal",
"type_cn": "法定节假日",
"off": true,
"off_cn": "是",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-10-18",
"name": "重阳节",
"type": "traditional",
"type_cn": "传统节日",
"off": false,
"off_cn": "否",
"lunar": true,
"lunar_date": "九月初九"
},
{
"date": "2026-11-11",
"name": "光棍节",
"type": "custom",
"type_cn": "自定义节日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-11-26",
"name": "感恩节",
"type": "custom",
"type_cn": "自定义节日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-12-24",
"name": "平安夜",
"type": "custom",
"type_cn": "自定义节日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2026-12-25",
"name": "圣诞节",
"type": "custom",
"type_cn": "自定义节日",
"off": false,
"off_cn": "否",
"lunar": false,
"lunar_date": ""
},
{
"date": "2027-01-15",
"name": "腊八节",
"type": "traditional",
"type_cn": "传统节日",
"off": false,
"off_cn": "否",
"lunar": true,
"lunar_date": "腊月初八"
},
{
"date": "2027-01-30",
"name": "小年(北方)",
"type": "traditional",
"type_cn": "传统节日",
"off": false,
"off_cn": "否",
"lunar": true,
"lunar_date": "腊月廿三"
},
{
"date": "2027-01-31",
"name": "小年(南方)",
"type": "traditional",
"type_cn": "传统节日",
"off": false,
"off_cn": "否",
"lunar": true,
"lunar_date": "腊月廿四"
}
]
},
"cached_time": "2026-02-13 10:17:05"
}
错误码格式说明:
| 名称 |
类型 |
说明 |
| 200 |
string |
返回状态码(成功) |
| 500 |
string |
返回的状态码(失败) |
代码示例:
-
-
-
-
-
-
-
<?php
// 初始化cURL会话
$ch = curl_init();
// 设置请求URL,用户中心获取token,自行替换其他参数
curl_setopt($ch, CURLOPT_URL, "https://apicx.asia/api/holiday?action=year&year=2026");
// 设置请求头
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: YOUR_TOKEN'
));
// 返回响应而不是直接输出
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// 执行请求并获取响应
$response = curl_exec($ch);
// 关闭cURL会话
curl_close($ch);
// 将响应解析为JSON格式
$data = json_decode($response, true);
// 输出JSON数据
print_r($data);
?>
import requests
# 设置请求URL和头部,用户中心获取token,自行替换其他参数
url = "https://apicx.asia/api/holiday?action=year&year=2026"
headers = {
'Authorization': 'YOUR_TOKEN'
}
# 发送GET请求
response = requests.get(url, headers=headers)
# 将响应解析为JSON格式
data = response.json()
# 输出JSON数据
print(data)
// 发送GET请求,用户中心获取token,自行替换其他参数
fetch("https://apicx.asia/api/holiday?action=year&year=2026", {
method: "GET",
headers: {
"Authorization": "YOUR_TOKEN"
}
})
.then(response => response.json()) // 将响应解析为JSON格式
.then(data => console.log(data)) // 输出JSON数据
.catch(error => console.error('Error:', error));
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) throws Exception {
// 创建URL对象,用户中心获取token,自行替换其他参数
URL url = new URL("https://apicx.asia/api/holiday?action=year&year=2026");
// 打开连接
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
// 设置请求方法
conn.setRequestMethod("GET");
// 设置请求头
conn.setRequestProperty("Authorization", "YOUR_TOKEN");
// 读取响应
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuffer content = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
// 输出JSON数据
System.out.println(content.toString());
}
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program {
static async Task Main() {
using (HttpClient client = new HttpClient()) {
// 设置请求头
client.DefaultRequestHeaders.Add("Authorization", "YOUR_TOKEN");
// 发送GET请求,用户中心获取token,自行替换其他参数
HttpResponseMessage response = await client.GetAsync("https://apicx.asia/api/holiday?action=year&year=2026");
// 将响应解析为字符串
string responseBody = await response.Content.ReadAsStringAsync();
// 输出JSON数据
Console.WriteLine(responseBody);
}
}
}
require 'net/http'
require 'uri'
# 创建URI对象,用户中心获取token,自行替换其他参数
uri = URI.parse("https://apicx.asia/api/holiday?action=year&year=2026")
# 创建GET请求
request = Net::HTTP::Get.new(uri)
# 设置请求头
request["Authorization"] = "YOUR_TOKEN"
# 发送请求并获取响应
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
# 输出JSON数据
puts response.body
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
client := &http.Client{}
// 创建GET请求,用户中心获取token,自行替换其他参数
req, err := http.NewRequest("GET", "https://apicx.asia/api/holiday?action=year&year=2026", nil)
if err != nil {
panic(err)
}
// 设置请求头
req.Header.Add("Authorization", "YOUR_TOKEN")
// 发送请求并获取响应
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
// 读取响应体
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
// 输出JSON数据
fmt.Println(string(body))
}