/data/transform/cal

1.接口描述

该API的功能对日期农历公历进行转换

请求方式:

POST

请求URL:

https://cloudapi.deepfinch.com/data/transform/cal

调试工具

Debugging Tool

2.请求参数

2.1 请求头域

字段 类型 必需 描述
X-DF-API-ID string API调用凭证信息,详细信息请参考API调用
X-DF-API-SECRET string API调用凭证信息,详细信息请参考API调用

2.2 请求体

字段 类型 必需 描述
year string
month string
day string
is_leap_month boolean 是否为闰月,convertl2g时生效
convert string 转换关系:见2.2.1转换关系说明,默认值l2g
2.2.1 转换关系说明
参数 说明
l2g 农历转公历
g2l 公历转农历

3.返回参数

正常响应 (200

字段 类型 描述
request_id string 本次请求的 id
status string 状态。正常为 OK ,其他值表示失败。详见详见错误码
result object 查询结果

其中result的字段如下:

农历转公历
字段 类型 描述
year int 公历年
month int 公历月
day int 公历日
date string 公历日期,格式 YYYY-MM-DD
公历转农历
字段 类型 描述
lunar_year int 农历年
lunar_month int 农历月,闰月也返回正数月份
lunar_day int 农历日
is_leap_month boolean 是否为闰月
year_in_chinese string 中文农历年
month_in_chinese string 中文农历月
day_in_chinese string 中文农历日
ganzhi_year string 年干支
zodiac string 生肖

输出示例:

{
  "request_id": "TIDc528326e240c47a583b0b661fcf8423a",
  "status": "OK",
  "result": {
    "lunar_year": 2025,
    "lunar_month": 11,
    "lunar_day": 21,
    "is_leap_month": false,
    "year_in_chinese": "二〇二五",
    "month_in_chinese": "冬",
    "day_in_chinese": "廿一",
    "ganzhi_year": "乙巳",
    "zodiac": "蛇"
  }
}

4.错误码

状态码 status 字段 说明
400 INVALID_ARGUMENT 请求参数错误
401 UNAUTHORIZED 未授权或授权失败
403 RATE_LIMIT_EXCEEDED 调用频率超出限额
404 NOT_FOUND 请求路径错误
500 INTERNAL_ERROR 服务器内部错误

输出示例:

{
  "status": "RATE_LIMIT_EXCEEDED",
  "request_id": "TID8bf47ab6eda64476973cc5f5b6ebf57e"
}

5.输入示例

results matching ""

    No results matching ""