현재 상태

currentConditions 엔드포인트는 현재 시간별 공기질 정보를 제공합니다. 반환되는 AQI 및 관련 정보 (예: 오염 물질 농도 수준 및 건강 권장사항)를 제어할 수 있습니다.

currentConditions 엔드포인트를 사용하여 현재 시간별 공기질을 요청하려면 다음 주소로 HTTP POST 요청을 전송합니다.

https://airquality.googleapis.com/v1/currentConditions:lookup?key=YOUR_API_KEY

JSON 요청 본문에 요청 옵션을 포함합니다. 요청 본문에는 현재 공기질 상태를 가져오려는 위치와 응답에 포함할 공기질 정보를 제어하는 다양한 옵션이 포함됩니다.

API 탐색기를 사용하면 실시간 요청을 수행하여 API 및 API 옵션을 숙지할 수 있습니다.

기본 요청 예시

기본 요청 본문

다음 코드는 currentConditions 요청의 기본 요청 본문을 구성하는 방법을 보여줍니다. 이 예시에서는 위치만 설정합니다.

curl -X POST -d '{
  "location": {
    "latitude": 37.419734,
    "longitude": -122.0827784
  }
}' \
-H 'Content-Type: application/json' \
'https://airquality.googleapis.com/v1/currentConditions:lookup?key=YOUR_API_KEY'

기본 요청 응답

위의 호출은 다음과 같은 JSON 응답을 생성합니다. 응답 데이터에 관한 자세한 내용은 응답 데이터를 참고하세요.

{
  "dateTime": "2023-10-26T18:00:00Z",
  "regionCode": "us",
  "indexes": [
    {
      "code": "uaqi",
      "displayName": "Universal AQI",
      "aqi": 52,
      "aqiDisplay": "52",
      "color": {
        "red": 0.9490196,
        "green": 0.98039216,
        "blue": 0.019607844
      },
      "category": "Moderate air quality",
      "dominantPollutant": "no2"
    }
  ]
}

여러 매개변수가 있는 요청의 예

여러 매개변수 요청

다음 코드는 currentConditions 요청의 요청 본문을 구성하는 방법을 보여줍니다. 이 예시에서는 위치 외에도 여러 추가 계산과 응답 언어가 지정됩니다.

curl -X POST -d '{
  "universalAqi": true,
  "location": {
    "latitude": 37.419734,
    "longitude": -122.0827784
  },
  "extraComputations": [
    "HEALTH_RECOMMENDATIONS",
    "DOMINANT_POLLUTANT_CONCENTRATION",
    "POLLUTANT_CONCENTRATION",
    "LOCAL_AQI",
    "POLLUTANT_ADDITIONAL_INFO"
  ],
  "languageCode": "en"
}' \
-H 'Content-Type: application/json' \
'https://airquality.googleapis.com/v1/currentConditions:lookup?key=YOUR_API_KEY'

여러 파라미터 응답

위의 호출은 다음과 같은 JSON 응답을 생성합니다. 응답 데이터에 관한 자세한 내용은 응답 데이터를 참고하세요.

{
    "dateTime": "2023-06-15T10:00:00Z",
    "regionCode": "us",
    "indexes": [
        {
            "code": "uaqi",
            "displayName": "Universal AQI",
            "aqi": 89,
            "aqiDisplay": "89",
            "color": {
                "red": 48,
                "green": 175,
                "blue": 55,
                "alpha": 255
            },
            "category": "Excellent air quality",
            "dominantPollutant": "o3"
        },
        {
            "code": "usa_epa",
            "displayName": "AQI (US)",
            "aqi": 41,
            "aqiDisplay": "41",
            "color": {
                "green": 228,
                "alpha": 255
            },
            "category": "Good air quality",
            "dominantPollutant": "pm25"
        }
    ],
    "pollutants": [
        {
            "code": "co",
            "displayName": "CO",
            "fullName": "Carbon monoxide",
            "concentration": {
                "value": 334.24,
                "units": "PARTS_PER_BILLION"
            },
            "additionalInfo": {
                "sources": "Typically originates from incomplete combustion...",
                "effects": "When inhaled, carbon monoxide can prevent the blood from..."
            }
        },
        {
            "code": "no2",
            "displayName": "NO2",
            "fullName": "Nitrogen dioxide",
            "concentration": {
                "value": 13.12,
                "units": "PARTS_PER_BILLION"
            },
            "additionalInfo": {
                "sources": "Main sources are fuel burning processes, such as...",
                "effects": "Exposure may cause increased bronchial reactivity..."
            }
        },
        {
            "code": "o3",
            "displayName": "O3",
            "fullName": "Ozone",
            "concentration": {
                "value": 13.88,
                "units": "PARTS_PER_BILLION"
            },
            "additionalInfo": {
                "sources": "Ozone is created in a chemical reaction between atmospheric oxygen...",
                "effects": "Ozone can irritate the airways and cause coughing, a burning..."
            }
        },
        {
            "code": "pm10",
            "displayName": "PM10",
            "fullName": "Inhalable particulate matter (<10µm)",
            "concentration": {
                "value": 5.07,
                "units": "MICROGRAMS_PER_CUBIC_METER"
            },
            "additionalInfo": {
                "sources": "Main sources are combustion processes (e.g. indoor heating, wildfires)...",
                "effects": "Inhalable particles can penetrate into the lungs. Short term exposure..."
            }
        },
        {
            "code": "pm25",
            "displayName": "PM2.5",
            "fullName": "Fine particulate matter (<2.5µm)",
            "concentration": {
                "value": 2.83,
                "units": "MICROGRAMS_PER_CUBIC_METER"
            },
            "additionalInfo": {
                "sources": "Main sources are combustion processes (e.g. power plants, indoor heating...",
                "effects": "Fine particles can penetrate into the lungs and bloodstream. Short term..."
            }
        },
        {
            "code": "so2",
            "displayName": "SO2",
            "fullName": "Sulfur dioxide",
            "concentration": {
                "value": 0.02,
                "units": "PARTS_PER_BILLION"
            },
            "additionalInfo": {
                "sources": "Main sources are burning processes of sulfur-containing fuel in industry...",
                "effects": "Exposure causes irritation of the respiratory tract, coughing and generates..."
            }
        }
    ],
    "healthRecommendations": {
        "generalPopulation": "With this level of air quality, you have no limitations. Enjoy the outdoors!",
        "elderly": "If you start to feel respiratory discomfort such as coughing or breathing difficulties...",
        "lungDiseasePopulation": "...",
        "heartDiseasePopulation": "...",
        "athletes": "...",
        "pregnantWomen": "...",
        "children": "..."
    }
}

기능을 사용해 보세요.

API 탐색기를 사용하면 샘플 요청을 수행하여 API 및 API 옵션에 익숙해질 수 있습니다.

  1. 페이지 오른쪽에서 API 아이콘 api를 선택합니다.

  2. 필요한 경우 요청 파라미터를 수정합니다.

  3. 실행 버튼을 선택합니다. 대화상자에서 요청에 사용할 계정을 선택합니다.

  4. API 탐색기 패널에서 전체 화면 아이콘 fullscreen을 선택하여 API 탐색기 창을 확장합니다.