![]() 0.1℃ 晴 |
|
风向风速:西风1级 |
|
相对湿度:42% |
|
空气质量:22优 |
http协议:
国内大陆优化(支持ipv6)http://api.ipshudi.com/weather/
国际各洲覆盖(部份ipv6)http://api.ip138.com/weather/
https协议:
国内大陆优化(支持ipv6)https://api.ipshudi.com/weather/
国际各洲覆盖(部份ipv6)https://api.ip138.com/weather/
get
参数说明:
1. code string 行政区划代码 (可选)
2. ip string iP地址 (可选,默认为请求iP,仅当用户没有提供行政区划代码时有效)
3. callback string 回调函数(可选,默认为空)
4. token string 购买服务后会提供(必填)
5. type int 查询类型 1:今日天气 7:一周天气 (默认今日天气)
6. style int 天气icon样式 1|2|3
| 样式1 | 样式2 | 样式3 |
|---|---|---|
|
|
|
curl "https://api.ip138.com/weather/?code=350229&callback=find&type=1" -H "token:cc87f3c77747bccbaaee35006da1ebb65e0bad57"
参数说明:
1. code string 行政区划代码 (可选)
2. ip string iP地址 (可选,默认为请求iP,仅当用户没有提供行政区划代码时有效)
3. callback string 回调函数(可选,默认为空)
4. token string 购买服务后会提供(必填)
5. type int 查询类型 1:今日天气 7:一周天气 (默认今日天气)
6. style int 天气icon样式 1|2|3
https://api.ip138.com/weather/?code=350229&type=1&callback=find&token=cc87f3c77747bccbaaee35006da1ebb65e0bad57
参数说明:
1. code string 行政区划代码 (可选)
2. ip string iP地址 (可选,默认为请求iP,仅当用户没有提供行政区划代码时有效)
3. callback string 回调函数 当前参数仅为jsonp格式数据提供(可选,默认为空)
4. type int 查询类型 1:今日天气 7:一周天气 (默认今日天气)
5. style int 天气icon样式 1|2|3
6. time string 时间戳(必填)
7. oid string 购买服务后提供(必填)
8. mid string 购买服务后提供(必填)
9. sign string 签名验证 (签名算法:md5("time=" + time + "&token=" + token))(必填)
https://api.ip138.com/weather/?code=350229&callback=find&time=20170102&oid={oid}&mid={mid}&sign=签名算法
选择获取行政区划代码:
说明:ret 值为 ok 时 返回data查询结果数据 为err时返回msg错误信息
{
"ret": "ok", // ret 值为 ok 时 返回 data 数据 为err时返回msg数据
"code": "350103", // 行政区划代码
"province":"福建省",
"city":"福州市",
"area":"台江区",
"data": [
time:"14:20", //更新时间
dayIcon:"http://p.abcache.com/ip138/image/tianqi1/d00.png", //天气图标
dayWeather:"晴转多云", //白天天气
dayTemp:"18", //白天温度
dayWind:"微风", //白天风力
"nightIcon":"http://p.abcache.com/ip138/image/tianqi1/n01.png", //天气图标
nightWeather:"中度霾转多云", //夜晚天气
nightTemp:"9", //夜晚温度
nightWind:"微风", //夜晚风力
temp"9", //实时温度
"Icon":"http://p.abcache.com/ip138/image/tianqi1/d00.png" //天气图标
weather:"多云", //实时天气
wind:"北风1级", //实时风力
humidity:"82" //湿度
pm25:11 //pm
]
}
https://api.ip138.com/status/
get
1. token `string`
https://api.ip138.com/status/?token=cc87f3c77747bccbaaee35006da1ebb65e0bad57
{
"ret":"ok",
"data":{
"reqs":10, //当前小时请求数
"hour":3000, //当前小时购买次数
"package":19767 //配额次数
}
}