url:https://weatherapi.market.xiaomi.com/wtr-v3/weather/all
拼接参数:
latitude
:纬度信息。可填固定值0
longitude
:经度信息。可填固定值0
locationKey
:weathercn:
+ 地区city_num
,见数据库中的city_num
字段,例:weathercn:101010100
表北京sign
:签名值,固定值zUFJoAR2ZVrDy1vF3D07
isGlobal
:固定值false
locale
:固定值zh_cn
days
:获取包括今日在内的几天内的数据。可不填,默认为5
romVersion
:可不填或者去除该参数appVersion
:可不填或者去除该参数alpha
:可不填或者去除该参数device
:可不填或者去除该参数modDevice
:可不填或者去除该参数
url 示例:https://weatherapi.market.xiaomi.com/wtr-v3/weather/all?latitude=110&longitude=112&isLocated=true&locationKey=weathercn%3A101010100&days=15&appKey=weather20151024&sign=zUFJoAR2ZVrDy1vF3D07&romVersion=7.2.16&appVersion=87&alpha=false&isGlobal=false&device=cancro&modDevice=&locale=zh_cn
或 https://weatherapi.market.xiaomi.com/wtr-v3/weather/all?latitude=110&longitude=112&locationKey=weathercn%3A101010100&days=15&appKey=weather20151024&sign=zUFJoAR2ZVrDy1vF3D07&isGlobal=false&locale=zh_cn
json 示例:
{
"current": {
"feelsLike": {
"unit": "℃",
"value": "22"
},
"humidity": {
"unit": "%",
"value": "56"
},
"pressure": {
"unit": "mb",
"value": "1010.4"
},
"pubTime": "2017-02-20T15:25:00+08:00",
"temperature": {
"unit": "℃",
"value": "21"
},
"uvIndex": "2",
"visibility": {
"unit": "km",
"value": ""
},
"weather": "0",
"wind": {
"direction": {
"unit": "°",
"value": "360"
},
"speed": {
"unit": "km/h",
"value": "3.0"
}
}
},
"forecastDaily": {
"aqi": {
"brandInfo": {
"brands": [
{
"brandId": "caiyun",
"logo": "http://f5.market.mi-img.com/download/MiSafe/0d2cde44e7d5b4a742b9846b8e5aaae62ebed7784/a.webp",
"names": {
"en_US": "彩云天气",
"zh_TW": "彩雲天氣",
"zh_CN": "彩云天气"
},
"url": ""
}
]
},
"pubTime": "2017-02-20T00:00:00+08:00",
"status": 0,
"value": [
130,
66,
27,
24,
45
]
},
"precipitationProbability": {
"status": 0,
"value": [
"8",
"25",
"73",
"58",
"6"
]
},
"pubTime": "2017-02-20T15:10:00+08:00",
"status": 0,
"sunRiseSet": {
"status": 0,
"value": [
{
"from": "2017-02-20T06:50:00+08:00",
"to": "2017-02-20T18:10:00+08:00"
},
{
"from": "2017-02-21T06:50:00+08:00",
"to": "2017-02-21T18:11:00+08:00"
},
{
"from": "2017-02-22T06:49:00+08:00",
"to": "2017-02-22T18:11:00+08:00"
},
{
"from": "2017-02-23T06:48:00+08:00",
"to": "2017-02-23T18:12:00+08:00"
},
{
"from": "2017-02-24T06:47:00+08:00",
"to": "2017-02-24T18:13:00+08:00"
}
]
},
"temperature": {
"status": 0,
"unit": "℃",
"value": [
{
"from": "23",
"to": "9"
},
{
"from": "13",
"to": "7"
},
{
"from": "7",
"to": "4"
},
{
"from": "8",
"to": "6"
},
{
"from": "12",
"to": "5"
}
]
},
"weather": {
"status": 0,
"value": [
{
"from": "1",
"to": "1"
},
{
"from": "7",
"to": "22"
},
{
"from": "8",
"to": "7"
},
{
"from": "2",
"to": "2"
},
{
"from": "1",
"to": "1"
}
]
},
"wind": {
"direction": {
"status": 0,
"unit": "°",
"value": [
{
"from": "360",
"to": "360"
},
{
"from": "360",
"to": "360"
},
{
"from": "0",
"to": "0"
},
{
"from": "360",
"to": "360"
},
{
"from": "360",
"to": "360"
}
]
},
"speed": {
"status": 0,
"unit": "km/h",
"value": [
{
"from": "3.0",
"to": "3.0"
},
{
"from": "0.0",
"to": "0.0"
},
{
"from": "24.0",
"to": "24.0"
},
{
"from": "0.0",
"to": "0.0"
},
{
"from": "0.0",
"to": "0.0"
}
]
}
}
},
"forecastHourly": {
"aqi": {
"brandInfo": {
"brands": [
{
"brandId": "caiyun",
"logo": "http://f5.market.mi-img.com/download/MiSafe/0d2cde44e7d5b4a742b9846b8e5aaae62ebed7784/a.webp",
"names": {
"en_US": "彩云天气",
"zh_TW": "彩雲天氣",
"zh_CN": "彩云天气"
},
"url": ""
}
]
},
"pubTime": "2017-02-20T16:00:00+08:00",
"status": 0,
"value": [
50,
47,
47,
47,
50,
55,
59,
63,
64,
61,
52,
43,
35,
31,
29,
27,
27,
26,
24,
23,
22,
20,
20
]
},
"status": 0,
"temperature": {
"pubTime": "2017-02-20T16:00:00+08:00",
"status": 0,
"unit": "",
"value": [
18,
15,
13,
11,
10,
10,
10,
10,
10,
10,
10,
9,
9,
8,
8,
8,
8,
10,
10,
11,
12,
13,
13
]
},
"weather": {
"pubTime": "2017-02-20T16:00:00+08:00",
"status": 0,
"value": [
0,
0,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
2,
2,
2,
3
]
}
},
"indices": {
"indices": [
{
"type": "uvIndex",
"value": "2"
},
{
"type": "humidity",
"value": "56"
},
{
"type": "feelsLike",
"value": "22"
},
{
"type": "pressure",
"value": "1010.4"
},
{
"type": "carWash",
"value": "1"
},
{
"type": "sports",
"value": "0"
}
],
"pubTime": "",
"status": 0
},
"aqi": {
"aqi": "130",
"brandInfo": {
"brands": [
{
"brandId": "CNEMC",
"logo": "",
"names": {
"en_US": "CNEMC",
"zh_TW": "中國環境監測總站",
"zh_CN": "中国环境监测总站"
},
"url": ""
}
]
},
"co": "1",
"no2": "33",
"o3": "89",
"pm10": "159",
"pm25": "99",
"primary": "pm10",
"pubTime": "2017-02-20T14:00:00+08:00",
"so2": "31",
"src": "中国环境监测总站",
"status": 0
},
"alerts": [],
"yesterday": {
"aqi": "223",
"date": "2017-02-19T12:10:00+08:00",
"status": 0,
"sunRise": "2017-02-19T06:51:00+08:00",
"sunSet": "2017-02-19T18:09:00+08:00",
"tempMax": "21",
"tempMin": "10",
"weatherEnd": "1",
"weatherStart": "2",
"windDircEnd": "360",
"windDircStart": "360",
"windSpeedEnd": "0.0",
"windSpeedStart": "0.0"
},
"url": {
"weathercn": "",
"caiyun": ""
},
"brandInfo": {
"brands": [
{
"brandId": "caiyun",
"logo": "http://f5.market.mi-img.com/download/MiSafe/0d2cde44e7d5b4a742b9846b8e5aaae62ebed7784/a.webp",
"names": {
"en_US": "彩云天气",
"zh_TW": "彩雲天氣",
"zh_CN": "彩云天气"
},
"url": ""
}
]
}
}
解析:
current
:当前天气状况feelsLike
:体感温度humidity
:相对空气湿度pressure
:气压temperature
:温度visibility
:能见度wind
:风信息unit
:该值单位value
:该值
weather
:天气状况,查看天气状况 jsonpubTime
:更新时间uvIndex
:???
forecastDaily
:今日预测aqi
:空气质量相关pubTime
:更新时间value
:包括今日的五日内空气质量指数
precipitationProbability
:降雨概率value
:包括今日的五日内降雨概率
sunRiseSet
:日落日出相关from
:日出时间to
:日落时间
temperature
:温度信息unit
:温度单位value
:包括今日的五日内温度信息from
:最高气温to
:最低气温
weather
:天气状况,查看天气状况 jsonwind
:风信息direction
:风向speed
:风速unit
:该值单位from
或to
:该值
forecastHourly
:今日小时预警aqi
:空气质量指数temperature
:温度信息weather
:天气状况,查看天气状况 jsonvalue
:今日二十四小时内的值
indices
:原型aqi
:空气相关aqi
:空气质量指数co
:一氧化碳指数no2
:二氧化氮指数o3
:臭氧指数pm10
:pm10指数pm25
:pm2.5指数so2
:二氧化硫指数src
:来源地
yesterday
:昨日信息aqi
:空气质量指数date
:日期sunRise
:日出时间sunSet
:日落时间tempMax
:最高气温tempMin
:最低气温weatherEnd
:结束天气weatherStart
:起始天气windDircEnd
:结束风向windDircStart
:起始风向windSpeedEnd
:结束风速windSpeedStart
:起始风速