城市空气质量
最后更新于:2022-04-02 08:24:05
## 城市空气质量
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/63/35/63355b75614f976f5f1a3e286df9d7ea_211x198.png)
> 城市空气质量、城市空气PM2.5指数、城市辐射指数
## 接口费用( [点击购买](https://market.topthink.com/product/325))
> 最低 0.0015元/次
## 接口调用([调用须知](https://docs.topthink.com/think-api/1835086))
## 接口1:城市空气质量查询
### 请求地址
```
GET https://api.topthink.com/air/search
```
### 请求参数
| 名称 | 必填 | 类型 | 说明 |
| --- | --- | --- | --- |
| appCode| 是| string|用户授权码,参考[API调用](https://docs.topthink.com/think-api/1835086) |
| city | 是 | String | 城市名称的中文名称或拼音,如:上海 或 shanghai |
### 返回`data`参数
| 名称 | 类型 | 说明 |
| --- | --- | --- |
| citynow | JSONObject | 查询的最新结果 |
| lastTwoWeeks | JSONObject | 最近几周的空气质量数据 |
| lastMoniData | JSONObject | 各监测点的数据,如果字段返回"—",可能是该监测点未监测这项数据或者有延迟 |
## SDK调用
```
$client = new Client("YourAppCode");
$result = $client->airSearch()
->withCity('苏州')
->request();
dump($result);
```
返回示例
```
{
"code": 0,
"message": "成功",
"data":[
{
"citynow": {
"city": "suzhou",
"AQI": "77",
"quality": "良",
"date": "2014-05-09 14:00"
},
"lastTwoWeeks": {
"1": {
"city": "suzhou",
"AQI": "100",
"quality": "良",
"date": "2014-05-08"
},
"2": {
"city": "suzhou",
"AQI": "99",
"quality": "良",
"date": "2014-05-07"
},
"3": {
"city": "suzhou",
"AQI": "77",
"quality": "良",
"date": "2014-05-06"
},
"4": {
"city": "suzhou",
"AQI": "75",
"quality": "良",
"date": "2014-05-05"
},
"5": {
"city": "suzhou",
"AQI": "78",
"quality": "良",
"date": "2014-05-04"
},
"6": {
"city": "suzhou",
"AQI": "84",
"quality": "良",
"date": "2014-05-03"
},
"7": {
"city": "suzhou",
"AQI": "135",
"quality": "轻度污染",
"date": "2014-05-02"
},
"8": {
"city": "suzhou",
"AQI": "126",
"quality": "轻度污染",
"date": "2014-05-01"
},
"9": {
"city": "suzhou",
"AQI": "87",
"quality": "良",
"date": "2014-04-30"
},
"10": {
"city": "suzhou",
"AQI": "97",
"quality": "良",
"date": "2014-04-29"
},
"11": {
"city": "suzhou",
"AQI": "77",
"quality": "良",
"date": "2014-04-28"
},
"12": {
"city": "suzhou",
"AQI": "84",
"quality": "良",
"date": "2014-04-27"
},
"13": {
"city": "suzhou",
"AQI": "45",
"quality": "优",
"date": "2014-04-26"
},
"14": {
"city": "suzhou",
"AQI": "56",
"quality": "良",
"date": "2014-04-25"
},
"15": {
"city": "suzhou",
"AQI": "83",
"quality": "良",
"date": "2014-04-24"
},
"16": {
"city": "suzhou",
"AQI": "95",
"quality": "良",
"date": "2014-04-23"
},
"17": {
"city": "suzhou",
"AQI": "101",
"quality": "轻度污染",
"date": "2014-04-22"
}
},
"lastMoniData": {
"1": {
"city": "上方山",
"AQI": "77",
"quality": "良",
"PM2.5Hour": "46μg/m³",
"PM2.5Day": "46μg/m³",
"PM10Hour": "104μg/m³",
"lat": "31.247222",
"lon": "120.561389"
},
"2": {
"city": "南门",
"AQI": "112",
"quality": "轻度污染",
"PM2.5Hour": "84μg/m³",
"PM2.5Day": "84μg/m³",
"PM10Hour": "—μg/m³",
"lat": "31.286389",
"lon": "120.6275"
},
"3": {
"city": "彩香",
"AQI": "76",
"quality": "良",
"PM2.5Hour": "46μg/m³",
"PM2.5Day": "46μg/m³",
"PM10Hour": "101μg/m³",
"lat": "31.301944",
"lon": "120.590833"
},
"4": {
"city": "轧钢厂",
"AQI": "68",
"quality": "良",
"PM2.5Hour": "41μg/m³",
"PM2.5Day": "41μg/m³",
"PM10Hour": "85μg/m³",
"lat": "31.326389",
"lon": "120.595556"
},
"5": {
"city": "吴中区",
"AQI": "64",
"quality": "良",
"PM2.5Hour": "46μg/m³",
"PM2.5Day": "46μg/m³",
"PM10Hour": "—μg/m³",
"lat": "31.270278",
"lon": "120.612778"
},
"6": {
"city": "苏州新区",
"AQI": "72",
"quality": "良",
"PM2.5Hour": "46μg/m³",
"PM2.5Day": "46μg/m³",
"PM10Hour": "93μg/m³",
"lat": "31.299444",
"lon": "120.543333"
},
"7": {
"city": "苏州工业园区",
"AQI": "82",
"quality": "良",
"PM2.5Hour": "60μg/m³",
"PM2.5Day": "60μg/m³",
"PM10Hour": "88μg/m³",
"lat": "31.309722",
"lon": "120.669167"
}
}
}
]
}
```
## 接口2:查询城市PM2.5指数
### 请求地址
```
GET https://api.topthink.com/air/pm
```
### 请求参数
| 名称 | 必填 | 类型 | 说明 |
| --- | --- | --- | --- |
| appCode| 是| string|用户授权码,参考[API调用](https://docs.topthink.com/think-api/1835086) |
| city | 是 | String | 城市名称的中文名称或拼音,如:上海 或 shanghai |
### 返回`data`参数
参考返回示例
## SDK调用
```
$client = new Client("YourAppCode");
$result = $client->airPm()
->withCity('苏州')
->request();
dump($result);
```
返回结果示例:
```
{
"code": 0,
"message": "成功",
"data":[
{
"city": "苏州", /*城市*/
"PM2.5": "73", /*PM2.5指数(ug/m3)*/
"AQI": "98", /*空气质量指数*/
"quality": "良", /*空气质量*/
"PM10": "50",/*PM10(ug/m3)*/
"CO": "0.79", /*一氧化碳(mg/m3)*/
"NO2": "65", /*二氧化氮(ug/m3)*/
"O3": "28", /*臭氧(ug/m3)*/
"SO2": "41", /*二氧化硫(ug/m3)*/
"time": "2014-12-26 11:48:40"/*更新时间*/
}
]
}
```
## 接口3:查询支持空气质量指数的城市列表
### 请求地址
```
GET https://api.topthink.com/air/city
```
### 请求参数
无
### 返回`data`参数
参考返回示例
## SDK调用
```
$client = new Client("YourAppCode");
$result = $client->airCity()
->request();
dump($result);
```
返回结果示例:
```
{
"code": 0,
"message": "成功",
"data":[
{
"name": "湛江",/*城市名*/
"pinyin": "zhanjiang"/*城市拼音*/
},
{
"name": "石河子",
"pinyin": "shihezi"
},
{
"name": "寿光",
"pinyin": "shouguang"
},
{
"name": "玉林",
"pinyin": "yulinshi"
},
{
"name": "大庆",
"pinyin": "daqing"
},
{
"name": "上海",
"pinyin": "shanghai"
},
...
]
}
```
## 接口4:查询支持PM2.5指数的城市
### 请求地址
```
GET https://api.topthink.com/air/pm_city
```
### 请求参数
无
### 返回`data`参数
参考返回示例
## SDK调用
```
$client = new Client("YourAppCode");
$result = $client->airPmCity()
->request();
dump($result);
```
返回结果示例:
```
{
"code": 0,
"message": "成功",
"data":[
{
"name": "泰州",/*城市名*/
"pinyin": "taizhoushi"/*城市拼音*/
},
{
"name": "淮安",
"pinyin": "huaian"
},
{
"name": "邢台",
"pinyin": "xingtai"
},
{
"name": "南平",
"pinyin": "nanping"
},
{
"name": "舟山",
"pinyin": "zhoushan"
},
...
]
}
```
';