Skip to Content
中云易冰

使用中文城市名查询天气

GET
/v1/weather/{city}

Path Parameters

city*string

中文城市名称,例如北京、上海、广州市。

Length1 <= length

Query Parameters

days?integer

请求预报天数。服务端会限制在 1 至 15 天,默认 7 天。

Range1 <= value <= 15
Default7

Response Body

天气查询成功

application/json
  1. response
ok*boolean
location*
days*integer
Range1 <= value <= 15
weather*

小米天气上游返回的数据。字段可能随地区和上游版本变化。

Example Request
curl -X GET 'https://weather.api.236668.xyz/v1/weather/北京?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  }}