接口调用地址
说明:直接访问 https://api.apihz.cn/getapi.php 获取当前最优IP接口地址。由普通负载集群服务器组成,通过IP接口地址调用,如果单个服务器过载可自行切换IP接口地址尝试其他负载服务器。IP并非永久固定且容易遭受攻击,平台可能不定期更换。
说明:域名接口会自动分发请求到普通集群服务器均衡负载,该域名TTL值为60秒,表示你的请求会每60秒实现自动轮换负载服务器,但也可能因你的网络服务商存在DNS缓存造成短时间内无法自动切换负载。如果某个负载服务器出现故障,也可能会造成个别地区存在一定时间的故障期。
说明:VIP专线在普通集群组的基础上额外增加独享大带宽集群组,每次请求自动均衡负载,自动故障切换,抗攻击,全球智能CDN加速。超高稳定性!最低30¥/月,彩钻以上会员专属,登录后购买。注:VIP线路是指调用接口的线路更有保障以及每分钟拥有更高的调用频次等,并非收费接口包月使用。
请求示例
[GET]请求示例:(请登录后使用自己的KEY独享频次)
复制参数
复制全部
https://cn.apihz.cn/api/tianqi/oldtqyb.php?id=88888888&key=88888888&sheng=四川&place=绵阳&y=2026&m=1&d=1
[POST]请求示例:(请根据开发语言自行POST,参考【GET/POST教程】,或下载【超级客户端】调试。)
请求参数说明
注意:请求编码为UTF8,否则带中文请求可能失败。一般参数不能带+号,会被自动替换为空格。参数内容较大的必须用POST,不能GET。
提示:如发现接口有BUG,可加服务QQ群及时向我们反馈。
提示:请求参数里的开发者ID与KEY,登录后台菜单【个人资料】里查看。
提示:如发现接口有BUG,可加服务QQ群及时向我们反馈。
提示:请求参数里的开发者ID与KEY,登录后台菜单【个人资料】里查看。
| 名称 | 参数 | 必填 | 说明 |
|---|---|---|---|
| 开发者ID | id | 是 | 用户中心的数字ID,例:id=10000000 |
| 开发者KEY | key | 是 | 用户中心通讯秘钥,例:key=15he5h15ty854j5sr152hs2 |
| 省份名称 | sheng | 否 | 一级行政区,要查询的省份名称,直辖市也为一级行政区。可查询地区列表可调用接口【天气预报-天气预报1-7天-中国气象局-地址列表】https://www.apihz.cn/api/tianqitqyblist.html。例:sheng=北京,sheng=北京市,sheng=四川省,sheng=四川 |
| 地点 | place | 是 | 要查询的地点,一般为市级名称或该市下的某地点名称。某些直辖市可查区级。部分地区暂无数据,可联系我们修复补充。可查询地点列表可调用接口【天气预报-天气预报1-7天-中国气象局-地址列表】https://www.apihz.cn/api/tianqitqyblist.html。例:place=大兴区,place=大兴,place=上海,place=重庆,place=广州,place=深圳 |
| 查询年 | y | 是 | 可查询2011年-当前年。例:y=2026 |
| 查询月 | m | 是 | 查询月份。例:m=1 |
| 查询日 | d | 否 | 查询日。如不传该参数则返回整月天气数据集,查询整月天气需开通彩钻或炫钻或焱钻会员。例:d=1 |
| 动态秘钥 | dkey | 否 | 开发者开启动态秘钥验证后需传此参数,主要针对直接在客户端调用接口的场景。请在官网后台菜单【个人资料】里配置。例:dkey=0cd2a494831736587c33f30d1e544371 |
| 用户IP | uip | 否 | 接口调用者IP,用于后台统计IP地域分布,ISP运营商,时段IP数统计等,如不传该参数则默认为接口请求端IP,该参数主要用于使用后端服务器/中间件请求接口的方式使用。例:uip=123.123.123.123。该参数彩钻/炫钻/焱钻会员专享。 |
返回参数说明
| 名称 | 参数 | 说明 |
|---|---|---|
| 状态码 | code | 200成功,400错误 |
| 消息内容 | msg | 信息提示。 |
| 省级 | sheng | 查询地址省级。 |
| 市级 | shi | 查询地址市级或地区。 |
| 天气预报地址 | name | 天气预报地址。 |
| 天气数据集 | data | 天气数据集。 |
| 查询日 | data.d | 查询日。 |
| 当日白天天气 | data.weather1 | 当日白天天气。 |
| 当日夜间天气 | data.weather2 | 当日夜间天气。 |
| 当日白天温度 | data.wd1 | 当日白天温度。 |
| 当日夜间温度 | data.wd2 | 当日夜间温度。 |
| 当日白天风向 | data.winddirection1 | 当日白天风向。2026年1月27日前的白天和夜间会组合在该字段返回。 |
| 当日夜间风向 | data.winddirection2 | 当日夜间风向。 |
| 当日白天风力等级 | data.windleve1 | 当日白天风力等级。 |
| 当日夜间风力等级 | data.windleve2 | 当日夜间风力等级。 |
| 当日白天天气图标 | data.weather1img | 当日白天天气图标。 |
| 当日夜间天气图标 | data.weather2img | 当日夜间天气图标。 |
| 预警信息 | data.alarm | 2026年1月27日前该字段无数据。 |
返回数据示例
示例:{"code":400,"msg":"通讯秘钥错误。"}
示例:
{
"code": 200,
"sheng": "四川",
"shi": "绵阳",
"name": "绵阳",
"y": 2026,
"m": 1,
"datas": [{
"d": "1",
"weather1": "阴",
"weather2": "小雨",
"wd1": "9",
"wd2": "5",
"winddirection1": "东北风2级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/xiaoyu.png",
"alarm": null
}, {
"d": "2",
"weather1": "阴",
"weather2": "小雨",
"wd1": "5",
"wd2": "3",
"winddirection1": "东北风2级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/xiaoyu.png",
"alarm": null
}, {
"d": "3",
"weather1": "小雨",
"weather2": "阴",
"wd1": "5",
"wd2": "2",
"winddirection1": "东北风2级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/xiaoyu.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"alarm": null
}, {
"d": "4",
"weather1": "小雨",
"weather2": "晴",
"wd1": "10",
"wd2": "2",
"winddirection1": "南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/xiaoyu.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": null
}, {
"d": "5",
"weather1": "阴",
"weather2": "多云",
"wd1": "8",
"wd2": "0",
"winddirection1": "东风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "6",
"weather1": "晴",
"weather2": "阴",
"wd1": "12",
"wd2": "0",
"winddirection1": "东南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"alarm": null
}, {
"d": "7",
"weather1": "阴",
"weather2": "多云",
"wd1": "13",
"wd2": "0",
"winddirection1": "南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "8",
"weather1": "雾",
"weather2": "晴",
"wd1": "12",
"wd2": "0",
"winddirection1": "东南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/wu.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": null
}, {
"d": "9",
"weather1": "多云",
"weather2": "多云",
"wd1": "13",
"wd2": "2",
"winddirection1": "西南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "10",
"weather1": "多云",
"weather2": "晴",
"wd1": "15",
"wd2": "2",
"winddirection1": "东北风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": null
}, {
"d": "11",
"weather1": "雾",
"weather2": "多云",
"wd1": "8",
"wd2": "2",
"winddirection1": "东风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/wu.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "12",
"weather1": "多云",
"weather2": "晴",
"wd1": "15",
"wd2": "2",
"winddirection1": "西南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": null
}, {
"d": "13",
"weather1": "多云",
"weather2": "多云",
"wd1": "13",
"wd2": "5",
"winddirection1": "东北风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "14",
"weather1": "多云",
"weather2": "多云",
"wd1": "19",
"wd2": "3",
"winddirection1": "西北风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "15",
"weather1": "晴",
"weather2": "多云",
"wd1": "16",
"wd2": "3",
"winddirection1": "东风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "16",
"weather1": "雾",
"weather2": "晴",
"wd1": "17",
"wd2": "2",
"winddirection1": "西南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/wu.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": null
}, {
"d": "17",
"weather1": "多云",
"weather2": "晴",
"wd1": "15",
"wd2": "6",
"winddirection1": "东南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": null
}, {
"d": "18",
"weather1": "多云",
"weather2": "小雨",
"wd1": "16",
"wd2": "10",
"winddirection1": "东北风2级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/xiaoyu.png",
"alarm": null
}, {
"d": "19",
"weather1": "小雨",
"weather2": "阴",
"wd1": "10",
"wd2": "3",
"winddirection1": "无持续风向",
"winddirection2": "无持续风向",
"windleve1": "微风",
"windleve2": "微风",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/xiaoyu.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"alarm": "{\n \"id\": \"51070041600000_20260119090021\",\n \"title\": \"绵阳市气象台更新大风蓝色预警信号[IV级/一般]\",\n \"signaltype\": \"大风\",\n \"signallevel\": \"蓝色\",\n \"effective\": \"2026/01/19 09:00\",\n \"eventType\": \"11B06\",\n \"severity\": \"BLUE\",\n \"type\": \"p0007004\"\n}"
}, {
"d": "20",
"weather1": "阴",
"weather2": "阴",
"wd1": "5",
"wd2": "3",
"winddirection1": "东南风2级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"alarm": null
}, {
"d": "21",
"weather1": "阴",
"weather2": "晴",
"wd1": "7",
"wd2": "1",
"winddirection1": "东南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": null
}, {
"d": "22",
"weather1": "多云",
"weather2": "多云",
"wd1": "6",
"wd2": "1",
"winddirection1": "东南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "23",
"weather1": "多云",
"weather2": "阴",
"wd1": "6",
"wd2": "2",
"winddirection1": "无持续风向",
"winddirection2": "无持续风向",
"windleve1": "微风",
"windleve2": "微风",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"alarm": "null"
}, {
"d": "24",
"weather1": "多云",
"weather2": "晴",
"wd1": "7",
"wd2": "3",
"winddirection1": "无持续风向",
"winddirection2": "无持续风向",
"windleve1": "微风",
"windleve2": "微风",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": "null"
}, {
"d": "25",
"weather1": "阴",
"weather2": "多云",
"wd1": "6",
"wd2": "3",
"winddirection1": "无持续风向",
"winddirection2": "无持续风向",
"windleve1": "微风",
"windleve2": "微风",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": "null"
}, {
"d": "26",
"weather1": "多云",
"weather2": "小雨",
"wd1": "10",
"wd2": "3",
"winddirection1": "无持续风向",
"winddirection2": "无持续风向",
"windleve1": "微风",
"windleve2": "微风",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/xiaoyu.png",
"alarm": "null"
}, {
"d": "27",
"weather1": "多云",
"weather2": "阴",
"wd1": "13",
"wd2": "5",
"winddirection1": "无持续风向",
"winddirection2": "无持续风向",
"windleve1": "微风",
"windleve2": "微风",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"alarm": "null"
}]
}
更新记录