代码 | 说明 |
---|---|
ok | 数据正常 |
invalid key | 无效的key,请检查你的key是否输入以及是否输入有误 |
invalid key type | 你输入的key不适用于当前获取数据的方式,即SDK的KEY不能用于Web API或通过接口直接访问,反之亦然。 |
invalid param | 无效的参数,请检查你传递的参数是否正确、完整 |
bad bind | 错误的绑定,例如绑定的package name、bundle id或IP地址不一致的时候 |
no data for this location | 该城市/地区没有你所请求的数据 |
no more requests | 超过访问次数,需要等到当月最后一天24点(免费用户为当天24点)后进行访问次数的重置或升级你的访问量 |
no balance | 没有余额,你的按量计费产品由于余额不足或欠费而不能访问,请尽快充值 |
too fast | 超过限定的QPM |
dead | 无响应或超时 |
permission denied | 无访问权限 |
sign error | 签名错误 |
语言代码 | 语言名称 |
---|---|
zh zh-cn cn |
简体中文 |
zh-hk hk |
繁体中文 |
en | 英文 |
de | 德语 |
es | 西班牙语 |
fr | 法语 |
it | 意大利语 |
jp | 日语 |
kr | 韩语 |
ru | 俄语 |
in | 印度语 |
th | 泰语 |
本接口包含了3-7天天气预报、实况天气、逐小时天气预报以及生活指数,有对应权限的用户可通过访问此接口一次性获取某一地区的上述所有天气数据
- 普通用户通过此接口仅获得3天预报数据,认证个人开发者可获取7天预报和24小时内逐3小时预报数据,实况数据以及免费的生活指数,有权限的付费用户则可获得对应权限的全部数据
- 本集合接口中,生活指数仅限国内地区,如查询海外城市,则该数据字段将不提供
- 付费:https://api.heweather.net/s6/weather
- 免费:https://free-api.heweather.net/s6/weather
参数 | 描述 | 选择 | 示例值 |
---|---|---|---|
location | 需要查询的城市或地区,可输入以下值: 1. 城市ID: 2. 经纬度格式:经度,纬度(经度在前纬度在后,英文 , 分隔,十进制格式,北纬东经为正,南纬西经为负3. 城市名称,支持中英文和汉语拼音 4. 城市名称,上级城市 或 省 或 国家,英文 , 分隔,此方式可以在重名的情况下只获取想要的地区的天气数据,例如 西安,陕西5. IP 6. 根据请求自动判断,根据用户的请求获取IP,通过 IP 定位并获取城市数据 |
必选 | 1. location=CN101010100 2. location=116.40,39.9 3. location=北京、 location=北京市、 location=beijing 4. location=朝阳,北京、 location=chaoyang,beijing 5. location=60.194.130.1 6. location=auto_ip |
key | 用户认证key,请参考如何获取你的KEY | 必选 | key=xxxxxxxxxxxxxx |
lang | 多语言,默认为简体中文 | 可选 | lang=en |
unit | 单位选择,公制(m)或英制(i),默认为公制单位 | 可选 | unit=i |
https://free-api.heweather.net/s6/weather?location=beijing&key=d6cfdce8193445ba894d889e7ab2de5b
参数 | 描述 | 示例值 |
---|---|---|
location | 地区/城市名称 | 卓资 |
cid | 地区/城市ID | CN101080402 |
lat | 地区/城市纬度 | 40.89576 |
lon | 地区/城市经度 | 112.577702 |
parent_city | 该地区/城市的上级城市 | 乌兰察布 |
admin_area | 该地区/城市所属行政区域 | 内蒙古 |
cnty | 该地区/城市所属国家名称 | 中国 |
tz | 该地区/城市所在时区 | +8.0 |
参数 | 描述 | 示例值 |
---|---|---|
loc | 当地时间,24小时制,格式yyyy-MM-dd HH:mm | 2017-10-25 12:34 |
utc | UTC时间,24小时制,格式yyyy-MM-dd HH:mm | 2017-10-25 04:34 |
参数 | 描述 | 示例值 |
---|---|---|
date | 预报日期 | 2013-12-30 |
sr | 日出时间 | 07:36 |
ss | 日落时间 | 16:58 |
mr | 月升时间 | 04:47 |
ms | 月落时间 | 14:59 |
tmp_max | 最高温度 | 4 |
tmp_min | 最低温度 | -5 |
cond_code_d | 白天天气状况代码 | 100 |
cond_code_n | 晚间天气状况代码 | 100 |
cond_txt_d | 白天天气状况描述 | 晴 |
cond_txt_n | 晚间天气状况描述 | 晴 |
wind_deg | 风向360角度 | 310 |
wind_dir | 风向 | 西北风 |
wind_sc | 风力 | 1-2 |
wind_spd | 风速,公里/小时 | 14 |
hum | 相对湿度 | 37 |
pcpn | 降水量 | 0 |
pop | 降水概率 | 0 |
pres | 大气压强 | 1018 |
uv_index | 紫外线强度指数 | 3 |
vis | 能见度,单位:公里 | 10 |
参数 | 描述 | 示例 |
---|---|---|
fl | 体感温度,默认单位:摄氏度 | 23 |
tmp | 温度,默认单位:摄氏度 | 21 |
cond_code | 实况天气状况代码 | 100 |
cond_txt | 实况天气状况描述 | 晴 |
wind_deg | 风向360角度 | 305 |
wind_dir | 风向 | 西北 |
wind_sc | 风力 | 3-4 |
wind_spd | 风速,公里/小时 | 15 |
hum | 相对湿度 | 40 |
pcpn | 降水量 | 0 |
pres | 大气压强 | 1020 |
vis | 能见度,默认单位:公里 | 10 |
cloud | 云量 | 23 |
参数 | 描述 | 示例 |
---|---|---|
time | 预报时间,格式yyyy-MM-dd hh:mm | 2013-12-30 13:00 |
tmp | 温度 | 2 |
cond_code | 天气状况代码 | 101 |
cond_txt | 天气状况代码 | 多云 |
wind_deg | 风向360角度 | 290 |
wind_dir | 风向 | 西北 |
wind_sc | 风力 | 3-4 |
wind_spd | 风速,公里/小时 | 15 |
hum | 相对湿度 | 30 |
pres | 大气压强 | 1030 |
pop | 降水概率,百分比 | 30 |
dew | 露点温度 | 12 |
cloud | 云量 | 23 |
参数 | 描述 | 示例 |
---|---|---|
brf | 生活指数简介 | |
txt | 生活指数详细描述 | |
type | 生活指数类型 | comf:舒适度指数、 cw:洗车指数、 drsg:穿衣指数、 flu:感冒指数、 sport:运动指数、 trav:旅游指数、 uv:紫外线指数、 air:空气污染扩散条件指数、 ac:空调开启指数、 ag:过敏指数、 gl:太阳镜指数、 mu:化妆指数、 airc:晾晒指数、 ptfc:交通指数、 fsh:钓鱼指数、 spi:防晒指数 |
参数 | 描述 | 示例 |
---|---|---|
date | 预报日期 | 例如2017-12-30 |
brf | 生活指数简介 | |
txt | 生活指数详细描述 | |
type | 生活指数类型 | comf:舒适度指数、 cw:洗车指数、 drsg:穿衣指数、 flu:感冒指数、 sport:运动指数、 trav:旅游指数、 uv:紫外线指数、 air:空气污染扩散条件指数、 ac:空调开启指数、 ag:过敏指数、 gl:太阳镜指数、 mu:化妆指数、 airc:晾晒指数、 ptfc:交通指数、 fsh:钓鱼指数、 spi:防晒指数 |
参数 | 描述 | 示例值 |
---|---|---|
status | 接口状态码 | ok |
{
"HeWeather6": [
{
"basic": {
"cid": "CN101010100",
"location": "北京",
"parent_city": "北京",
"admin_area": "北京",
"cnty": "中国",
"lat": "39.90498734",
"lon": "116.4052887",
"tz": "+8.00"
},
"update": {
"loc": "2019-02-27 08:55",
"utc": "2019-02-27 00:55"
},
"status": "ok",
"now": {
"cloud": "5",
"cond_code": "100",
"cond_txt": "晴",
"fl": "1",
"hum": "43",
"pcpn": "0.0",
"pres": "1024",
"tmp": "4",
"vis": "7",
"wind_deg": "84",
"wind_dir": "东风",
"wind_sc": "2",
"wind_spd": "6"
},
"daily_forecast": [
{
"cond_code_d": "100",
"cond_code_n": "100",
"cond_txt_d": "晴",
"cond_txt_n": "晴",
"date": "2019-02-27",
"hum": "38",
"mr": "01:34",
"ms": "11:39",
"pcpn": "0.0",
"pop": "1",
"pres": "1016",
"sr": "06:49",
"ss": "18:04",
"tmp_max": "12",
"tmp_min": "-2",
"uv_index": "6",
"vis": "25",
"wind_deg": "222",
"wind_dir": "西南风",
"wind_sc": "1-2",
"wind_spd": "10"
},
{
"cond_code_d": "100",
"cond_code_n": "100",
"cond_txt_d": "晴",
"cond_txt_n": "晴",
"date": "2019-02-28",
"hum": "34",
"mr": "02:32",
"ms": "12:22",
"pcpn": "0.0",
"pop": "0",
"pres": "1018",
"sr": "06:48",
"ss": "18:06",
"tmp_max": "14",
"tmp_min": "0",
"uv_index": "5",
"vis": "25",
"wind_deg": "180",
"wind_dir": "南风",
"wind_sc": "1-2",
"wind_spd": "1"
},
{
"cond_code_d": "101",
"cond_code_n": "100",
"cond_txt_d": "多云",
"cond_txt_n": "晴",
"date": "2019-03-01",
"hum": "56",
"mr": "03:26",
"ms": "13:09",
"pcpn": "0.0",
"pop": "12",
"pres": "1017",
"sr": "06:46",
"ss": "18:07",
"tmp_max": "15",
"tmp_min": "1",
"uv_index": "5",
"vis": "25",
"wind_deg": "173",
"wind_dir": "南风",
"wind_sc": "1-2",
"wind_spd": "3"
},
{
"cond_code_d": "100",
"cond_code_n": "101",
"cond_txt_d": "晴",
"cond_txt_n": "多云",
"date": "2019-03-02",
"hum": "47",
"mr": "04:15",
"ms": "14:00",
"pcpn": "0.0",
"pop": "2",
"pres": "1009",
"sr": "06:45",
"ss": "18:08",
"tmp_max": "15",
"tmp_min": "2",
"uv_index": "5",
"vis": "25",
"wind_deg": "11",
"wind_dir": "东北风",
"wind_sc": "1-2",
"wind_spd": "8"
},
{
"cond_code_d": "101",
"cond_code_n": "101",
"cond_txt_d": "多云",
"cond_txt_n": "多云",
"date": "2019-03-03",
"hum": "60",
"mr": "04:59",
"ms": "14:54",
"pcpn": "0.0",
"pop": "2",
"pres": "1010",
"sr": "06:43",
"ss": "18:09",
"tmp_max": "14",
"tmp_min": "1",
"uv_index": "2",
"vis": "25",
"wind_deg": "182",
"wind_dir": "南风",
"wind_sc": "1-2",
"wind_spd": "4"
},
{
"cond_code_d": "101",
"cond_code_n": "101",
"cond_txt_d": "多云",
"cond_txt_n": "多云",
"date": "2019-03-04",
"hum": "49",
"mr": "05:38",
"ms": "15:50",
"pcpn": "0.0",
"pop": "7",
"pres": "1013",
"sr": "06:41",
"ss": "18:10",
"tmp_max": "14",
"tmp_min": "1",
"uv_index": "2",
"vis": "11",
"wind_deg": "226",
"wind_dir": "西南风",
"wind_sc": "1-2",
"wind_spd": "1"
},
{
"cond_code_d": "100",
"cond_code_n": "100",
"cond_txt_d": "晴",
"cond_txt_n": "晴",
"date": "2019-03-05",
"hum": "46",
"mr": "06:12",
"ms": "16:47",
"pcpn": "0.0",
"pop": "3",
"pres": "1016",
"sr": "06:40",
"ss": "18:11",
"tmp_max": "16",
"tmp_min": "1",
"uv_index": "4",
"vis": "24",
"wind_deg": "225",
"wind_dir": "西南风",
"wind_sc": "1-2",
"wind_spd": "3"
}
],
"hourly": [
{
"cloud": "2",
"cond_code": "100",
"cond_txt": "晴",
"dew": "-6",
"hum": "72",
"pop": "0",
"pres": "1025",
"time": "2019-02-27 10:00",
"tmp": "4",
"wind_deg": "100",
"wind_dir": "东风",
"wind_sc": "1-2",
"wind_spd": "2"
},
{
"cloud": "0",
"cond_code": "100",
"cond_txt": "晴",
"dew": "-8",
"hum": "54",
"pop": "0",
"pres": "1023",
"time": "2019-02-27 13:00",
"tmp": "9",
"wind_deg": "138",
"wind_dir": "东南风",
"wind_sc": "1-2",
"wind_spd": "3"
},
{
"cloud": "0",
"cond_code": "100",
"cond_txt": "晴",
"dew": "-7",
"hum": "58",
"pop": "0",
"pres": "1021",
"time": "2019-02-27 16:00",
"tmp": "10",
"wind_deg": "116",
"wind_dir": "东南风",
"wind_sc": "1-2",
"wind_spd": "4"
},
{
"cloud": "0",
"cond_code": "100",
"cond_txt": "晴",
"dew": "-7",
"hum": "80",
"pop": "0",
"pres": "1022",
"time": "2019-02-27 19:00",
"tmp": "6",
"wind_deg": "213",
"wind_dir": "西南风",
"wind_sc": "1-2",
"wind_spd": "7"
},
{
"cloud": "0",
"cond_code": "100",
"cond_txt": "晴",
"dew": "-6",
"hum": "92",
"pop": "0",
"pres": "1022",
"time": "2019-02-27 22:00",
"tmp": "2",
"wind_deg": "222",
"wind_dir": "西南风",
"wind_sc": "1-2",
"wind_spd": "7"
},
{
"cloud": "0",
"cond_code": "100",
"cond_txt": "晴",
"dew": "-6",
"hum": "94",
"pop": "0",
"pres": "1022",
"time": "2019-02-28 01:00",
"tmp": "0",
"wind_deg": "270",
"wind_dir": "西风",
"wind_sc": "1-2",
"wind_spd": "1"
},
{
"cloud": "3",
"cond_code": "100",
"cond_txt": "晴",
"dew": "-8",
"hum": "94",
"pop": "0",
"pres": "1022",
"time": "2019-02-28 04:00",
"tmp": "-1",
"wind_deg": "271",
"wind_dir": "西风",
"wind_sc": "1-2",
"wind_spd": "9"
},
{
"cloud": "2",
"cond_code": "100",
"cond_txt": "晴",
"dew": "-4",
"hum": "92",
"pop": "0",
"pres": "1022",
"time": "2019-02-28 07:00",
"tmp": "0",
"wind_deg": "268",
"wind_dir": "西风",
"wind_sc": "1-2",
"wind_spd": "9"
}
],
"lifestyle": [
{
"type": "comf",
"brf": "较舒适",
"txt": "白天虽然天气晴好,但早晚会感觉偏凉,午后舒适、宜人。"
},
{
"type": "drsg",
"brf": "较冷",
"txt": "建议着厚外套加毛衣等服装。年老体弱者宜着大衣、呢外套加羊毛衫。"
},
{
"type": "flu",
"brf": "较易发",
"txt": "昼夜温差较大,较易发生感冒,请适当增减衣服。体质较弱的朋友请注意防护。"
},
{
"type": "sport",
"brf": "较适宜",
"txt": "天气较好,无雨水困扰,较适宜进行各种运动,但因气温较低,在户外运动请注意增减衣物。"
},
{
"type": "trav",
"brf": "适宜",
"txt": "天气较好,温度适宜,是个好天气哦。这样的天气适宜旅游,您可以尽情地享受大自然的风光。"
},
{
"type": "uv",
"brf": "中等",
"txt": "属中等强度紫外线辐射天气,外出时建议涂擦SPF高于15、PA+的防晒护肤品,戴帽子、太阳镜。"
},
{
"type": "cw",
"brf": "较适宜",
"txt": "较适宜洗车,未来一天无雨,风力较小,擦洗一新的汽车至少能保持一天。"
},
{
"type": "air",
"brf": "较差",
"txt": "气象条件较不利于空气污染物稀释、扩散和清除,请适当减少室外活动时间。"
}
]
}
]
}