天气指数预报
请求路径#
GET /v7/indices/{days}参数#
路径参数
-
days 必选string预报天数,支持最多3天预报,可选值:
1d、3d
查询参数
-
type 必选string
-
location 必选string需要查询地区的LocationID或以英文逗号分隔的经度,纬度坐标(十进制,最多支持小数点后两位),LocationID可通过GeoAPI获取。例如
location=101010100或location=116.41,39.92 -
langstring
请求示例#
curl -X GET --compressed \
-H 'Authorization: Bearer your_token' \
'https://your-api-host/v7/indices/1d?type=1&location=116.41%2C39.92'
请将your_token替换为你的JWT身份认证,将your_api_host替换为你的API Host
返回数据#
{
"code": "200",
"updateTime": "2021-12-16T18:35+08:00",
"fxLink": "https://www.qweather.com/indices/chaoyang-101010300.html",
"daily": [
{
"date": "2021-12-16",
"type": "1",
"name": "运动指数",
"level": "3",
"category": "较不宜",
"text": "天气较好,但考虑天气寒冷,风力较强,推荐您进行室内运动,若户外运动请注意保暖并做好准备活动。"
},
{
"date": "2021-12-16",
"type": "2",
"name": "洗车指数",
"level": "3",
"category": "较不宜",
"text": "较不宜洗车,未来一天无雨,风力较大,如果执意擦洗汽车,要做好蒙上污垢的心理准备。"
}
],
"refer": {
"sources": [
"https://developer.qweather.com/attribution.html"
],
"license": [
"QWeather Developers License"
]
}
}
-
codestring
-
updateTimedate-time
-
fxLinkuri当前数据的响应式页面,便于嵌入网站或应用
-
dailyarray每日预报数据列表
-
datedate预报日期
-
typestring生活指数类型ID
-
namestring生活指数类型的名称
-
levelstring生活指数预报等级
-
categorystring生活指数预报级别名称
-
textstring生活指数预报的详细描述,可能为空
-
-
referobject数据来源和许可信息
-
sourcesarray原始数据来源,或数据源说明,可能为空
-
licensearray数据许可或版权声明,可能为空
-