2024最新可用免费天气预报API接口

天气API接口数据, 数据字段最全,免费,稳定的实况天气预报接口

5分钟左右更新一次,支持全国3000多个市区县, 包含基本天气信息、24小时逐小时天气、气象预警列表、湿度、能见度、气压、降雨量、紫外线、风力风向风速、日出日落、空气质量、pm2.5、pm10、o3、no2、so2、是否需要带口罩、外出适宜、开窗适宜、是否需要打开净化器等等,可按地名、城市编号、IP查询、经纬度查询。

看上面的说明, 返回数据够多的吧, 该接口有每日免费次数, 付费最高可每日请求50万次

注意:本文档对接的是天气API的实况天气数据, 如需7日或更多请查看官网文档
接口特点
  1. 5分钟左右更新一次
  2. 支持全国所有市区县(3200个左右吧)
  3. 含24小时天气
  4. 含气象灾害预警
  5. 空气六因子
  6. 支持经纬度查询
  7. 多线路
对接流程
  1. 打开并注册天气API平台 (http://tianqiapi.com/) 进入用户中心,获取appid和appsecret
  2. 阅读实况天气开发文档
    http://tianqiapi.com/index/doc?version=2030
  3. 请求接口
  4. 解析JSON

Tips:大家在请求这类三方http接口的时候, 请一定将接口地址设置在服务端, 为动态可修改的, 请勿在C端直连接口, 防止遇到网络问题导致程序异常。

请求接口 (appid和appsecret换成自己的)
js 复制代码
https://v1.yiketianqi.com/free/v2030?appid=85841439&appsecret=EKCDLT4I&adcode=130200000000&aqi=
请求参数
参数名 必选 类型 说明 备注(示例)
appid string 用户appid 先注册开发账号
appsecret string 用户appsecret
adcode string 国家统计局城市ID 如:130200000000 请参考 全国统计用区划代码表
cityid string 城市ID 请参考 城市ID列表
city string 城市名称 不要带市和区; 如: 青岛、铁西
province string 所在省 如果您担心city重名可传此参数, 不要带省和市; 如: 山东、上海
ip string IP地址 查询IP所在城市天气
lng String 经度 如: 119.545023 (需额外开通lbs权限)
lat String 纬度 如: 36.044254
point String 坐标体系 默认百度坐标, 如使用高德坐标, 请传参: gaode
callback string jsonp参数 如: jQuery.Callbacks
vue string 跨域参数 如果您使用的是react、vue、angular请填写值: 1
hours Int 是否显示小时天气 默认隐藏, 如需显示, 请传参: 1
aqi Int 是否显示AQI六因子 默认隐藏, 如需显示, 请传参: 1
返回JSON内容
javascript 复制代码
{
          "cityid":  "101160602",
          "date":  "2024-02-25",
          "week":  "星期日",
          "update_time":  "22:55",
          "city":  "永昌",
          "cityEn":  "yongchang",
          "country":  "中国",
          "countryEn":  "China",
          "wea":  "阴",
          "wea_img":  "yin",
          "tem":  "-7.5",
          "tem1":  "-2",
          "tem2":  "-14",
          "win":  "东南风",
          "win_speed":  "2级",
          "win_meter":  "6km\/h",
          "humidity":  "94%",//湿度
          "visibility":  "17km",//能见度
          "pressure":  "792",//气压
          "air":  "124",//空气质量
          "air_pm25":  "124",
          "air_level":  "轻度污染",
          "air_tips":  "各类人群可多参加户外活动,多呼吸一下清新的空气。",
          "alarm":  [
                    {
                              "alarm_type":  "道路结冰",
                              "alarm_level":  "黄色",
                              "alarm_title":  "甘肃省永昌县发布道路结冰黄色预警",
                              "alarm_content":  "永昌县气象台2024年02月25日21时14分发布道路结冰黄色预警信号:受降雪和低温天气影响,预计未来24小时,我县大部乡镇将出现对交通有影响的道路结冰,请注意防范。(预警信息来源:国家预警信息发布中心)"
                    },
                    {
                              "alarm_type":  "道路结冰",
                              "alarm_level":  "黄色",
                              "alarm_title":  "甘肃省金昌市发布道路结冰黄色预警",
                              "alarm_content":  "金昌市气象台2024年02月25日17时02分发布道路结冰黄色预警信号:受降雪和低温天气影响,预计未来24小时,我市部分路段将出现道路结冰,影响交通安全,请注意防范。(预警信息来源:国家预警信息发布中心)"
                    }
          ],
          "rain_pcpn":  "0",//降雨量mm
          "uvIndex":  "0",//紫外线0-11
          "uvDescription":  "低",
          "wea_day":  "阴",//白天天气
          "wea_day_img":  "yin",
          "wea_night":  "多云",//夜间天气
          "wea_night_img":  "yun",
          "sunrise":  "07:50",//日出
          "sunset":  "19:00",//日落
          "hours":  [
                    {
                              "hours":  "22:00",
                              "wea":  "轻度雾霾",
                              "wea_img":  "wu",
                              "tem":  "-6",
                              "win":  "东北风",
                              "win_speed":  "1级",
                              "vis":  "14.9",//能见度
                              "aqinum":  "114",//aqi
                              "aqi":  "轻度污染"
                    },
                    {
                              "hours":  "23:00",
                              "wea":  "多云",
                              "wea_img":  "yun",
                              "tem":  "-6",
                              "win":  "东南风",
                              "win_speed":  "1级",
                              "vis":  "78.06",
                              "aqinum":  "52",
                              "aqi":  "良"
                    },
                    {
                              "hours":  "00:00",
                              "wea":  "多云",
                              "wea_img":  "yun",
                              "tem":  "-7",
                              "win":  "东南风",
                              "win_speed":  "无风",
                              "vis":  "80.35",
                              "aqinum":  "50",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "01:00",
                              "wea":  "阴",
                              "wea_img":  "yin",
                              "tem":  "-7",
                              "win":  "西南风",
                              "win_speed":  "无风",
                              "vis":  "82.84",
                              "aqinum":  "48",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "02:00",
                              "wea":  "阴",
                              "wea_img":  "yin",
                              "tem":  "-7",
                              "win":  "西南风",
                              "win_speed":  "无风",
                              "vis":  "95.67",
                              "aqinum":  "47",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "03:00",
                              "wea":  "多云",
                              "wea_img":  "yun",
                              "tem":  "-7",
                              "win":  "东风",
                              "win_speed":  "1级",
                              "vis":  "88.93",
                              "aqinum":  "45",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "04:00",
                              "wea":  "多云",
                              "wea_img":  "yun",
                              "tem":  "-8",
                              "win":  "东北风",
                              "win_speed":  "1级",
                              "vis":  "86.09",
                              "aqinum":  "44",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "05:00",
                              "wea":  "多云",
                              "wea_img":  "yun",
                              "tem":  "-8",
                              "win":  "风",
                              "win_speed":  "1级",
                              "vis":  "82.28",
                              "aqinum":  "42",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "06:00",
                              "wea":  "多云",
                              "wea_img":  "yun",
                              "tem":  "-8",
                              "win":  "西北风",
                              "win_speed":  "1级",
                              "vis":  "85.25",
                              "aqinum":  "41",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "07:00",
                              "wea":  "晴",
                              "wea_img":  "qing",
                              "tem":  "-8",
                              "win":  "西北风",
                              "win_speed":  "2级",
                              "vis":  "94.49",
                              "aqinum":  "40",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "08:00",
                              "wea":  "晴",
                              "wea_img":  "qing",
                              "tem":  "-8",
                              "win":  "西北风",
                              "win_speed":  "2级",
                              "vis":  "103.71",
                              "aqinum":  "40",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "09:00",
                              "wea":  "晴",
                              "wea_img":  "qing",
                              "tem":  "-8",
                              "win":  "西北风",
                              "win_speed":  "2级",
                              "vis":  "177.04",
                              "aqinum":  "38",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "10:00",
                              "wea":  "晴",
                              "wea_img":  "qing",
                              "tem":  "-7",
                              "win":  "西北风",
                              "win_speed":  "2级",
                              "vis":  "231.08",
                              "aqinum":  "37",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "11:00",
                              "wea":  "晴",
                              "wea_img":  "qing",
                              "tem":  "-6",
                              "win":  "西北风",
                              "win_speed":  "2级",
                              "vis":  "231.08",
                              "aqinum":  "35",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "12:00",
                              "wea":  "晴",
                              "wea_img":  "qing",
                              "tem":  "-5",
                              "win":  "西北风",
                              "win_speed":  "2级",
                              "vis":  "231.08",
                              "aqinum":  "32",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "13:00",
                              "wea":  "多云",
                              "wea_img":  "yun",
                              "tem":  "-4",
                              "win":  "西北风",
                              "win_speed":  "1级",
                              "vis":  "231.08",
                              "aqinum":  "31",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "14:00",
                              "wea":  "多云",
                              "wea_img":  "yun",
                              "tem":  "-3",
                              "win":  "西北风",
                              "win_speed":  "1级",
                              "vis":  "231.08",
                              "aqinum":  "30",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "15:00",
                              "wea":  "多云",
                              "wea_img":  "yun",
                              "tem":  "-2",
                              "win":  "东北风",
                              "win_speed":  "2级",
                              "vis":  "231.08",
                              "aqinum":  "33",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "16:00",
                              "wea":  "多云",
                              "wea_img":  "yun",
                              "tem":  "-1",
                              "win":  "东北风",
                              "win_speed":  "3级",
                              "vis":  "231.08",
                              "aqinum":  "27",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "17:00",
                              "wea":  "多云",
                              "wea_img":  "yun",
                              "tem":  "-2",
                              "win":  "东风",
                              "win_speed":  "3级",
                              "vis":  "231.08",
                              "aqinum":  "25",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "18:00",
                              "wea":  "多云",
                              "wea_img":  "yun",
                              "tem":  "-3",
                              "win":  "东南风",
                              "win_speed":  "3级",
                              "vis":  "231.08",
                              "aqinum":  "24",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "19:00",
                              "wea":  "多云",
                              "wea_img":  "yun",
                              "tem":  "-5",
                              "win":  "东风",
                              "win_speed":  "3级",
                              "vis":  "231.08",
                              "aqinum":  "22",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "20:00",
                              "wea":  "多云",
                              "wea_img":  "yun",
                              "tem":  "-6",
                              "win":  "东风",
                              "win_speed":  "2级",
                              "vis":  "128.67",
                              "aqinum":  "21",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "21:00",
                              "wea":  "晴",
                              "wea_img":  "qing",
                              "tem":  "-6",
                              "win":  "东北风",
                              "win_speed":  "2级",
                              "vis":  "120.35",
                              "aqinum":  "21",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "22:00",
                              "wea":  "晴",
                              "wea_img":  "qing",
                              "tem":  "-6",
                              "win":  "东北风",
                              "win_speed":  "2级",
                              "vis":  "117.9",
                              "aqinum":  "21",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "23:00",
                              "wea":  "晴",
                              "wea_img":  "qing",
                              "tem":  "-7",
                              "win":  "东风",
                              "win_speed":  "1级",
                              "vis":  "97.76",
                              "aqinum":  "21",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "00:00",
                              "wea":  "晴",
                              "wea_img":  "qing",
                              "tem":  "-7",
                              "win":  "东北风",
                              "win_speed":  "1级",
                              "vis":  "90.18",
                              "aqinum":  "21",
                              "aqi":  "优"
                    },
                    {
                              "hours":  "01:00",
                              "wea":  "晴",
                              "wea_img":  "qing",
                              "tem":  "-7",
                              "win":  "风",
                              "win_speed":  "1级",
                              "vis":  "83.73",
                              "aqinum":  "21",
                              "aqi":  "优"
                    }
          ],
          "aqi":  {
                    "update_time":  "22:30",
                    "air":  "114",
                    "air_level":  "轻度污染",
                    "air_tips":  "各类人群可多参加户外活动,多呼吸一下清新的空气。",
                    "pm25":  "86",
                    "pm25_desc":  "轻度污染",
                    "pm10":  "172",
                    "pm10_desc":  "中度污染",
                    "o3":  "80",
                    "o3_desc":  "",
                    "no2":  "20",
                    "no2_desc":  "",
                    "so2":  "6",
                    "so2_desc":  "",
                    "co":  "0.9",
                    "co_desc":  "",
                    "kouzhao":  "不用佩戴口罩",
                    "yundong":  "适宜运动",
                    "waichu":  "不适宜外出",
                    "kaichuang":  "适宜开窗",
                    "jinghuaqi":  "不需要打开"
          },
          "nums":  19
}
相关推荐
Json_1817901448023 分钟前
An In-depth Look into the 1688 Product Details Data API Interface
大数据·json
Qspace丨轻空间3 小时前
气膜场馆:推动体育文化旅游创新发展的关键力量—轻空间
大数据·人工智能·安全·生活·娱乐
Elastic 中国社区官方博客4 小时前
如何将数据从 AWS S3 导入到 Elastic Cloud - 第 3 部分:Elastic S3 连接器
大数据·elasticsearch·搜索引擎·云计算·全文检索·可用性测试·aws
Aloudata5 小时前
从Apache Atlas到Aloudata BIG,数据血缘解析有何改变?
大数据·apache·数据血缘·主动元数据·数据链路
水豚AI课代表5 小时前
分析报告、调研报告、工作方案等的提示词
大数据·人工智能·学习·chatgpt·aigc
拓端研究室TRL8 小时前
【梯度提升专题】XGBoost、Adaboost、CatBoost预测合集:抗乳腺癌药物优化、信贷风控、比特币应用|附数据代码...
大数据
黄焖鸡能干四碗8 小时前
信息化运维方案,实施方案,开发方案,信息中心安全运维资料(软件资料word)
大数据·人工智能·软件需求·设计规范·规格说明书
编码小袁8 小时前
探索数据科学与大数据技术专业本科生的广阔就业前景
大数据
WeeJot嵌入式9 小时前
大数据治理:确保数据的可持续性和价值
大数据
zmd-zk10 小时前
kafka+zookeeper的搭建
大数据·分布式·zookeeper·中间件·kafka