Monitoring Station Data (new)
Monitoring Station Data API provides pollutant concentration values from air quality monitoring stations in each country or region.
Warning: Monitoring station data is for reference only, it may be delayed, incorrect or unavailable due to various reasons such as failure, removal, maintenance or local laws and regulations.
Interface code | Interface | Class |
---|---|---|
airStation | Monitoring Station Data (new) | AirV1StationResponse |
Parameters
AirV1StationParameter
-
LocationID
(required)LocationID of air quality monitoring station, LocationID can be obtained by GeoAPI. For exampleP58911
-
lang
Multi-language setting, please see Language to find out how our multi-language works and how to set up.
Sample code
Swift
Task{
do {
let parameter = AirV1StationParameter(locationID: "P58911")
let response = try await QWeather.instance
.airStation(parameter)
print(response)
} catch QWeatherError.errorResponse(let error) {
print(error)
} catch {
print(error)
}
}
Objective-C
AirV1StationParameter * parameter = [AirV1StationParameter instanceWithLocationID:@"P58911" lang:@(LangZH_HANS)];
[QWeatherObjc airStation:parameter completionHandler:^(AirV1StationResponse * _Nullable response, NSError * _Nullable error) {
if (response) {
NSLog(@"%@", response.description);
}
if (error) {
NSLog(@"%@", error.localizedDescription);
}
}];
Response
AirV1StationResponse
-
metadata.tag
Unique tag for this data -
metadata.sources
Data source or provider name and their declaration, developers must display this information with data. May be null -
pollutants.code
The pollutant code. -
pollutants.name
Name of pollutant. -
pollutants.fullName
Full name of pollutant. -
pollutants.concentration.value
Concentration values of pollutants. -
pollutants.concentration.unit
Units for concentration values of pollutants.