日出日落

获取未来60天全球任意地点日出日落时间。

逐天预报API中,也会返回对应天数的日出日落、月升月落和月相数据

请求路径#

GET /v7/astronomy/sun

参数#

查询参数

  • location (必选) 需要查询地区的LocationID或以英文逗号分隔的经度,纬度坐标(十进制,最多支持小数点后两位),LocationID可通过GeoAPI获取。例如 location=101010100location=116.41,39.92
  • date (必选) 选择日期,最多可选择未来60天(包含今天)的数据。日期格式为yyyyMMdd,例如 date=20200531

请求示例#

curl -X GET --compressed \
-H 'Authorization: Bearer your_token' \
'https://your-api-host/v7/astronomy/sun?location=116.41%2C39.92&date=20200531'

请将your_token替换为你的JWT身份认证,将your_api_host替换为你的API Host

试一下

返回数据#

{
  "code": "200",
  "updateTime": "2021-02-17T11:00+08:00",
  "fxLink": "https://www.qweather.com",
  "sunrise": "2021-02-20T06:58+08:00",
  "sunset": "2021-02-20T17:57+08:00",
  "refer": {
    "sources": [
      "https://developer.qweather.com/attribution.html"
    ],
    "license": [
      "QWeather Developers License"
    ]
  }
}
  • code string 状态码
  • updateTime date-time API的最近更新时间
  • fxLink uri 当前数据的响应式页面,便于嵌入网站或应用
  • sunrise string 日出时间,在高纬度地区可能为空
  • sunset string 日落时间,在高纬度地区可能为空
  • refer object 数据来源和许可信息
    • sources array 原始数据来源,或数据源说明,可能为空
    • license array 数据许可或版权声明,可能为空