接口简介:
根据国外城市地址获取指定地址6日天气信息,来源于中国气象局官方数据。可查询地址列表可调用接口【国外主要城市天气6天-中国气象局-地址列表】https://www.apihz.cn/api/tianqitqyblistun.html
请求地址:
https://cn.apihz.cn/api/tianqi/tqybun.php
请求方式:
POST或GET。
请求参数:
【名称】【参数】【必填】【说明】
【用户ID】【id】【是】【用户中心的数字ID,例:id=10000000】
【用户KEY】【key】【是】【用户中心通讯秘钥,例:key=15he5h15ty854j5sr152hs2】
【城市名称】【city】【是】【要查询的国外城市名称,标准化城市名称请参考【国外主要城市天气6天-中国气象局-地址列表】接口(https://www.apihz.cn/api/tianqitqyblistun.html),例:city=亚特兰大】
返回参数:
【名称】【参数】【说明】
【状态码】【code】【200成功,400错误】
【消息内容】【msg】【信息提示。】
【国家】【guo】【国家。】
【城市】【city】【城市。】
【每日天气数据集】【weatherday1-6】【每日天气数据集。】
【日期】【weatherday.date】【日期。】
【星期】【weatherday.weekday】【星期。】
【日期2】【weatherday.monthDay】【日期2。】
【白天天气】【weatherday.weather1】【白天天气。】
【夜间天气】【weatherday.weather2】【夜间天气。】
【白天温度】【weatherday.wd1】【白天温度。】
【夜间温度】【weatherday.wd2】【夜间温度。】
【白天风向】【weatherday.winddirection1】【白天风向。】
【夜间风向】【weatherday.winddirection2】【夜间风向。】
【白天风力】【weatherday.windleve1】【白天风力。】
【夜间风力】【weatherday.windleve2】【夜间风力。】
【白天天气图标】【weatherday.weather1img】【白天天气图标。】
【夜间天气图标】【weatherday.weather2img】【夜间天气图标。】
【更新时间】【uptime】【更新时间。】
GET请求示例:
https://cn.apihz.cn/api/tianqi/tqybun.php?id=88888888&key=88888888&city=亚特兰大
注意:示例里的ID与KEY为公共ID与KEY,共享每分钟调用频次限制,接口本身免费,请使用自己的ID与KEY,独享每分钟调用频次。每日调用无上限。
POST请求示例:
请根据开发语言自行POST。
返回数据示例:
示例:{"code":400,"msg":"通讯秘钥错误。"}
示例:
{
"code": 200,
"guo": "美国",
"city": "亚特兰大",
"weatherday1": {
"date": "2026/02/05",
"weekday": "星期四",
"monthDay": "02/05",
"weather1": "晴",
"weather2": "晴",
"wd1": 7,
"wd2": -1,
"winddirection1": "西北风",
"winddirection2": "西北风",
"windleve1": "微风",
"windleve2": "5级",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/w0.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/w0.png"
},
"weatherday2": {
"date": "2026/02/06",
"weekday": "星期五",
"monthDay": "02/06",
"weather1": "晴",
"weather2": "晴",
"wd1": 16,
"wd2": 0,
"winddirection1": "西北风",
"winddirection2": "西北风",
"windleve1": "6级",
"windleve2": "6级",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/w0.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/w0.png"
},
"weatherday3": {
"date": "2026/02/07",
"weekday": "星期六",
"monthDay": "02/07",
"weather1": "晴",
"weather2": "晴",
"wd1": 7,
"wd2": -2,
"winddirection1": "西北风",
"winddirection2": "西北风",
"windleve1": "6级",
"windleve2": "5级",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/w0.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/w0.png"
},
"weatherday4": {
"date": "2026/02/08",
"weekday": "星期日",
"monthDay": "02/08",
"weather1": "晴",
"weather2": "晴",
"wd1": 13,
"wd2": -2,
"winddirection1": "西南风",
"winddirection2": "西南风",
"windleve1": "3级",
"windleve2": "3级",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/w0.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/w0.png"
},
"weatherday5": {
"date": "2026/02/09",
"weekday": "星期一",
"monthDay": "02/09",
"weather1": "晴",
"weather2": "阴",
"wd1": 20,
"wd2": 3,
"winddirection1": "西南风",
"winddirection2": "西北风",
"windleve1": "5级",
"windleve2": "3级",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/w0.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/w2.png"
},
"weatherday6": {
"date": "2026/02/10",
"weekday": "星期二",
"monthDay": "02/10",
"weather1": "阴",
"weather2": "多云",
"wd1": 21,
"wd2": 9,
"winddirection1": "西北风",
"winddirection2": "西南风",
"windleve1": "3级",
"windleve2": "3级",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/w2.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/w1.png"
},
"uptime": "2026-02-06 15:01:01"
}
参考资料(版权):
https://www.apihz.cn/api/tqtqybun.html