Mevcut koşulları al

currentConditions uç noktası, belirli bir konumdaki mevcut hava koşulları hakkında bilgi sağlar. API aşağıdakileri döndürür:

  • İlgili simgeyle birlikte mevcut hava koşullarının açıklaması
  • Mevcut sıcaklık
  • Hissedilen sıcaklık
  • Çiy noktası
  • Isı endeksi
  • Ayaz
  • Bağıl nem
  • UV endeksi
  • Yağış olasılığı, yüzdesi ve türü
  • Gök gürültülü fırtına olasılığı
  • Deniz seviyesindeki basınç
  • Rüzgar yönü, hızı ve ani rüzgar
  • Görünürlük ve bulutluluk
  • Sıcaklık değişimleri, maksimum ve minimum sıcaklıklar ile yağış miktarları dahil olmak üzere son 24 saate ait geçmiş veriler

API Gezgini, API ve API seçeneklerini tanıyabilmeniz için canlı istekler göndermenize olanak tanır:

Güncel hava durumu istekleri hakkında

Mevcut koşulları istemek için şu adrese bir HTTP GET isteği gönderin:

https://weather.googleapis.com/v1/currentConditions:lookup?key=YOUR_API_KEY&location.latitude=LATITUDE&location.longitude=LONGITUDE

İstek URL'nizin parametrelerine konumun enlem ve boylam koordinatlarını ekleyin.

Mevcut koşullar isteği örnekleri

Aşağıdaki örnekte, Mountain View, CA için mevcut koşullar bilgisi istenmektedir:

curl -X GET "https://weather.googleapis.com/v1/currentConditions:lookup?key=YOUR_API_KEY&location.latitude=37.4220&location.longitude=-122.0841"

Yanıt şu biçimdedir:

{
  "currentTime": "2025-01-28T22:04:12.025273178Z",
  "timeZone": {
    "id": "America/Los_Angeles"
  },
  "isDaytime": true,
  "weatherCondition": {
    "iconBaseUri": "https://maps.gstatic.com/weather/v1/sunny",
    "description": {
      "text": "Sunny",
      "languageCode": "en"
    },
    "type": "CLEAR"
  },
  "temperature": {
    "degrees": 13.7,
    "unit": "CELSIUS"
  },
  "feelsLikeTemperature": {
    "degrees": 13.1,
    "unit": "CELSIUS"
  },
  "dewPoint": {
    "degrees": 1.1,
    "unit": "CELSIUS"
  },
  "heatIndex": {
    "degrees": 13.7,
    "unit": "CELSIUS"
  },
  "windChill": {
    "degrees": 13.1,
    "unit": "CELSIUS"
  },
  "relativeHumidity": 42,
  "uvIndex": 1,
  "precipitation": {
    "probability": {
      "percent": 0,
      "type": "RAIN"
    },
    "qpf": {
      "quantity": 0,
      "unit": "MILLIMETERS"
    }
  },
  "thunderstormProbability": 0,
  "airPressure": {
    "meanSeaLevelMillibars": 1019.16
  },
  "wind": {
    "direction": {
      "degrees": 335,
      "cardinal": "NORTH_NORTHWEST"
    },
    "speed": {
      "value": 8,
      "unit": "KILOMETERS_PER_HOUR"
    },
    "gust": {
      "value": 18,
      "unit": "KILOMETERS_PER_HOUR"
    }
  },
  "visibility": {
    "distance": 16,
    "unit": "KILOMETERS"
  },
  "cloudCover": 0,
  "currentConditionsHistory": {
    "temperatureChange": {
      "degrees": -0.6,
      "unit": "CELSIUS"
    },
    "maxTemperature": {
      "degrees": 14.3,
      "unit": "CELSIUS"
    },
    "minTemperature": {
      "degrees": 3.7,
      "unit": "CELSIUS"
    },
    "qpf": {
      "quantity": 0,
      "unit": "MILLIMETERS"
    }
  }
}

Birim sistemini belirtme

Weather API, verileri varsayılan olarak metrik sistemde döndürür. İngiliz ölçü sistemini kullanarak hava durumu verileri istemek için isteğinizde unitsSystem parametresini belirtin.

Aşağıdaki örnekte, Mountain View, CA için hava durumu verileri İngiliz ölçü birimleriyle istenmektedir:

curl -X GET "https://weather.googleapis.com/v1/currentConditions:lookup?key=YOUR_API_KEY&location.latitude=37.4220&location.longitude=-122.0841&unitsSystem=IMPERIAL"

Yanıt şu biçimdedir:

{
  "currentTime": "2025-01-28T22:13:56.723468335Z",
  "timeZone": {
    "id": "America/Los_Angeles"
  },
  "isDaytime": true,
  "weatherCondition": {
    "iconBaseUri": "https://maps.gstatic.com/weather/v1/sunny",
    "description": {
      "text": "Sunny",
      "languageCode": "en"
    },
    "type": "CLEAR"
  },
  "temperature": {
    "degrees": 56.6,
    "unit": "FAHRENHEIT"
  },
  "feelsLikeTemperature": {
    "degrees": 55.7,
    "unit": "FAHRENHEIT"
  },
  "dewPoint": {
    "degrees": 33.9,
    "unit": "FAHRENHEIT"
  },
  "heatIndex": {
    "degrees": 56.6,
    "unit": "FAHRENHEIT"
  },
  "windChill": {
    "degrees": 55.7,
    "unit": "FAHRENHEIT"
  },
  "relativeHumidity": 42,
  "uvIndex": 1,
  "precipitation": {
    "probability": {
      "percent": 0,
      "type": "RAIN"
    },
    "qpf": {
      "quantity": 0,
      "unit": "INCHES"
    }
  },
  "thunderstormProbability": 0,
  "airPressure": {
    "meanSeaLevelMillibars": 1019.12
  },
  "wind": {
    "direction": {
      "degrees": 335,
      "cardinal": "NORTH_NORTHWEST"
    },
    "speed": {
      "value": 5,
      "unit": "MILES_PER_HOUR"
    },
    "gust": {
      "value": 11,
      "unit": "MILES_PER_HOUR"
    }
  },
  "visibility": {
    "distance": 10,
    "unit": "MILES"
  },
  "cloudCover": 0,
  "currentConditionsHistory": {
    "temperatureChange": {
      "degrees": -1.2,
      "unit": "FAHRENHEIT"
    },
    "maxTemperature": {
      "degrees": 57.8,
      "unit": "FAHRENHEIT"
    },
    "minTemperature": {
      "degrees": 38.6,
      "unit": "FAHRENHEIT"
    },
    "qpf": {
      "quantity": 0,
      "unit": "INCHES"
    }
  }
}

Deneyin.

API Gezgini, API'yi ve API seçeneklerini tanıyabilmeniz için örnek istekler göndermenize olanak tanır.

  1. Sayfanın sağ tarafındaki API simgesini api seçin.

  2. İsteğe bağlı olarak istek parametrelerini düzenleyin.

  3. Execute (Yürüt) düğmesini seçin. İletişim kutusunda, isteği göndermek için kullanmak istediğiniz hesabı seçin.

  4. API Gezgini panelinde, API Gezgini penceresini genişletmek için tam ekran simgesini fullscreen seçin.