全球天气预报5天-经纬度版免费API接口教程

devtools/2024/11/23 7:08:51/

接口简介:
获取全球任意地区未来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
}]
}

参考资料(版权):
https://www.apihz.cn/api/tianqitqybjw5.html


http://www.ppmy.cn/devtools/136230.html

相关文章

vue3 + elementPlus 日期时间选择器禁用未来及过去时间

<el-date-pickerv-model"form.jyTime"type"datetime"placeholder"请选择加油时间"format"YYYY/MM/DD HH:mm:ss"value-format"YYYY-MM-DD HH:mm:ss":disabled-date"disabledDate"/> 一、禁用未来时间 /** 时…

Docker核心概念总结

本文只是对 Docker 的概念做了较为详细的介绍&#xff0c;并不涉及一些像 Docker 环境的安装以及 Docker 的一些常见操作和命令。 容器介绍 Docker 是世界领先的软件容器平台&#xff0c;所以想要搞懂 Docker 的概念我们必须先从容器开始说起。 什么是容器? 先来看看容器较为…

c++11的动态类型

c17引入了any 和 variant&#xff0c;可以将任意数据类型统一用any或variant类型表示&#xff0c;在开发中还是能够带来很多便利的。在c11版本中&#xff0c;可以用下面这个例子&#xff0c;仿照实现一个Any类型。 #include <iostream> #include <memory>class An…

JavaEE 重要的API阅读

JavaEE API阅读 目的是为了应对学校考试&#xff0c;主要关注的是类的继承关系、抛出错误的类型、包名、包结构等等知识。此帖用于记录。 PageContext抽象类 包名及继承关系 继承自JspContext类。PageContext 实例提供对与某个 JSP 页⾯关联的所有名称空间的访问&#xff0…

【Git】工作区、暂存区和版本库

目录 一、基本概念&#xff1a; 关系图&#xff1a; 1. 工作区&#xff08;Working Directory&#xff09; $ 1.1 工作区功能 $ 1.2 工作区特点 2. 暂存区&#xff08;Staging Area&#xff09; $ 2.1 暂存区功能 $ 2.2 暂存区特点 $ 2.3 常用命令 3. 版本库&#xff08…

完全竞争市场

企业收益、市场结构和利润最大化 企业收益 企业收益 R P*Q P(Q)*Q平均收益 AR R/Q P(Q)边际收益 MRdR/dQdP(Q)/dQ*QP(Q) 注意&#xff1a; 企业在市场中的地位&#xff08;市场份额&#xff09;市场需求” 指的是对某个市场上全部产品的需求&#xff0c;取决于消费者的…

基于SpringBoot实现的在线课程管理系统(代码+论文)

&#x1f389;博主介绍&#xff1a;Java领域优质创作者&#xff0c;阿里云博客专家&#xff0c;计算机毕设实战导师。专注Java项目实战、毕设定制/协助 &#x1f4e2;主要服务内容&#xff1a;选题定题、开题报告、任务书、程序开发、项目定制、论文辅导 &#x1f496;精彩专栏…

硬件防火墙和软件防火墙的区别有哪些?

在网络安全领域当中&#xff0c;防火墙是保护网络不会受到潜在威胁的第一道防线&#xff0c;其中最为常见的就是硬件防火墙和软件防火墙两种类型&#xff0c;主要的功能就是为了保护网络安全&#xff0c;但两者在部署和管理多种方面上还是有着显著的区别。 软件防火墙就是指装在…