天气预报
https://v2.xxapi.cn/api/weather
接口描述
免费API提供准确的天气预报服务,支持获取全球各地的实时天气数据,帮助用户了解天气趋势,适用于应用开发、网站集成和个人使用。
请求参数
请求示例
var axios = require('axios')
var config = {
method: 'get',
url: 'https://v2.xxapi.cn/api/weather?city=枣庄滕州'
}
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data))
})
.catch(function (error) {
console.log(error)
})
axios
ajax
fetch
xhr
php
python
返回示例
{
"code": 200,
"msg": "数据请求成功",
"data": {
"city": "滕州市",
"data": [
{
"date": "周六",
"temperature": "4-24℃",
"weather": "多云",
"wind": "北风4-5级",
"air_quality": "轻度"
},
{
"date": "周日",
"temperature": "2-11℃",
"weather": "晴",
"wind": "北风4-5级",
"air_quality": "良"
},
{
"date": "周一",
"temperature": "5-18℃",
"weather": "晴",
"wind": "西南风4-5级",
"air_quality": "良"
},
{
"date": "周二",
"temperature": "10-23℃",
"weather": "多云",
"wind": "南风3-4级",
"air_quality": "良"
},
{
"date": "周三",
"temperature": "5-17℃",
"weather": "多云",
"wind": "东北风3-4级",
"air_quality": "良"
},
{
"date": "周四",
"temperature": "5-12℃",
"weather": "小雨",
"wind": "东风3-4级",
"air_quality": "良"
}
]
}
}