Sunrise and Sunset
Get the sunrise and sunset times for the next 60 days at any location worldwide.
Endpoint
/v7/astronomy/sun
Parameters
Query parameters
-
location
(required)The location to be queried, support LocationID or comma-separated longitude and latitude (decimal, up to 2 decimal places), LocationID can be obtained by GeoAPI. Example:location=101010100
orlocation=116.41,39.92
-
date
(required)Set the date, up to 60 days in the future (including today). The date format is yyyyMMdd. Example:date=20200531
Request example
curl -X GET --compressed \
-H 'Authorization: Bearer your_token' \
'https://your_api_host/v7/astronomy/sun?location=101010100&date=20210220'
Replace your_token
and your_api_host
with your JWT Authentication and API Host
Response
The response is in JSON format and is Gzip compressed.
{
"code": "200",
"updateTime": "2021-02-17T11:00+08:00",
"fxLink": "http://hfx.link/2ax1",
"sunrise": "2021-02-20T06:58+08:00",
"sunset": "2021-02-20T17:57+08:00",
"refer": {
"sources": [
"QWeather"
],
"license": [
"QWeather Developers License"
]
}
}
-
code
See Status Code -
updateTime
API last update time -
fxLink
Responsive web page of this data, for embedded in website or APP -
sunrise
Sunrise time. Maybe null in high latitude area -
sunset
Sunset time. Maybe null in high latitude area -
refer.sources
Data source and other statements, may be null -
refer.license
Data license, may be null