天天看點

獲得天氣相關接口三-查詢當天天氣

獲得了城市的編碼,即可根據編碼查詢所屬地區的天氣情況,這裡是查詢當天的天氣情況

接口路徑:

/weather/today
           

請求方式:GET

請求參數:

請求參數

參數名稱  參數類型 是否必須 說明
code string 城市編碼

傳回參數:

傳回參數

參數名稱 參數類型 是否必須 說明
code int 狀态碼,1為成功,其他失敗
msg string 傳回資訊
data object 傳回數組
.date string 查詢日期,當天
.city string 城市名稱
.city_en string 城市英文名
.update_time string 資訊最近更新時間
.real_time_temp 實時溫度
.weather 天氣
.weather_en 天氣,英文
.weather_code 天氣編碼
.weather_day_code 白天/夜晚代号  d 白天, n夜晚
.air_pressure 氣壓
.wind 風力
.wind_direction 風向
.humidity 濕度
.max_temp 最高溫度
.min_temp 最低溫度
.sunrise 日出時間
.sunset 日落時間
.weather_day 白天天氣
.weather_night 夜晚天氣
.air_quality 空氣品質指數
.air_quality_tip 空氣品質指數提醒
.index 指數部分
..dressing_index 穿衣指數
...index 指數
...tip 指導
..comfort_index 舒适度指數
...index 指數
...tip 指導
..fishing_index 釣魚指數
...index 指數
...tip 指導
..a_cold_index 感冒指數
...index 指數
...tip 指導
..dry_index 幹燥指數
...index 指數
...tip 指導
..rowing_index 劃船指數
...index 指數
...tip 指導
..allergy_index 過敏指數
...index 指數
...tip 指導
..movement_index 過敏指數
...index 指數
...tip 指導
..air_pollution_index 空氣污染指數
.alarm_data 天氣預警資料,一般都為空
time timestamp 請求時間

傳回樣例:

{
  "code": 1,
  "msg": "success",
  "data": {
    "date": "20221107",
    "city": "南京",
    "city_en": "nanjing",
    "update_time": "11:05",
    "real_time_temp": "18",
    "weather": "霾",
    "weather_en": "haze",
    "weather_code": "53",
    "weather_day_code": "d",
    "air_pressure": "1018",
    "wind": "2級",
    "wind_direction": "西風",
    "humidity": "54%",
    "max_temp": "22",
    "min_temp": "10",
    "sunrise": "06:26",
    "sunset": "17:10",
    "weather_day": "01",
    "weather_night": "01",
    "air_quality": "68",
    "air_quality_tip": "良",
    "index": {
      "dressing_index": {
        "index": "較舒适",
        "tip": "建議穿薄外套或牛仔褲等服裝。"
      },
      "comfort_index": {
        "index": "舒适",
        "tip": "白天溫度宜人,風力不大。"
      },
      "fishing_index": {
        "index": "較适宜",
        "tip": "風稍大會對垂釣産生一定影響。"
      },
      "a_cold_index": {
        "index": "少發",
        "tip": "無明顯降溫,感冒機率較低。"
      },
      "dry_index": {
        "index": "适宜",
        "tip": "風速偏大,氣溫适宜,但體感溫度會低一些,建議多使用保濕型護膚品塗抹皮膚,預防皮膚幹燥。"
      },
      "rowing_index": {
        "index": "較适宜",
        "tip": "風稍大會對劃船産生一定影響。"
      },
      "allergy_index": {
        "index": "極不易發",
        "tip": "無需擔心過敏。"
      },
      "movement_index": {
        "index": "較适宜",
        "tip": "風力稍強,推薦您進行室内運動。"
      },
      "air_pollution_index": {
        "index": "良",
        "tip": "氣象條件有利于空氣污染物擴散。"
      }
    },
    "alarm_data": []
  },
  "time": "2022-11-07 11:19:46"
}
           

繼續閱讀