查询天气
可使用中文城市名、城市 ID、locationKey 或经纬度查询。优先级依次为 city、cityId、locationKey、经纬度。
GET
city?string中文城市名称。
cityId?string中国天气城市 ID,例如北京为 101010100。
Match
^[0-9]+$locationKey?string小米天气位置键。
lat?number纬度;也兼容 latitude 参数。
Range
-90 <= value <= 90lon?number经度;也兼容 lng 或 longitude 参数。
Range
-180 <= value <= 180days?integer请求预报天数。服务端会限制在 1 至 15 天,默认 7 天。
Range
1 <= value <= 15Default
7天气查询成功
application/json- response
ok*booleanlocation*days*integerRange
1 <= value <= 15weather*小米天气上游返回的数据。字段可能随地区和上游版本变化。
curl -X GET 'https://weather.api.236668.xyz/v1/weather?city=%E5%8C%97%E4%BA%AC&cityId=101010100&locationKey=weathercn%3A101010100&lat=39.904&lon=116.408&days=7'Example Response
{ "ok": true, "location": { "affiliation": "string", "key": "string", "locationKey": "string", "name": "string", "latitude": "string", "longitude": "string", "status": 0, "timeZoneShift": 0 }, "days": 1, "weather": { "current": {}, "forecastDaily": {}, "forecastHourly": {}, "aqi": {}, "alerts": [ {} ], "minutely": {}, "updateTime": 0 }}