api-cf
  1. 天气
api-cf
  • api-cf 公共接口文档
  • 建站实用
    • 随机动漫壁纸
      GET
    • 二维码生成
      POST
    • bing-wallpaper
      POST
    • bing wallpaper 解析api
      GET
  • 天气
    • 获取IP
      GET
    • 获取地区代码
      POST
    • 获取实时天气
      POST
    • IP转地址(精确) 解析api
      GET
    • 实时天气情况 解析api
      GET
    • 七天预报 解析api
      GET
    • 全境天气预报 解析api
      GET
  • Genshin
    • 数据结构说明
    • 获取角色展柜以及玩家信息
      GET
    • 获取玩家信息
      GET
  1. 天气

获取实时天气

POST
https://api-cf.ewlgc.top/get-weather
返回匹配条件的天气信息,匹配条件必须有一项且需要足够精准(市一级)

请求参数

Header 参数
view
string 
如有,返回七天预报
可选
示例值:
view
Body 参数application/json
四选一,优先级由上至下
area_code
string 
地区代码
可选
city
string 
廊坊市应作廊坊
可选
province
string 
北京市应作北京
可选
ip
string 
可选
ip目前并不稳定,请自行转换参数后请求
示例
{
  "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
}
上一页
获取地区代码
下一页
IP转地址(精确) 解析api
Built with