月升月落和月相

平台: API iOS Android

获取未来60天全球城市月升月落和逐小时的月相数据。

月相已考虑南北半球的差异,不需要再进行转换

请求URL

https://api.qweather.com/v7/astronomy/moon

如果是免费订阅,将上述API Host更改为devapi.qweather.com。参考免费订阅可用的数据

请求参数

请求参数包括必选和可选参数,参数之间使用&进行分隔。

  • location(必选)需要查询地区的LocationID或以英文逗号分隔的经度,纬度坐标(十进制,最多支持小数点后两位),LocationID可通过GeoAPI获取。例如 location=101010100location=116.41,39.92
  • date(必选)选择日期,最多可选择未来60天(包含今天)的数据。日期格式为yyyyMMdd,例如 date=20200531
  • lang多语言设置,请阅读多语言文档,了解我们的多语言是如何工作、如何设置以及数据是否支持多语言。

请求示例

curl -X GET --compressed \
-H 'Authorization: Bearer your_token' \
'https://api.qweather.com/v7/astronomy/moon?location=101010100&date=20211120'

请将your_token替换为你的JWT或了解身份认证

返回数据

返回数据是JSON格式并进行了Gzip压缩

{
  "code": "200",
  "updateTime": "2021-11-15T17:00+08:00",
  "fxLink": "http://hfx.link/2ax1",
  "moonrise": "2021-11-20T17:25+08:00",
  "moonset": "2021-11-21T07:42+08:00",
  "moonPhase": [
    {
      "fxTime": "2021-11-20T00:00+08:00",
      "value": "0.51",
      "name": "亏凸月",
      "illumination": "100",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T01:00+08:00",
      "value": "0.51",
      "name": "亏凸月",
      "illumination": "100",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T02:00+08:00",
      "value": "0.51",
      "name": "亏凸月",
      "illumination": "100",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T03:00+08:00",
      "value": "0.51",
      "name": "亏凸月",
      "illumination": "100",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T04:00+08:00",
      "value": "0.52",
      "name": "亏凸月",
      "illumination": "100",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T05:00+08:00",
      "value": "0.52",
      "name": "亏凸月",
      "illumination": "100",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T06:00+08:00",
      "value": "0.52",
      "name": "亏凸月",
      "illumination": "100",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T07:00+08:00",
      "value": "0.52",
      "name": "亏凸月",
      "illumination": "100",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T08:00+08:00",
      "value": "0.52",
      "name": "亏凸月",
      "illumination": "100",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T09:00+08:00",
      "value": "0.52",
      "name": "亏凸月",
      "illumination": "100",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T10:00+08:00",
      "value": "0.52",
      "name": "亏凸月",
      "illumination": "99",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T11:00+08:00",
      "value": "0.52",
      "name": "亏凸月",
      "illumination": "99",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T12:00+08:00",
      "value": "0.53",
      "name": "亏凸月",
      "illumination": "99",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T13:00+08:00",
      "value": "0.53",
      "name": "亏凸月",
      "illumination": "99",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T14:00+08:00",
      "value": "0.53",
      "name": "亏凸月",
      "illumination": "99",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T15:00+08:00",
      "value": "0.53",
      "name": "亏凸月",
      "illumination": "99",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T16:00+08:00",
      "value": "0.53",
      "name": "亏凸月",
      "illumination": "99",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T17:00+08:00",
      "value": "0.53",
      "name": "亏凸月",
      "illumination": "99",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T18:00+08:00",
      "value": "0.53",
      "name": "亏凸月",
      "illumination": "99",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T19:00+08:00",
      "value": "0.53",
      "name": "亏凸月",
      "illumination": "99",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T20:00+08:00",
      "value": "0.54",
      "name": "亏凸月",
      "illumination": "99",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T21:00+08:00",
      "value": "0.54",
      "name": "亏凸月",
      "illumination": "99",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T22:00+08:00",
      "value": "0.54",
      "name": "亏凸月",
      "illumination": "99",
      "icon": "805"
    },
    {
      "fxTime": "2021-11-20T23:00+08:00",
      "value": "0.54",
      "name": "亏凸月",
      "illumination": "98",
      "icon": "805"
    }
  ],
  "refer": {
    "sources": [
      "QWeather"
    ],
    "license": [
      "QWeather Developers License"
    ]
  }
}
  • code 请参考状态码
  • updateTime 当前API的最近更新时间
  • fxLink 当前数据的响应式页面,便于嵌入网站或应用
  • moonrise 当天月升时间可能为空
  • moonset 当天月落时间可能为空
  • moonPhase.fxTime 月相逐小时预报时间
  • moonPhase.value 月相数值
  • moonPhase.name 月相名称
  • moonPhase.icon 月相图标代码,另请参考天气图标项目
  • moonPhase.illumination 月亮照明度,百分比数值
  • refer.sources 原始数据来源,或数据源说明,可能为空
  • refer.license 数据许可或版权声明,可能为空