{
    "openapi": "3.0.0",
    "info": {
        "title": "空气质量指数 - API文档",
        "version": "1.0.0",
        "description": "查询全国三百多个城市或地区的空气质量指数，较小地区的数据返回上级地区的空气质量。"
    },
    "servers": [
        {
            "url": "https:\/\/apis.tianapi.com"
        }
    ],
    "paths": {
        "\/aqi\/index": {
            "get": {
                "summary": "空气质量指数查询",
                "tags": [
                    "空气质量指数"
                ],
                "description": "根据城市名称查询该城市AQI数据",
                "parameters": [
                    {
                        "name": "key",
                        "in": "query",
                        "description": "API密钥",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "description": "API密钥"
                        }
                    },
                    {
                        "name": "area",
                        "in": "query",
                        "description": "地区名",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "example": "上海",
                            "description": "地区名"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功响应",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "co": {
                                            "type": "string",
                                            "example": "0.4",
                                            "description": "一氧化碳1小时平均，mg\/m³"
                                        },
                                        "o3": {
                                            "type": "string",
                                            "example": "89",
                                            "description": "臭氧1小时平均，μg\/m³"
                                        },
                                        "aqi": {
                                            "type": "string",
                                            "example": "113",
                                            "description": "空气质量指数(AQI)"
                                        },
                                        "no2": {
                                            "type": "string",
                                            "example": "21",
                                            "description": "二氧化氮1小时平均，μg\/m³"
                                        },
                                        "num": {
                                            "type": "string",
                                            "example": "330",
                                            "description": "污染数"
                                        },
                                        "so2": {
                                            "type": "string",
                                            "example": "7",
                                            "description": "二氧化硫一小时平均，μg\/m³"
                                        },
                                        "area": {
                                            "type": "string",
                                            "example": "上海",
                                            "description": "地区"
                                        },
                                        "pm10": {
                                            "type": "string",
                                            "example": "175",
                                            "description": "颗粒物（粒径小于等于10μm）1小时平均，μg\/m³"
                                        },
                                        "time": {
                                            "type": "string",
                                            "example": "2020-03-19 14:00:34.778",
                                            "description": "更新时间"
                                        },
                                        "o3_8h": {
                                            "type": "string",
                                            "example": "83",
                                            "description": "臭氧8小时滑动平均，μg\/m³"
                                        },
                                        "pm2_5": {
                                            "type": "string",
                                            "example": "22",
                                            "description": "颗粒物（粒径小于等于2.5μm）1小时平均，μg\/m³"
                                        },
                                        "quality": {
                                            "type": "string",
                                            "example": "轻度污染",
                                            "description": "空气质量指数类别，有“优、良、轻度污染、中度污染、重度污染、严重污染”6类"
                                        },
                                        "area_code": {
                                            "type": "string",
                                            "example": "shanghai",
                                            "description": "地区代码"
                                        },
                                        "primary_pollutant": {
                                            "type": "string",
                                            "example": "颗粒物(PM10)",
                                            "description": "首要污染物"
                                        }
                                    }
                                },
                                "example": {
                                    "msg": "success",
                                    "code": 200,
                                    "result": {
                                        "co": "0.4",
                                        "o3": "89",
                                        "aqi": "113",
                                        "no2": "21",
                                        "num": "330",
                                        "so2": "7",
                                        "area": "上海",
                                        "pm10": "175",
                                        "time": "2020-03-19 14:00:34.778",
                                        "o3_8h": "83",
                                        "pm2_5": "22",
                                        "quality": "轻度污染",
                                        "area_code": "shanghai",
                                        "primary_pollutant": "颗粒物(PM10)"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "空气质量指数查询",
                "tags": [
                    "空气质量指数"
                ],
                "description": "根据城市名称查询该城市AQI数据",
                "requestBody": {
                    "content": {
                        "application\/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "key": {
                                        "type": "string",
                                        "description": "API密钥"
                                    },
                                    "area": {
                                        "type": "string",
                                        "example": "上海",
                                        "description": "地区名"
                                    }
                                },
                                "required": [
                                    "key",
                                    "area"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "成功响应",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "co": {
                                            "type": "string",
                                            "example": "0.4",
                                            "description": "一氧化碳1小时平均，mg\/m³"
                                        },
                                        "o3": {
                                            "type": "string",
                                            "example": "89",
                                            "description": "臭氧1小时平均，μg\/m³"
                                        },
                                        "aqi": {
                                            "type": "string",
                                            "example": "113",
                                            "description": "空气质量指数(AQI)"
                                        },
                                        "no2": {
                                            "type": "string",
                                            "example": "21",
                                            "description": "二氧化氮1小时平均，μg\/m³"
                                        },
                                        "num": {
                                            "type": "string",
                                            "example": "330",
                                            "description": "污染数"
                                        },
                                        "so2": {
                                            "type": "string",
                                            "example": "7",
                                            "description": "二氧化硫一小时平均，μg\/m³"
                                        },
                                        "area": {
                                            "type": "string",
                                            "example": "上海",
                                            "description": "地区"
                                        },
                                        "pm10": {
                                            "type": "string",
                                            "example": "175",
                                            "description": "颗粒物（粒径小于等于10μm）1小时平均，μg\/m³"
                                        },
                                        "time": {
                                            "type": "string",
                                            "example": "2020-03-19 14:00:34.778",
                                            "description": "更新时间"
                                        },
                                        "o3_8h": {
                                            "type": "string",
                                            "example": "83",
                                            "description": "臭氧8小时滑动平均，μg\/m³"
                                        },
                                        "pm2_5": {
                                            "type": "string",
                                            "example": "22",
                                            "description": "颗粒物（粒径小于等于2.5μm）1小时平均，μg\/m³"
                                        },
                                        "quality": {
                                            "type": "string",
                                            "example": "轻度污染",
                                            "description": "空气质量指数类别，有“优、良、轻度污染、中度污染、重度污染、严重污染”6类"
                                        },
                                        "area_code": {
                                            "type": "string",
                                            "example": "shanghai",
                                            "description": "地区代码"
                                        },
                                        "primary_pollutant": {
                                            "type": "string",
                                            "example": "颗粒物(PM10)",
                                            "description": "首要污染物"
                                        }
                                    }
                                },
                                "example": {
                                    "msg": "success",
                                    "code": 200,
                                    "result": {
                                        "co": "0.4",
                                        "o3": "89",
                                        "aqi": "113",
                                        "no2": "21",
                                        "num": "330",
                                        "so2": "7",
                                        "area": "上海",
                                        "pm10": "175",
                                        "time": "2020-03-19 14:00:34.778",
                                        "o3_8h": "83",
                                        "pm2_5": "22",
                                        "quality": "轻度污染",
                                        "area_code": "shanghai",
                                        "primary_pollutant": "颗粒物(PM10)"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}