1. 获取某项目所在地区的天气数据
获取某项目所在地区的天气数据
注意
- 如果接口需要提供auth-token,你需要通过轻筑开放平台创建应用来获取appid和secret,然后通过appid和secret来获取接口访问凭证auth-token。
- 如果需要获取当前用户的使用信息,授权确保你能获取到qzcode,然后通过
网页授权
接口获取相关信息。
1.1. 基本信息
概况 | 内容 |
---|---|
接口地址 | /api/platform/weather/getOneDayWeatherDetail |
请求方法 | GET |
请求数据类型 | URL参数 |
响应数据类型 | JSON |
1.2. 请求数据
1.2.1. 请求头(request-header)
请求头除了默认的参数还需要添加如下请求头参数:
字段 | 描述 |
---|---|
auth-token | 接口访问凭据,你可以通过平台下发的appid和secret获取凭据 |
1.2.2. 请求参数(request-parameter)
字段 | 是否必传 | 描述 |
---|---|---|
projectId | 是 | 项目id |
date | 否 | 日期参数(格式为yyyyMMdd) |
参数请求示例:
http://api.example.com/xxx?key=value
1.3. 响应数据
响应数据中 code, message, data 为默认字段,所有字段如下表所示:
字段 | 类型 | 是否必填 | 描述 |
---|---|---|---|
code | number | 是 | |
message | string | 是 | |
data | object | 是 | |
now | object | 是 | |
temperature_time | string | 是 | |
sd | string | 是 | |
rain | string | 是 | |
aqi | string | 是 | |
weather | string | 是 | |
temperature | string | 是 | |
aqiDetail | object | 是 | |
area | string | 是 | |
no2 | string | 是 | |
o3 | string | 是 | |
num | string | 是 | |
so2 | string | 是 | |
pm2_5 | string | 是 | |
aqi | string | 是 | |
pm10 | string | 是 | |
primary_pollutant | string | 是 | |
co | string | 是 | |
quality | string | 是 | |
o3_8h | string | 是 | |
wind_direction | string | 是 | |
weather_pic | string | 是 | |
weather_code | string | 是 | |
wind_power | string | 是 | |
cityInfo | object | 是 | |
c11 | string | 是 | |
c10 | string | 是 | |
c12 | string | 是 | |
c15 | string | 是 | |
latitude | number | 是 | |
c17 | string | 是 | |
c16 | string | 是 | |
c0 | string | 是 | |
c1 | string | 是 | |
c2 | string | 是 | |
c3 | string | 是 | |
c4 | string | 是 | |
c5 | string | 是 | |
c6 | string | 是 | |
c7 | string | 是 | |
c8 | string | 是 | |
c9 | string | 是 | |
longitude | number | 是 | |
f1 | object | 是 | |
jiangshui | string | 是 | |
air_press | string | 是 | |
weekday | number | 是 | |
night_wind_direction | string | 是 | |
night_air_temperature | string | 是 | |
night_weather_pic | string | 是 | |
night_weather_code | string | 是 | |
night_weather | string | 是 | |
day_weather_code | string | 是 | |
ziwaixian | string | 是 | |
day_weather | string | 是 | |
day_wind_power | string | 是 | |
day_weather_pic | string | 是 | |
day_wind_direction | string | 是 | |
day_air_temperature | string | 是 | |
night_wind_power | string | 是 | |
sun_begin_end | string | 是 | |
day | string | 是 | |
time | string | 是 | |
f2 | object | 是 | |
jiangshui | string | 是 | |
air_press | string | 是 | |
weekday | number | 是 | |
night_wind_direction | string | 是 | |
night_air_temperature | string | 是 | |
night_weather_pic | string | 是 | |
night_weather_code | string | 是 | |
night_weather | string | 是 | |
day_weather_code | string | 是 | |
ziwaixian | string | 是 | |
day_weather | string | 是 | |
day_wind_power | string | 是 | |
day_weather_pic | string | 是 | |
day_wind_direction | string | 是 | |
day_air_temperature | string | 是 | |
night_wind_power | string | 是 | |
sun_begin_end | string | 是 | |
day | string | 是 | |
ret_code | number | 是 | |
f3 | object | 是 | |
jiangshui | string | 是 | |
air_press | string | 是 | |
weekday | number | 是 | |
night_wind_direction | string | 是 | |
night_air_temperature | string | 是 | |
night_weather_pic | string | 是 | |
night_weather_code | string | 是 | |
night_weather | string | 是 | |
day_weather_code | string | 是 | |
ziwaixian | string | 是 | |
day_weather | string | 是 | |
day_wind_power | string | 是 | |
day_weather_pic | string | 是 | |
day_wind_direction | string | 是 | |
day_air_temperature | string | 是 | |
night_wind_power | string | 是 | |
sun_begin_end | string | 是 | |
day | string | 是 |
响应数据结构如下所示:
{
"code": 0,
"message": null,
"data": {
"now": {
"temperature_time": "11:30",
"sd": "76%",
"rain": "0.0",
"aqi": "51",
"weather": "多云",
"temperature": "11",
"aqiDetail": {
"area": "重庆",
"no2": "36",
"o3": "11",
"num": "62",
"so2": "12",
"pm2_5": "35",
"aqi": "51",
"pm10": "52",
"primary_pollutant": "颗粒物(PM10)",
"co": "0.8",
"quality": "良好",
"o3_8h": "12"
},
"wind_direction": "东北风",
"weather_pic": "http://xxxxxxxxxxxx",
"weather_code": "01",
"wind_power": "2级"
},
"cityInfo": {
"c11": "023",
"c10": "3",
"c12": "401220",
"c15": "379",
"latitude": 29.972,
"c17": "+8",
"c16": "AZ9230",
"c0": "500115",
"c1": "101041000",
"c2": "changshou",
"c3": "长寿",
"c4": "chongqing",
"c5": "重庆",
"c6": "chongqing",
"c7": "重庆",
"c8": "china",
"c9": "中国",
"longitude": 107.148
},
"f1": {
"jiangshui": "22%",
"air_press": "971.8hPa",
"weekday": 2,
"night_wind_direction": "东北风",
"night_air_temperature": "9",
"night_weather_pic": "http://xxxxxxxxxxxx",
"night_weather_code": "02",
"night_weather": "阴",
"day_weather_code": "02",
"ziwaixian": "最弱",
"day_weather": "阴",
"day_wind_power": "0-3级 <5.4m/s",
"day_weather_pic": "http://xxxxxxxxxxxx",
"day_wind_direction": "东北风",
"day_air_temperature": "13",
"night_wind_power": "0-3级 <5.4m/s",
"sun_begin_end": "07:38|17:53",
"day": "20211214"
},
"time": "20211214073000",
"f2": {
"jiangshui": "72%",
"air_press": "971.2hPa",
"weekday": 3,
"night_wind_direction": "西南风",
"night_air_temperature": "10",
"night_weather_pic": "http://xxxxxxxxxxxx",
"night_weather_code": "07",
"night_weather": "小雨",
"day_weather_code": "07",
"ziwaixian": "最弱",
"day_weather": "小雨",
"day_wind_power": "0-3级 <5.4m/s",
"day_weather_pic": "http://xxxxxxxxxxxx",
"day_wind_direction": "西北风",
"day_air_temperature": "12",
"night_wind_power": "0-3级 <5.4m/s",
"sun_begin_end": "07:38|17:53",
"day": "20211215"
},
"ret_code": 0,
"f3": {
"jiangshui": "75%",
"air_press": "974.8hPa",
"weekday": 4,
"night_wind_direction": "东北风",
"night_air_temperature": "8",
"night_weather_pic": "http://xxxxxxxxxxxx",
"night_weather_code": "07",
"night_weather": "小雨",
"day_weather_code": "07",
"ziwaixian": "最弱",
"day_weather": "小雨",
"day_wind_power": "0-3级 <5.4m/s",
"day_weather_pic": "http://xxxxxxxxxxxx",
"day_wind_direction": "西南风",
"day_air_temperature": "10",
"night_wind_power": "0-3级 <5.4m/s",
"sun_begin_end": "07:39|17:54",
"day": "20211216"
}
}
}
1.4. 错误码
当返回数据中的 code 不为 0 时,为错误返回。其中errCode为详细的错误码。