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为详细的错误码。

© All Rights Reserved            updated 2024-08-23 10:14:55

results matching ""

    No results matching ""