Pro Daily Assistant for China(便民工具)

Pro Daily Assistant for China(便民工具) · Actions GPT

Weather and Air Quality Service

API for retrieving weather status, air quality, and weather alerts based on city ID, administrative code, city name, or IP address.

  • GET /jiejiari/index?key=a4ab65959bbadc7fd3fbd518492cbf52&Query holiday information
  • GET /aqi/index?key=a4ab65959bbadc7fd3fbd518492cbf52&Retrieve air quality index for a specific area
  • GET /tianqi/index?key=a4ab65959bbadc7fd3fbd518492cbf52&Get Weather and Air Quality Information
Schéma original API
{
  "openapi": "3.1.0",
  "info": {
    "version": "v1.0.0",
    "title": "Weather and Air Quality Service",
    "description": "API for retrieving weather status, air quality, and weather alerts based on city ID, administrative code, city name, or IP address."
  },
  "servers": [
    {
      "url": "https://apis.tianapi.com"
    }
  ],
  "paths": {
    "/jiejiari/index?key=a4ab65959bbadc7fd3fbd518492cbf52&": {
      "get": {
        "summary": "Query holiday information",
        "operationId": "queryHolidayInfo",
        "tags": [
          "holidays"
        ],
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "description": "Query date or date range",
            "required": true,
            "schema": {
              "type": "string",
              "example": "2021-01-01"
            }
          },
          {
            "name": "type",
            "in": "query",
            "description": "Query type (0 batch, 1 by year, 2 by month, 3 by range)",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0,
              "enum": [
                0,
                1,
                2,
                3
              ]
            }
          },
          {
            "name": "mode",
            "in": "query",
            "description": "Query mode, 1 to return both domestic and international holidays",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0,
              "enum": [
                0,
                1
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Holiday information response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HolidayResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/aqi/index?key=a4ab65959bbadc7fd3fbd518492cbf52&": {
      "get": {
        "summary": "Retrieve air quality index for a specific area",
        "operationId": "getAirQualityIndex",
        "tags": [
          "Air Quality"
        ],
        "parameters": [
          {
            "name": "area",
            "in": "query",
            "description": "Name of the area",
            "required": true,
            "schema": {
              "type": "string",
              "example": "上海"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Air quality index data for the specified area",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AQIResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          }
        ]
      }
    },
    "/tianqi/index?key=a4ab65959bbadc7fd3fbd518492cbf52&": {
      "get": {
        "summary": "Get Weather and Air Quality Information",
        "operationId": "getWeatherInfo",
        "tags": [
          "Weather"
        ],
        "parameters": [
          {
            "name": "city",
            "in": "query",
            "description": "City weather ID, administrative code, city name, or IP address",
            "required": true,
            "schema": {
              "type": "string",
              "example": "101020100"
            }
          },
          {
            "name": "type",
            "in": "query",
            "description": "Type of query (1 for real-time, 7 for 7-day forecast)",
            "required": true,
            "schema": {
              "type": "integer",
              "enum": [
                1,
                7
              ],
              "example": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Weather information response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WeatherResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "HolidayInfo": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "description": "The current Gregorian calendar date",
            "example": "2021-01-01"
          },
          "daycode": {
            "type": "integer",
            "description": "Type of the day, where 0 is a working day, 1 is a holiday, 2 is a weekend, and 3 is a working day due to shift adjustment",
            "example": 1
          },
          "weekday": {
            "type": "integer",
            "description": "Day of the week as a number (1 for Monday, 7 for Sunday)",
            "example": 5
          },
          "cnweekday": {
            "type": "string",
            "description": "Day of the week in Chinese",
            "example": "星期五"
          },
          "lunaryear": {
            "type": "string",
            "description": "The lunar year in the Chinese calendar",
            "example": "庚子"
          },
          "lunarmonth": {
            "type": "string",
            "description": "The lunar month in the Chinese calendar",
            "example": "冬月"
          },
          "lunarday": {
            "type": "string",
            "description": "The lunar day in the Chinese calendar",
            "example": "十八"
          },
          "info": {
            "type": "string",
            "description": "Textual description of the day type (e.g., working day, holiday, weekend, shift day)",
            "example": "节假日"
          },
          "start": {
            "type": "integer",
            "description": "Start count of the holiday period",
            "example": 0
          },
          "now": {
            "type": "integer",
            "description": "Current count within the holiday period",
            "example": 0
          },
          "end": {
            "type": "integer",
            "description": "End count of the holiday period",
            "example": 2
          },
          "holiday": {
            "type": "string",
            "description": "Specific date of the holiday",
            "example": "1月1号"
          },
          "name": {
            "type": "string",
            "description": "Name of the holiday in Chinese",
            "example": "元旦节"
          },
          "enname": {
            "type": "string",
            "description": "English name of the holiday",
            "example": "New Year's Day"
          },
          "isnotwork": {
            "type": "integer",
            "description": "Indicator of whether it is a working day (0) or a non-working day (1)",
            "example": 1
          },
          "vacation": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Array of dates representing the holiday period",
            "example": [
              "2021-01-01",
              "2021-01-02",
              "2021-01-03"
            ]
          },
          "remark": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Array of dates representing shift adjustments",
            "example": [
              "2021-12-26",
              "2021-01-08"
            ]
          },
          "wage": {
            "type": "integer",
            "description": "Wage multiplier for the day (e.g., 3 for triple wages on official holidays)",
            "example": 3
          },
          "tip": {
            "type": "string",
            "description": "Brief note about the holiday arrangement",
            "example": "1月1日放假,共3天。"
          },
          "rest": {
            "type": "string",
            "description": "Suggestions for combining leave with weekends for an extended break",
            "example": "2020年12月28日至2020年12月31日请假四天,与周末连休可拼七天长假。"
          }
        }
      },
      "HolidayResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "example": 200
          },
          "msg": {
            "type": "string",
            "example": "success"
          },
          "result": {
            "type": "object",
            "properties": {
              "list": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/HolidayInfo"
                }
              }
            }
          }
        }
      },
      "AQIResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "example": 200
          },
          "msg": {
            "type": "string",
            "example": "success"
          },
          "result": {
            "type": "object",
            "properties": {
              "area": {
                "type": "string",
                "example": "上海",
                "description": "地区"
              },
              "area_code": {
                "type": "string",
                "example": "shanghai",
                "description": "地区代码"
              },
              "so2": {
                "type": "string",
                "example": "7",
                "description": "二氧化硫一小时平均,μg/m³"
              },
              "o3": {
                "type": "string",
                "example": "89",
                "description": "臭氧1小时平均,μg/m³"
              },
              "pm2_5": {
                "type": "string",
                "example": "22",
                "description": "颗粒物(粒径小于等于2.5μm)1小时平均,μg/m³"
              },
              "primary_pollutant": {
                "type": "string",
                "example": "颗粒物(PM10)",
                "description": "首要污染物"
              },
              "co": {
                "type": "string",
                "example": "0.4",
                "description": "一氧化碳1小时平均,mg/m³"
              },
              "num": {
                "type": "string",
                "example": "330",
                "description": "污染数"
              },
              "no2": {
                "type": "string",
                "example": "21",
                "description": "二氧化氮1小时平均,μg/m³"
              },
              "quality": {
                "type": "string",
                "example": "轻度污染",
                "description": "空气质量指数类别,有“优、良、轻度污染、中度污染、重度污染、严重污染”6类"
              },
              "aqi": {
                "type": "string",
                "example": "113",
                "description": "空气质量指数(AQI)"
              },
              "pm10": {
                "type": "string",
                "example": "175",
                "description": "颗粒物(粒径小于等于10μm)1小时平均,μg/m³"
              },
              "o3_8h": {
                "type": "string",
                "example": "83",
                "description": "臭氧8小时滑动平均,μg/m³"
              },
              "time": {
                "type": "string",
                "example": "2020-03-19 14:00:34.778",
                "description": "更新时间"
              }
            }
          }
        }
      },
      "WeatherResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "example": 200
          },
          "msg": {
            "type": "string",
            "example": "success"
          },
          "result": {
            "type": "object",
            "properties": {
              "date": {
                "type": "string",
                "example": "2020-05-23"
              },
              "week": {
                "type": "string",
                "example": "星期二"
              },
              "province": {
                "type": "string",
                "example": "上海市"
              },
              "area": {
                "type": "string",
                "example": "上海市"
              },
              "areaid": {
                "type": "string",
                "example": "101020100"
              },
              "weather": {
                "type": "string",
                "example": "晴转多云"
              },
              "weatherimg": {
                "type": "string",
                "example": "duoyun.png"
              },
              "weathercode": {
                "type": "string",
                "example": "qing_duoyun"
              },
              "real": {
                "type": "string",
                "example": "18℃"
              },
              "lowest": {
                "type": "string",
                "example": "6℃"
              },
              "highest": {
                "type": "string",
                "example": "22℃"
              },
              "wind": {
                "type": "string",
                "example": "东北风"
              },
              "windspeed": {
                "type": "string",
                "example": "7"
              },
              "windsc": {
                "type": "string",
                "example": "1-2级"
              },
              "sunrise": {
                "type": "string",
                "example": "06:10"
              },
              "sunset": {
                "type": "string",
                "example": "18:31"
              },
              "moonrise": {
                "type": "string",
                "example": "06:02"
              },
              "moondown": {
                "type": "string",
                "example": "17:22"
              },
              "pcpn": {
                "type": "string",
                "example": "0.0"
              },
              "uv_index": {
                "type": "string",
                "example": "9"
              },
              "aqi": {
                "type": "string",
                "example": "34"
              },
              "quality": {
                "type": "string",
                "example": "优"
              },
              "vis": {
                "type": "string",
                "example": "25"
              },
              "humidity": {
                "type": "string",
                "example": "23"
              },
              "alarmlist": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "province": {
                      "type": "string",
                      "example": "上海市"
                    },
                    "city": {
                      "type": "string",
                      "example": "上海市"
                    },
                    "level": {
                      "type": "string",
                      "example": "黄色"
                    },
                    "type": {
                      "type": "string",
                      "example": "大雾"
                    },
                    "content": {
                      "type": "string",
                      "example": "上海中心气象台2020年05月23日20时30分发布大雾黄色预警信号:预计今天下半夜到明天早晨本市大部郊区将出现能见度小于500米的雾,局部地区小于200米,请注意防范。"
                    },
                    "time": {
                      "type": "string",
                      "example": "2020-05-23 20:30:00"
                    }
                  }
                }
              },
              "tips": {
                "type": "string",
                "example": "天气暖和,适宜着单层棉麻面料的短套装、T恤衫、薄牛仔衫裤、休闲服、职业套装等春秋过渡装。年老体弱者请适当增减衣服。空气质量优秀,快去户外呼吸清新空气吧。"
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "code",
          "msg"
        ],
        "properties": {
          "code": {
            "type": "integer",
            "format": "int32",
            "examples": [
              400
            ]
          },
          "msg": {
            "type": "string",
            "examples": [
              "Invalid request"
            ]
          }
        }
      }
    },
    "securitySchemes": {
      "api_key": {
        "type": "apiKey",
        "name": "key",
        "in": "query"
      }
    }
  }
}