接口简介:
获取全球任意地区未来5天天气预报,必须传经纬度参数。可先调用【位置坐标】分类下相关接口获取地区经纬度坐标。
请求地址:
https://cn.apihz.cn/api/tianqi/tqybjw5.php
请求方式:
POST或GET。
请求参数:
【名称】【参数】【必填】【说明】
【用户ID】【id】【是】【用户中心的数字ID,例:id=10000000】
【用户KEY】【key】【是】【用户中心通讯秘钥,例:key=15he5h15ty854j5sr152hs2】
【纬度】【lat】【是】【纬度。例:lat=40.05702706489032】
【经度】【lon】【是】【经度。例:lon=116.30787799999993】
返回参数:
【名称】【参数】【说明】
【状态码】【code】【200成功,400错误】
【消息内容】【msg】【信息提示。】
【数据组数量】【cnt】【每3小时为一组数据,5天一般共计40组数据。】
【消息内容】【msg】【信息提示。】
【国家】【country】【国家代码 ISO。】
【日出】【sunrise】【日出时间戳。】
【日落】【sunset】【日落时间戳。】
【城市】【name】【城市名称。】
【数据组】【data】【天气预报数据集合,每天8组数据,每3小时为1组。】
【天气】【data.weather】【天气。】
【气温】【data.temp】【气温,华氏度。】
【气压】【data.pressure】【气压。】
【湿度】【data.humidity】【湿度百分比。】
【能见度】【data.visibility】【能见度,单位米。】
【风速】【data.speed】【风速,单位米。】
【风向】【data.deg】【风向度。】
【空气质量】【data.clouds】【空气质量,浑浊度,百分比。】
GET请求示例:
https://cn.apihz.cn/api/tianqi/tqybjw5.php?id=88888888&key=88888888&lat=40.05702706489032&lon=116.30787799999993
注意:示例里的ID与KEY为公共ID与KEY,共享每分钟调用频次限制,接口本身免费,请使用自己的ID与KEY,独享每分钟调用频次。每日调用无上限。
POST请求示例:
请根据开发语言自行POST。
返回数据示例:
示例:{"code":400,"msg":"通讯秘钥错误。"}
示例:
{
"code": 200,
"cnt": 40,
"name": "Haidian",
"country": "CN",
"sunrise": 1726523854,
"sunset": 1726568470,
"data": [{
"dt": 1726552800,
"time": "2024-09-17 06:00:00",
"temp": 300.91,
"pressure": 1006,
"humidity": 44,
"weather": "晴",
"clouds": 2,
"speed": 2.67,
"deg": 111,
"visibility": 10000
}, {
"dt": 1726563600,
"time": "2024-09-17 09:00:00",
"temp": 300.8,
"pressure": 1005,
"humidity": 49,
"weather": "多云",
"clouds": 63,
"speed": 3.25,
"deg": 110,
"visibility": 10000
}, {
"dt": 1726574400,
"time": "2024-09-17 12:00:00",
"temp": 299.28,
"pressure": 1007,
"humidity": 61,
"weather": "多云",
"clouds": 82,
"speed": 1.36,
"deg": 90,
"visibility": 10000
}, {
"dt": 1726585200,
"time": "2024-09-17 15:00:00",
"temp": 298.13,
"pressure": 1007,
"humidity": 68,
"weather": "多云",
"clouds": 57,
"speed": 1.6,
"deg": 123,
"visibility": 10000
}, {
"dt": 1726596000,
"time": "2024-09-17 18:00:00",
"temp": 296.68,
"pressure": 1007,
"humidity": 65,
"weather": "多云",
"clouds": 78,
"speed": 1.89,
"deg": 134,
"visibility": 10000
}, {
"dt": 1726606800,
"time": "2024-09-17 21:00:00",
"temp": 295.99,
"pressure": 1008,
"humidity": 59,
"weather": "阴,多云",
"clouds": 90,
"speed": 1.05,
"deg": 109,
"visibility": 10000
}, {
"dt": 1726617600,
"time": "2024-09-18 00:00:00",
"temp": 296.85,
"pressure": 1008,
"humidity": 53,
"weather": "阴,多云",
"clouds": 94,
"speed": 0.57,
"deg": 131,
"visibility": 10000
}, {
"dt": 1726628400,
"time": "2024-09-18 03:00:00",
"temp": 300.57,
"pressure": 1008,
"humidity": 36,
"weather": "多云",
"clouds": 56,
"speed": 1.47,
"deg": 132,
"visibility": 10000
}, {
"dt": 1726639200,
"time": "2024-09-18 06:00:00",
"temp": 303.11,
"pressure": 1006,
"humidity": 35,
"weather": "多云",
"clouds": 35,
"speed": 2.72,
"deg": 148,
"visibility": 10000
}, {
"dt": 1726650000,
"time": "2024-09-18 09:00:00",
"temp": 301.77,
"pressure": 1005,
"humidity": 47,
"weather": "晴,少云",
"clouds": 17,
"speed": 3.35,
"deg": 142,
"visibility": 10000
}, {
"dt": 1726660800,
"time": "2024-09-18 12:00:00",
"temp": 299.83,
"pressure": 1008,
"humidity": 52,
"weather": "多云",
"clouds": 51,
"speed": 2.04,
"deg": 169,
"visibility": 10000
}, {
"dt": 1726671600,
"time": "2024-09-18 15:00:00",
"temp": 298.71,
"pressure": 1008,
"humidity": 54,
"weather": "阴,多云",
"clouds": 99,
"speed": 1.86,
"deg": 148,
"visibility": 10000
}, {
"dt": 1726682400,
"time": "2024-09-18 18:00:00",
"temp": 297.77,
"pressure": 1008,
"humidity": 59,
"weather": "阴,多云",
"clouds": 100,
"speed": 2,
"deg": 149,
"visibility": 10000
}, {
"dt": 1726693200,
"time": "2024-09-18 21:00:00",
"temp": 296.87,
"pressure": 1007,
"humidity": 56,
"weather": "阴,多云",
"clouds": 100,
"speed": 1.49,
"deg": 120,
"visibility": 10000
}, {
"dt": 1726704000,
"time": "2024-09-19 00:00:00",
"temp": 297.41,
"pressure": 1007,
"humidity": 49,
"weather": "阴,多云",
"clouds": 98,
"speed": 1.36,
"deg": 145,
"visibility": 10000
}, {
"dt": 1726714800,
"time": "2024-09-19 03:00:00",
"temp": 298.78,
"pressure": 1006,
"humidity": 44,
"weather": "阴,多云",
"clouds": 87,
"speed": 2.98,
"deg": 154,
"visibility": 10000
}, {
"dt": 1726725600,
"time": "2024-09-19 06:00:00",
"temp": 298.78,
"pressure": 1004,
"humidity": 49,
"weather": "阴,多云",
"clouds": 87,
"speed": 1.82,
"deg": 139,
"visibility": 10000
}, {
"dt": 1726736400,
"time": "2024-09-19 09:00:00",
"temp": 299.42,
"pressure": 1002,
"humidity": 53,
"weather": "多云",
"clouds": 67,
"speed": 1.79,
"deg": 146,
"visibility": 10000
}, {
"dt": 1726747200,
"time": "2024-09-19 12:00:00",
"temp": 297.63,
"pressure": 1002,
"humidity": 64,
"weather": "多云",
"clouds": 64,
"speed": 1.33,
"deg": 131,
"visibility": 10000
}, {
"dt": 1726758000,
"time": "2024-09-19 15:00:00",
"temp": 295.82,
"pressure": 1004,
"humidity": 72,
"weather": "小雨",
"clouds": 56,
"speed": 2.34,
"deg": 351,
"visibility": 10000
}, {
"dt": 1726768800,
"time": "2024-09-19 18:00:00",
"temp": 293.06,
"pressure": 1005,
"humidity": 80,
"weather": "小雨",
"clouds": 78,
"speed": 3.87,
"deg": 326,
"visibility": 10000
}, {
"dt": 1726779600,
"time": "2024-09-19 21:00:00",
"temp": 291.2,
"pressure": 1007,
"humidity": 70,
"weather": "小雨",
"clouds": 100,
"speed": 4.8,
"deg": 343,
"visibility": 10000
}, {
"dt": 1726790400,
"time": "2024-09-20 00:00:00",
"temp": 291.25,
"pressure": 1010,
"humidity": 43,
"weather": "阴,多云",
"clouds": 100,
"speed": 5.12,
"deg": 349,
"visibility": 10000
}, {
"dt": 1726801200,
"time": "2024-09-20 03:00:00",
"temp": 292.49,
"pressure": 1012,
"humidity": 38,
"weather": "阴,多云",
"clouds": 100,
"speed": 4.67,
"deg": 337,
"visibility": 10000
}, {
"dt": 1726812000,
"time": "2024-09-20 06:00:00",
"temp": 297.66,
"pressure": 1011,
"humidity": 24,
"weather": "阴,多云",
"clouds": 99,
"speed": 4.74,
"deg": 345,
"visibility": 10000
}, {
"dt": 1726822800,
"time": "2024-09-20 09:00:00",
"temp": 297.3,
"pressure": 1012,
"humidity": 24,
"weather": "阴,多云",
"clouds": 100,
"speed": 3.78,
"deg": 43,
"visibility": 10000
}, {
"dt": 1726833600,
"time": "2024-09-20 12:00:00",
"temp": 295.28,
"pressure": 1014,
"humidity": 26,
"weather": "阴,多云",
"clouds": 100,
"speed": 2.32,
"deg": 25,
"visibility": 10000
}, {
"dt": 1726844400,
"time": "2024-09-20 15:00:00",
"temp": 292.56,
"pressure": 1015,
"humidity": 39,
"weather": "阴,多云",
"clouds": 90,
"speed": 1.8,
"deg": 219,
"visibility": 10000
}, {
"dt": 1726855200,
"time": "2024-09-20 18:00:00",
"temp": 291.31,
"pressure": 1014,
"humidity": 44,
"weather": "多云",
"clouds": 76,
"speed": 1,
"deg": 335,
"visibility": 10000
}, {
"dt": 1726866000,
"time": "2024-09-20 21:00:00",
"temp": 289.87,
"pressure": 1014,
"humidity": 45,
"weather": "晴",
"clouds": 0,
"speed": 1.62,
"deg": 351,
"visibility": 10000
}, {
"dt": 1726876800,
"time": "2024-09-21 00:00:00",
"temp": 291.12,
"pressure": 1014,
"humidity": 38,
"weather": "晴",
"clouds": 0,
"speed": 1.75,
"deg": 353,
"visibility": 10000
}, {
"dt": 1726887600,
"time": "2024-09-21 03:00:00",
"temp": 296.14,
"pressure": 1013,
"humidity": 27,
"weather": "晴",
"clouds": 0,
"speed": 1.35,
"deg": 30,
"visibility": 10000
}, {
"dt": 1726898400,
"time": "2024-09-21 06:00:00",
"temp": 299.23,
"pressure": 1010,
"humidity": 24,
"weather": "晴",
"clouds": 0,
"speed": 1.07,
"deg": 70,
"visibility": 10000
}, {
"dt": 1726909200,
"time": "2024-09-21 09:00:00",
"temp": 298.68,
"pressure": 1009,
"humidity": 23,
"weather": "晴",
"clouds": 0,
"speed": 1.89,
"deg": 127,
"visibility": 10000
}, {
"dt": 1726920000,
"time": "2024-09-21 12:00:00",
"temp": 295.3,
"pressure": 1010,
"humidity": 39,
"weather": "晴",
"clouds": 0,
"speed": 1.76,
"deg": 177,
"visibility": 10000
}, {
"dt": 1726930800,
"time": "2024-09-21 15:00:00",
"temp": 293.53,
"pressure": 1011,
"humidity": 45,
"weather": "晴",
"clouds": 0,
"speed": 1.64,
"deg": 351,
"visibility": 10000
}, {
"dt": 1726941600,
"time": "2024-09-21 18:00:00",
"temp": 291.42,
"pressure": 1011,
"humidity": 46,
"weather": "晴",
"clouds": 0,
"speed": 1.83,
"deg": 356,
"visibility": 10000
}, {
"dt": 1726952400,
"time": "2024-09-21 21:00:00",
"temp": 290.19,
"pressure": 1010,
"humidity": 48,
"weather": "晴",
"clouds": 0,
"speed": 1.94,
"deg": 346,
"visibility": 10000
}, {
"dt": 1726963200,
"time": "2024-09-22 00:00:00",
"temp": 291.67,
"pressure": 1012,
"humidity": 36,
"weather": "晴",
"clouds": 0,
"speed": 2.56,
"deg": 350,
"visibility": 10000
}, {
"dt": 1726974000,
"time": "2024-09-22 03:00:00",
"temp": 297.87,
"pressure": 1011,
"humidity": 20,
"weather": "晴",
"clouds": 0,
"speed": 2.25,
"deg": 358,
"visibility": 10000
}]
}