> 该接口2小时更新一次,支持全球6000多个城市和地区,返回最近7日天气,包含基本天气信息、每日小时天气,可按地名、城市编号、IP查询。 > 详细文档请打开官方文档:https://tianqiapi.com/index/doc?version=v5 > 对接技术支持QQ:445899710 微信号:hype522147 | 地区权限 | 请求限制 | 使用方案 | 发票 | | --- | --- | --- | --- | | 国外6000+热门城市 | 每日10万次 | 365/一年(最低) | 1500/永久(最低) | 可提供普票、电子票、专票 | **请求方式及url:** * 请求方式:`GET` * 接口地址:`https://yiketianqi.com/api` **请求示例** `https://yiketianqi.com/api?version=v5&appid=85841439&appsecret=EKCDLT4I&city=堪培拉` **请求参数说明:** | 参数名 | 必选 | 类型 | 说明 | 备注(示例) | | --- | --- | --- | --- | --- | | appid | 是 | string | 用户appid | [注册开发账号](https://tianqiapi.com/user) | | appsecret | 是 | string | 用户appsecret | | | version | 是 | string | 接口版本标识 | 固定值:`v5`每个接口的version值都不一样 | | cityid | 否 | string | 城市ID | 请联系客服下载 | | city | 否 | string | 城市名称 | 例如: 堪培拉、纽约 | | ip | 否 | string | IP地址 | 查询IP所在城市天气 | | callback | 否 | string | jsonp参数 | 如:`jQuery.Callbacks` | | vue | 否 | string | 跨域参数 | 如果您使用的是react、vue、angular请填写值:`1` | **响应参数说明** | 参数名 | 类型 | 说明 | 备注 | | --- | --- | --- | --- | | cityid | String | 城市ID | | | update\_time | String | 气象台更新时间 | | | city | String | 城市名称 | 例如:纽约 | | cityEn | String | 城市英文名称 | 例如:New York | | country | String | 国家名称 | 例如:美国 | | countryEn | String | 国家英文名称 | 例如:United States | | data | String | 每日数据列表 | | |  ┗ date | String | 当前日期 | | |  ┗ wea | String | 天气情况 | 例如:晴 | |  ┗ wea\_img | String | 天气对应图标 | 固定9种类型(您也可以根据wea字段自己处理): xue、lei、shachen、wu、bingbao、yun、yu、yin、qing | |  ┗ tem1 | String | 白天温度 | 例如:18 | |  ┗ tem2 | String | 晚上温度 | 例如:-5 | |  ┗ win | String | 风向 | 例如:北风 | |  ┗ win\_speed | String | 风力 | 例如:3-4级 | |  ┗ hours | String | 小时预报 | | |       ┗ hours | String | 时间点 | 例如:20时 | |       ┗ wea | String | 天气 | | |       ┗ wea\_img | String | 天气图标 | | |       ┗ tem | String | 温度 | | |       ┗ win | String | 风向 | | |       ┗ win\_speed | String | 风力等级 | | **备注** cityid、city和ip参数3选一提交,如果不传,默认返回当前ip城市天气,cityid优先级最高。 **响应JSON** ~~~ { "cityid":"601020101", "city":"悉尼", #城市名称 "cityEn":"Sydney", #城市英文 "country":"澳大利亚", #国家 "countryEn":"Australia", #国家英文 "update_time":"2020-07-21 15:54:20", #更新时间 "data":[ #每日数据列表, 共7组 { "date":"2020-07-21", #日期 "wea":"小雨转多云", #天气情况 "wea_img":"yun", #天气情况图标 "tem1":"15", #白天温度(高温) "tem2":"10", #夜间温度(低温) "win":[ "西南风", #白天风向 "西南风" #夜间风向 ], "win_speed":"6-7级转<3级", #风力 "hours":[ #小时天气列表 { "hours":"21日07时", "wea":"多云", "wea_img":"yun", "tem":"9", "win":"西南风", "win_speed":"3-4级" }, { "hours":"21日10时", "wea":"多云", "wea_img":"yun", "tem":"14", "win":"西南风", "win_speed":"6-7级" }, { "hours":"21日13时", "wea":"小雨", "wea_img":"yu", "tem":"15", "win":"西南风", "win_speed":"3-4级" }, { "hours":"21日16时", "wea":"小雨", "wea_img":"yu", "tem":"14", "win":"西南风", "win_speed":"3-4级" }, { "hours":"21日19时", "wea":"晴", "wea_img":"qing", "tem":"13", "win":"南风", "win_speed":"<3级" }, { "hours":"21日22时", "wea":"晴", "wea_img":"qing", "tem":"12", "win":"西南风", "win_speed":"<3级" }, { "hours":"22日01时", "wea":"多云", "wea_img":"yun", "tem":"11", "win":"西南风", "win_speed":"<3级" }, { "hours":"22日04时", "wea":"晴", "wea_img":"qing", "tem":"10", "win":"西南风", "win_speed":"<3级" } ] }, { "date":"2020-07-22", "wea":"多云转小雨", "wea_img":"yun", "tem1":"15", "tem2":"9", "win":[ "西南风", "南风" ], "win_speed":"<3级", "hours":[ { "hours":"22日07时", "wea":"晴", "wea_img":"qing", "tem":"10", "win":"西南风", "win_speed":"<3级" }, { "hours":"22日10时", "wea":"多云", "wea_img":"yun", "tem":"13", "win":"西南风", "win_speed":"<3级" }, { "hours":"22日13时", "wea":"多云", "wea_img":"yun", "tem":"15", "win":"西南风", "win_speed":"<3级" }, { "hours":"22日16时", "wea":"晴", "wea_img":"qing", "tem":"15", "win":"东风", "win_speed":"<3级" }, { "hours":"22日19时", "wea":"晴", "wea_img":"qing", "tem":"13", "win":"东北风", "win_speed":"<3级" }, { "hours":"22日22时", "wea":"多云", "wea_img":"yun", "tem":"12", "win":"南风", "win_speed":"<3级" }, { "hours":"23日01时", "wea":"小雨", "wea_img":"yu", "tem":"10", "win":"南风", "win_speed":"<3级" }, { "hours":"23日04时", "wea":"小雨", "wea_img":"yu", "tem":"9", "win":"南风", "win_speed":"<3级" } ] }, { "date":"2020-07-23", "wea":"小雨", "wea_img":"yu", "tem1":"14", "tem2":"8", "win":[ "东北风", "北风" ], "win_speed":"<3级", "hours":[ { "hours":"23日07时", "wea":"小雨", "wea_img":"yu", "tem":"10", "win":"南风", "win_speed":"<3级" }, { "hours":"23日10时", "wea":"小雨", "wea_img":"yu", "tem":"13", "win":"西南风", "win_speed":"<3级" }, { "hours":"23日13时", "wea":"小雨", "wea_img":"yu", "tem":"14", "win":"东南风", "win_speed":"<3级" }, { "hours":"23日16时", "wea":"小雨", "wea_img":"yu", "tem":"14", "win":"东风", "win_speed":"<3级" }, { "hours":"23日19时", "wea":"多云", "wea_img":"yun", "tem":"13", "win":"东北风", "win_speed":"<3级" }, { "hours":"23日22时", "wea":"小雨", "wea_img":"yu", "tem":"12", "win":"东北风", "win_speed":"<3级" }, { "hours":"24日01时", "wea":"小雨", "wea_img":"yu", "tem":"10", "win":"北风", "win_speed":"<3级" }, { "hours":"24日04时", "wea":"小雨", "wea_img":"yu", "tem":"9", "win":"北风", "win_speed":"<3级" } ] }, { "date":"2020-07-24", "wea":"小雨", "wea_img":"yu", "tem1":"17", "tem2":"8", "win":[ "北风", "北风" ], "win_speed":"<3级", "hours":[ { "hours":"24日07时", "wea":"小雨", "wea_img":"yu", "tem":"9", "win":"西北风", "win_speed":"<3级" }, { "hours":"24日10时", "wea":"小雨", "wea_img":"yu", "tem":"14", "win":"西北风", "win_speed":"<3级" }, { "hours":"24日16时", "wea":"晴", "wea_img":"qing", "tem":"16", "win":"东北风", "win_speed":"<3级" }, { "hours":"24日22时", "wea":"小雨", "wea_img":"yu", "tem":"13", "win":"北风", "win_speed":"<3级" }, { "hours":"25日04时", "wea":"小雨", "wea_img":"yu", "tem":"9", "win":"北风", "win_speed":"<3级" } ] }, { "date":"2020-07-25", "wea":"小雨", "wea_img":"yu", "tem1":"18", "tem2":"9", "win":[ "东北风", "东风" ], "win_speed":"<3级转3-4级", "hours":[ { "hours":"25日10时", "wea":"小雨", "wea_img":"yu", "tem":"13", "win":"北风", "win_speed":"<3级" }, { "hours":"25日16时", "wea":"小雨", "wea_img":"yu", "tem":"18", "win":"东北风", "win_speed":"<3级" }, { "hours":"25日22时", "wea":"小雨", "wea_img":"yu", "tem":"13", "win":"东风", "win_speed":"<3级" }, { "hours":"26日04时", "wea":"小雨", "wea_img":"yu", "tem":"10", "win":"东南风", "win_speed":"<3级" } ] }, { "date":"2020-07-26", "wea":"小雨转中雨", "wea_img":"yu", "tem1":"17", "tem2":"12", "win":[ "东南风", "西南风" ], "win_speed":"3-4级转6-7级", "hours":[ { "hours":"26日10时", "wea":"中雨", "wea_img":"yu", "tem":"12", "win":"东风", "win_speed":"3-4级" }, { "hours":"26日16时", "wea":"小雨", "wea_img":"yu", "tem":"17", "win":"东南风", "win_speed":"3-4级" }, { "hours":"26日22时", "wea":"小雨", "wea_img":"yu", "tem":"15", "win":"东南风", "win_speed":"3-4级" }, { "hours":"27日04时", "wea":"中雨", "wea_img":"yu", "tem":"13", "win":"南风", "win_speed":"5-6级" } ] }, { "date":"2020-07-27", "wea":"小雨", "wea_img":"yu", "tem1":"18", "tem2":"10", "win":[ "西南风", "西风" ], "win_speed":"5-6级转4-5级", "hours":[ { "hours":"27日10时", "wea":"中雨", "wea_img":"yu", "tem":"16", "win":"西南风", "win_speed":"6-7级" }, { "hours":"27日16时", "wea":"中雨", "wea_img":"yu", "tem":"16", "win":"西南风", "win_speed":"5-6级" }, { "hours":"27日22时", "wea":"小雨", "wea_img":"yu", "tem":"13", "win":"西南风", "win_speed":"5-6级" }, { "hours":"28日04时", "wea":"小雨", "wea_img":"yu", "tem":"10", "win":"西风", "win_speed":"4-5级" } ] } ] } ~~~