接口调用地址
线路类型一 [普通集群负载-IP接口]
说明:直接访问 https://api.apihz.cn/getapi.php 获取当前最优IP接口地址。由普通负载集群服务器组成,通过IP接口地址调用,如果单个服务器过载可自行切换IP接口地址尝试其他负载服务器。IP并非永久固定且容易遭受攻击,平台可能不定期更换。
线路类型二 [普通集群负载-域名接口]
说明:域名接口会自动分发请求到普通集群服务器均衡负载,该域名TTL值为60秒,表示你的请求会每60秒实现自动轮换负载服务器,但也可能因你的网络服务商存在DNS缓存造成短时间内无法自动切换负载。如果某个负载服务器出现故障,也可能会造成个别地区存在一定时间的故障期。
线路类型三 [VIP集群负载-VIP线路接口]
说明:VIP专线在普通集群组的基础上额外增加独享大带宽集群组,每次请求自动均衡负载,自动故障切换,抗攻击,全球智能CDN加速。超高稳定性!最低30¥/月,彩钻以上会员专属,登录后购买。注:VIP线路是指调用接口的线路更有保障以及每分钟拥有更高的调用频次等,并非收费接口包月使用。
请求示例
[GET]请求示例:(请登录后使用自己的KEY独享频次)
复制参数 复制全部
[POST]请求示例:(请根据开发语言自行POST,参考【GET/POST教程】,或下载【超级客户端】调试。)
请求参数说明
注意:请求编码为UTF8,否则带中文请求可能失败。一般参数不能带+号,会被自动替换为空格。参数内容较大的必须用POST,不能GET。
提示:如发现接口有BUG,可加服务QQ群及时向我们反馈。
提示:请求参数里的开发者ID与KEY,登录后台菜单【个人资料】里查看。
名称参数必填说明
开发者IDid是用户中心的数字ID,例:id=10000000
开发者KEYkey是用户中心通讯秘钥,例:key=15he5h15ty854j5sr152hs2
IP地址ip否要查询的IP地址,如果为空则默认接口请求IP。例:ip=49.234.56.78
动态秘钥dkey否开发者开启动态秘钥验证后需传此参数,主要针对直接在客户端调用接口的场景。请在官网后台菜单【个人资料】里配置。例:dkey=0cd2a494831736587c33f30d1e544371
用户IPuip否接口调用者IP,用于后台统计IP地域分布,ISP运营商,时段IP数统计等,如不传该参数则默认为接口请求端IP,该参数主要用于使用后端服务器/中间件请求接口的方式使用。例:uip=123.123.123.123。该参数彩钻/炫钻/焱钻会员专享。
返回参数说明
名称参数说明
状态码code200成功,400错误
消息内容msg信息提示。
省级名称province返回查询的省级名称。
市级名称getcity返回查询的市级名称。
地区名称county返回查询的区县级地区名称。
查询IPip返回查询的IP地址。
数据集data天气信息数据集。
空气质量等级data.aqi_level空气质量等级,暂无用。
空气质量描述data.aqi_name空气质量描述,暂无用。
空气质量链接data.aqi_url空气质量详情链接,暂无用。
白天天气data.day_weather白天天气。
白天天气代码data.day_weather_code白天天气代码。
白天天气data.day_weather_short白天天气。
白天天气链接data.day_weather_url白天天气链接,暂无用。
白天风向描述data.day_wind_direction白天风向描述。
白天风向代码data.day_wind_direction_code白天风向代码。
白天风力等级data.day_wind_power白天风力等级。
白天风力等级代码data.day_wind_power_code白天风力等级代码,暂无用。
白天最高气温data.max_degree白天最高气温。
白天最低气温data.min_degree白天最低气温。
夜间天气data.night_weather夜间天气。
夜间天气代码data.night_weather_code夜间天气代码。
夜间天气data.night_weather_short夜间天气。
夜间天气链接data.night_weather_url夜间天气链接,暂无用。
夜间风向data.night_wind_direction夜间风向。
夜间风向代码data.night_wind_direction_code夜间风向代码。
夜间风力等级data.night_wind_power夜间风力等级。
夜间风力等级代码data.night_wind_power_code夜间风力等级代码。
天气预报时间data.time天气预报时间。
返回数据示例
示例:{"code":400,"msg":"通讯秘钥错误。"}
示例:
{
	"code": 200,
	"province": "上海",
	"getcity": "上海",
	"county": "上海",
	"ip": "49.234.56.78",
	"data": [{
		"aqi_level": 0,
		"aqi_name": "",
		"aqi_url": "",
		"day_weather": "多云",
		"day_weather_code": "01",
		"day_weather_short": "多云",
		"day_weather_url": "",
		"day_wind_direction": "西风",
		"day_wind_direction_code": "6",
		"day_wind_power": "1-3",
		"day_wind_power_code": "0",
		"max_degree": "20",
		"min_degree": "15",
		"night_weather": "阴",
		"night_weather_code": "02",
		"night_weather_short": "阴",
		"night_weather_url": "",
		"night_wind_direction": "微风",
		"night_wind_direction_code": "0",
		"night_wind_power": "1-3",
		"night_wind_power_code": "0",
		"time": "2024-10-29"
	}, {
		"aqi_level": 0,
		"aqi_name": "",
		"aqi_url": "",
		"day_weather": "多云",
		"day_weather_code": "01",
		"day_weather_short": "多云",
		"day_weather_url": "",
		"day_wind_direction": "微风",
		"day_wind_direction_code": "0",
		"day_wind_power": "1-3",
		"day_wind_power_code": "0",
		"max_degree": "22",
		"min_degree": "17",
		"night_weather": "阴",
		"night_weather_code": "02",
		"night_weather_short": "阴",
		"night_weather_url": "",
		"night_wind_direction": "微风",
		"night_wind_direction_code": "0",
		"night_wind_power": "1-3",
		"night_wind_power_code": "0",
		"time": "2024-10-30"
	}, {
		"aqi_level": 0,
		"aqi_name": "",
		"aqi_url": "",
		"day_weather": "中雨",
		"day_weather_code": "08",
		"day_weather_short": "中雨",
		"day_weather_url": "",
		"day_wind_direction": "微风",
		"day_wind_direction_code": "0",
		"day_wind_power": "1-3",
		"day_wind_power_code": "0",
		"max_degree": "22",
		"min_degree": "18",
		"night_weather": "大雨",
		"night_weather_code": "09",
		"night_weather_short": "大雨",
		"night_weather_url": "",
		"night_wind_direction": "微风",
		"night_wind_direction_code": "0",
		"night_wind_power": "1-3",
		"night_wind_power_code": "0",
		"time": "2024-10-31"
	}, {
		"aqi_level": 0,
		"aqi_name": "",
		"aqi_url": "",
		"day_weather": "大暴雨",
		"day_weather_code": "11",
		"day_weather_short": "暴雨",
		"day_weather_url": "",
		"day_wind_direction": "微风",
		"day_wind_direction_code": "0",
		"day_wind_power": "1-3",
		"day_wind_power_code": "0",
		"max_degree": "20",
		"min_degree": "17",
		"night_weather": "小雨",
		"night_weather_code": "07",
		"night_weather_short": "小雨",
		"night_weather_url": "",
		"night_wind_direction": "微风",
		"night_wind_direction_code": "0",
		"night_wind_power": "1-3",
		"night_wind_power_code": "0",
		"time": "2024-11-01"
	}, {
		"aqi_level": 0,
		"aqi_name": "",
		"aqi_url": "",
		"day_weather": "晴",
		"day_weather_code": "00",
		"day_weather_short": "晴",
		"day_weather_url": "",
		"day_wind_direction": "微风",
		"day_wind_direction_code": "0",
		"day_wind_power": "1-3",
		"day_wind_power_code": "0",
		"max_degree": "20",
		"min_degree": "16",
		"night_weather": "晴",
		"night_weather_code": "00",
		"night_weather_short": "晴",
		"night_weather_url": "",
		"night_wind_direction": "微风",
		"night_wind_direction_code": "0",
		"night_wind_power": "1-3",
		"night_wind_power_code": "0",
		"time": "2024-11-02"
	}, {
		"aqi_level": 0,
		"aqi_name": "",
		"aqi_url": "",
		"day_weather": "多云",
		"day_weather_code": "01",
		"day_weather_short": "多云",
		"day_weather_url": "",
		"day_wind_direction": "微风",
		"day_wind_direction_code": "0",
		"day_wind_power": "1-3",
		"day_wind_power_code": "0",
		"max_degree": "22",
		"min_degree": "15",
		"night_weather": "晴",
		"night_weather_code": "00",
		"night_weather_short": "晴",
		"night_weather_url": "",
		"night_wind_direction": "微风",
		"night_wind_direction_code": "0",
		"night_wind_power": "1-3",
		"night_wind_power_code": "0",
		"time": "2024-11-03"
	}, {
		"aqi_level": 0,
		"aqi_name": "",
		"aqi_url": "",
		"day_weather": "晴",
		"day_weather_code": "00",
		"day_weather_short": "晴",
		"day_weather_url": "",
		"day_wind_direction": "微风",
		"day_wind_direction_code": "0",
		"day_wind_power": "1-3",
		"day_wind_power_code": "0",
		"max_degree": "19",
		"min_degree": "13",
		"night_weather": "晴",
		"night_weather_code": "00",
		"night_weather_short": "晴",
		"night_weather_url": "",
		"night_wind_direction": "微风",
		"night_wind_direction_code": "0",
		"night_wind_power": "1-3",
		"night_wind_power_code": "0",
		"time": "2024-11-04"
	}, {
		"aqi_level": 0,
		"aqi_name": "",
		"aqi_url": "",
		"day_weather": "晴",
		"day_weather_code": "00",
		"day_weather_short": "晴",
		"day_weather_url": "",
		"day_wind_direction": "微风",
		"day_wind_direction_code": "0",
		"day_wind_power": "1-3",
		"day_wind_power_code": "0",
		"max_degree": "17",
		"min_degree": "12",
		"night_weather": "晴",
		"night_weather_code": "00",
		"night_weather_short": "晴",
		"night_weather_url": "",
		"night_wind_direction": "微风",
		"night_wind_direction_code": "0",
		"night_wind_power": "1-3",
		"night_wind_power_code": "0",
		"time": "2024-11-05"
	}]
}
更新记录