稳定

Sh-API,我们致力于为用户提供专业的免费API数据接口服务

聚合天气预报 v1.0

最后更新: 2025-03-15

多个天气数据源的综合天气查询API,支持墨迹天气、百度天气、中央天气和彩云天气等多个数据源,提供全面的天气信息查询服务。

免费接口 调用次数: 10,132 正常运行 响应速度: <100ms

接口信息

接口地址:
https://api.yyy001.com/api/weather
请求方式: GET
返回格式: JSON

调用统计

10,132
今日调用
10,132
总调用次数
请求示例 https://api.yyy001.com/api/weather?msg=上海

点击右侧按钮复制完整请求地址

请求参数

名称 必填 类型 说明
msg
string 要查询的城市名称,默认北京
type
string 指定天气数据源,默认返回所有源
n
integer 当有多个同名城市时,选择第几个,默认0
num
integer 返回的预报天数或城市数量,默认5

返回参数

名称 类型 说明
code
integer 状态码:200成功,201失败,202参数错误,500服务器错误
data
object 天气数据
msg
string 响应信息
tips
string 接口提示信息

返回示例

                {
  "code": 200,
  "data": {
    "moji": {
      "code": 200,
      "data": {
        "city": "中国-上海市-上海市",
        "forecast": [
          {
            "date": null,
            "dayWeather": "晴",
            "nightWeather": "晴",
            "temperature": "5~12℃",
            "humidity": 58,
            "windDay": "东风 2级",
            "windNight": "东风 2级",
            "airQuality": "优"
          },
          {
            "date": null,
            "dayWeather": "多云",
            "nightWeather": "多云",
            "temperature": "4~14℃",
            "humidity": 70,
            "windDay": "东北风 2级",
            "windNight": "东北风 2级",
            "airQuality": "良"
          },
          {
            "date": null,
            "dayWeather": "晴",
            "nightWeather": "晴",
            "temperature": "3~11℃",
            "humidity": 67,
            "windDay": "东北风 3级",
            "windNight": "东北风 2级",
            "airQuality": "良"
          },
          {
            "date": null,
            "dayWeather": "多云",
            "nightWeather": "阴",
            "temperature": "6~11℃",
            "humidity": 61,
            "windDay": "东南风 3级",
            "windNight": "东南风 2级",
            "airQuality": "良"
          },
          {
            "date": null,
            "dayWeather": "阴",
            "nightWeather": "晴",
            "temperature": "4~11℃",
            "humidity": 73,
            "windDay": "西风 2级",
            "windNight": "西南风 2级",
            "airQuality": "良"
          }
        ],
        "matched_cities": [
          "中国-上海市-上海市",
          "中国-上海市-上海市宝山区",
          "中国-上海市-上海市普陀区",
          "中国-上海市-嘉定区",
          "中国-上海市-金山区"
        ]
      },
      "msg": "",
      "tips": "Weather API Service"
    },
    "baidu": {
      "code": 200,
      "data": {
        "city": "中国-上海",
        "forecast": [
          {
            "dayWeather": "晴",
            "nightWeather": "晴",
            "temperature": "5℃~12℃",
            "windDay": "东风[2级]",
            "windNight": "东风[2级]",
            "airQuality": "优",
            "humidity": "47",
            "sunrise": "06:53",
            "sunset": "17:02"
          },
          {
            "dayWeather": "多云",
            "nightWeather": "多云",
            "temperature": "4℃~14℃",
            "windDay": "东北风[2级]",
            "windNight": "东北风[2级]",
            "airQuality": "良",
            "humidity": null,
            "sunrise": "06:53",
            "sunset": "17:03"
          },
          {
            "dayWeather": "晴",
            "nightWeather": "晴",
            "temperature": "3℃~11℃",
            "windDay": "东北风[2级]",
            "windNight": "东北风[2级]",
            "airQuality": "良",
            "humidity": null,
            "sunrise": "06:53",
            "sunset": "17:04"
          },
          {
            "dayWeather": "多云",
            "nightWeather": "阴",
            "temperature": "6℃~11℃",
            "windDay": "东南风[3级]",
            "windNight": "东南风[3级]",
            "airQuality": "良",
            "humidity": null,
            "sunrise": "06:53",
            "sunset": "17:05"
          },
          {
            "dayWeather": "阴",
            "nightWeather": "晴",
            "temperature": "4℃~11℃",
            "windDay": "西风[2级]",
            "windNight": "西南风[2级]",
            "airQuality": "良",
            "humidity": null,
            "sunrise": "06:54",
            "sunset": "17:05"
          }
        ]
      },
      "msg": "",
      "tips": "Weather API Service"
    },
    "zytq": {
      "code": 200,
      "data": {
        "city": "上海市-上海",
        "current": {
          "weather": "晴",
          "temperature": "11.5℃",
          "feelst": "10.4℃",
          "humidity": "50%",
          "comfort": 51,
          "wind": "西北风[微风0.9m/s]"
        },
        "matched_cities": [
          "上海市-上海",
          "福建省-上杭",
          "山东省-商河",
          "广东省-四会",
          "江苏省-泗洪"
        ]
      },
      "msg": "",
      "tips": "Weather API Service"
    },
    "cytq": {
      "code": 200,
      "data": {
        "city": "中国 上海市 上海",
        "current": {
          "temperature": "10.52℃",
          "humidity": "44%",
          "visibility": "18.34公里",
          "apparent_temperature": "7.4℃",
          "air_quality": {
            "pm25": 18,
            "aqi": 38
          },
          "comfort": "很冷",
          "ultraviolet": "无"
        },
        "forecast": "未来两小时不会下雨,放心出门吧",
        "matched_cities": [
          "中国 上海市 上海",
          "中国 上海市 崇明"
        ]
      },
      "msg": "",
      "tips": "Weather API Service"
    }
  },
  "msg": "获取所有天气源数据成功",
  "tips": "Weather API Service"
}