获取实时天气
POST
https://api-cf.ewlgc.top/get-weather
请求参数
Header 参数
view
string
如有,返回七天预报
示例值:
view
Body 参数application/json
四选一,优先级由上至下
area_code
string
地区代码
city
string
廊坊市应作廊坊
province
string
北京市应作北京
ip
string
可选
示例
{
"province": "北京",
"city": "顺义"
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api-cf.ewlgc.top/get-weather' \
--header 'view: view' \
--header 'Content-Type: application/json' \
--data-raw '{
"province": "北京",
"city": "顺义"
}'
返回响应
🟢200成功
application/json
Body
records
array [object {5}]
必需
id
string
必需
code
string
必需
area_code
string
必需
province
string
必需
city
string
必需
status
string
必需
data
object
必需
msg
string
必需
code
integer
必需
data
object
必需
error
null
必需
示例
{
"status": "success",
"data": {
"msg": "success",
"code": 0,
"data": {
"location": {
"id": "54398",
"name": "顺义",
"path": "中国, 北京, 顺义",
"longitude": 116.62,
"latitude": 40.13,
"timezone": 8
},
"daily": [
{
"date": "2023/12/17",
"high": -8,
"dayText": "晴",
"dayCode": 0,
"dayWindDirection": "西南风",
"dayWindScale": "微风",
"low": -14,
"nightText": "多云",
"nightCode": 1,
"nightWindDirection": "东南风",
"nightWindScale": "微风"
},
{
"date": "2023/12/18",
"high": -4,
"dayText": "晴",
"dayCode": 0,
"dayWindDirection": "东南风",
"dayWindScale": "微风",
"low": -13,
"nightText": "晴",
"nightCode": 0,
"nightWindDirection": "西北风",
"nightWindScale": "3~4级"
},
{
"date": "2023/12/19",
"high": -4,
"dayText": "晴",
"dayCode": 0,
"dayWindDirection": "西北风",
"dayWindScale": "3~4级",
"low": -14,
"nightText": "晴",
"nightCode": 0,
"nightWindDirection": "西北风",
"nightWindScale": "微风"
},
{
"date": "2023/12/20",
"high": -6,
"dayText": "晴",
"dayCode": 0,
"dayWindDirection": "北风",
"dayWindScale": "3~4级",
"low": -14,
"nightText": "晴",
"nightCode": 0,
"nightWindDirection": "西北风",
"nightWindScale": "3~4级"
},
{
"date": "2023/12/21",
"high": -7,
"dayText": "晴",
"dayCode": 0,
"dayWindDirection": "西北风",
"dayWindScale": "3~4级",
"low": -14,
"nightText": "晴",
"nightCode": 0,
"nightWindDirection": "北风",
"nightWindScale": "微风"
},
{
"date": "2023/12/22",
"high": -4,
"dayText": "晴",
"dayCode": 0,
"dayWindDirection": "北风",
"dayWindScale": "微风",
"low": -14,
"nightText": "晴",
"nightCode": 0,
"nightWindDirection": "北风",
"nightWindScale": "微风"
},
{
"date": "2023/12/23",
"high": -4,
"dayText": "多云",
"dayCode": 1,
"dayWindDirection": "西风",
"dayWindScale": "微风",
"low": -12,
"nightText": "晴",
"nightCode": 0,
"nightWindDirection": "西北风",
"nightWindScale": "微风"
}
],
"now": {
"precipitation": 0,
"temperature": -11.5,
"pressure": 1034,
"humidity": 57,
"windDirection": "9999",
"windDirectionDegree": 9999,
"windSpeed": 0,
"windScale": "微风"
},
"alarm": [
{
"id": "11011341600000_20231217110700",
"title": "顺义区气象台降级发布道路结冰黄色预警[III/较重]",
"signaltype": "道路结冰",
"signallevel": "黄色",
"effective": "2023/12/17 11:10",
"eventType": "11B21",
"severity": "YELLOW"
}
],
"lastUpdate": "2023/12/17 20:35"
}
},
"error": null
}
修改于 2023-12-17 15:28:31