稳定、快速、免费的 API 接口服务
正式使用请在个人中心获取apikey并填写白名单
获取当日天气信息,来源于中国气象局官方数据
接口地址: https://api.pupp.top/api/weather
返回格式: JSON
请求方式: GET
请求示例: https://api.pupp.top/api/weather?type=ip&ip=221.231.39.67 | https://api.pupp.top/api/weather?type=place&sheng=江苏&place=滨海
请求参数说明:
| 名称 | 必填 | 类型 | 示例 | 说明 |
|---|---|---|---|---|
| type | 否 | string | ip | 查询类型(ip | place),默认不填为ip方式查询 |
| ip | 否 | string | 221.231.39.67 | 要查询的ip |
| sheng | 是 | string | 江苏 | 要查询的省份名称,地点(place)方式查询必填,ip方式不填 |
| place | 是 | string | 滨海 | 要查询的地点,城市或区县级名称,地点(place)方式查询必填,ip方式不填 |
返回参数说明:
| 名称 | 类型 | 说明 |
|---|---|---|
| precipitation | string | 降水量 |
| temperature | string | 温度 |
| pressure | string | 气压 |
| humidity | string | 湿度 |
| windDirection | string | 风向 |
| windDirectionDegree | string | 风向度 |
| windSpeed | string | 风速 |
| windScale | string | 风速描述 |
| place | string | 查询到的地区 |
| ip | string | 返回IP地址 |
| weather1 | string | 当日天气1,例如晴转多云,那么里面的晴就是当日天气1 |
| weather2 | string | 当日天气2,例如晴转多云,那么里面的多云就是当日天气2 |
返回示例:
{
"code": 200,
"msg": "success",
"data": {
"precipitation": 0,
"temperature": 10.9,
"pressure": 1019,
"humidity": 28,
"windDirection": "西北风",
"windDirectionDegree": 348,
"windSpeed": 1.7,
"windScale": "微风",
"place": "中国, 江苏, 滨海",
"weather1": "晴",
"weather2": "晴"
}
}
请求参数设置:
| 参数名称 | 参数值 |
|---|---|
{
"code": 200,
"msg": "success",
"data": {
"precipitation": 0,
"temperature": 10.9,
"pressure": 1019,
"humidity": 28,
"windDirection": "西北风",
"windDirectionDegree": 348,
"windSpeed": 1.7,
"windScale": "微风",
"place": "中国, 江苏, 滨海",
"weather1": "晴",
"weather2": "晴"
}
}
错误码格式说明:
| 名称 | 类型 | 说明 |
|---|
代码示例: