हर घंटे के हिसाब से मौसम का हाल जानें

forecast.hours एंडपॉइंट, किसी जगह के लिए अगले 240 घंटों के मौसम की जानकारी दिखाता है. यह जानकारी, मौजूदा समय से शुरू होती है. एपीआई से यह जानकारी मिलती है:

  • मौसम की मौजूदा स्थिति के बारे में जानकारी, जिसमें आइकॉन भी शामिल है
  • मौजूदा तापमान
  • महसूस किया जाने वाला तापमान ("तापमान महसूस हो रहा है")
  • ड्यू पॉइंट
  • हीट इंडेक्स
  • ठंडी हवा
  • वेट बल्ब से लिया गया तापमान
  • संबंधित आर्द्रता
  • यूवी इंडेक्स
  • बारिश या बर्फ़बारी वगैरह होने की संभावना, प्रतिशत, और टाइप
  • गरज के साथ तूफ़ान आने की संभावना
  • समुद्र के लेवल पर दबाव
  • हवा की दिशा, रफ़्तार, और झोंका
  • विज़िबिलिटी और बादल

एपीआई एक्सप्लोरर की मदद से, लाइव अनुरोध किए जा सकते हैं. इससे आपको एपीआई और एपीआई के विकल्पों के बारे में जानकारी मिलती है:

हर घंटे के हिसाब से मौसम का अनुमान जानने के अनुरोधों के बारे में जानकारी

हर घंटे के पूर्वानुमान की जानकारी का अनुरोध करने के लिए, यहां दिए गए पते पर एचटीटीपी GET अनुरोध भेजें:

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

अपने अनुरोध के यूआरएल के पैरामीटर में, जगह के अक्षांश और देशांतर के निर्देशांक शामिल करें.

हर घंटे के हिसाब से मौसम की जानकारी के अनुरोध के उदाहरण

डिफ़ॉल्ट रूप से, forecast.hours एंडपॉइंट, मौजूदा घंटे से शुरू होकर 240 घंटे का डेटा दिखाता है. hours पैरामीटर का इस्तेमाल करके, अपने अनुरोध को किसी खास समयावधि के लिए सीमित किया जा सकता है.

इस उदाहरण में, कैलिफ़ोर्निया के माउंटेन व्यू के लिए, अगले तीन घंटों के लिए हर घंटे के पूर्वानुमान की जानकारी का अनुरोध किया गया है:

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

रिस्पॉन्स में, interval ऑब्जेक्ट हर घंटे की जानकारी दिखाता है:

{
  "forecastHours": [
    {
      "interval": {
        "startTime": "2025-02-05T23:00:00Z",
        "endTime": "2025-02-06T00:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 5,
        "hours": 15,
        "utcOffset": "-28800s"
      },
      "isDaytime": true,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/sunny",
        "description": {
          "text": "Sunny",
          "languageCode": "en"
        },
        "type": "CLEAR"
      },
      "temperature": {
        "degrees": 12.7,
        "unit": "CELSIUS"
      },
      "feelsLikeTemperature": {
        "degrees": 12,
        "unit": "CELSIUS"
      },
      "dewPoint": {
        "degrees": 2.7,
        "unit": "CELSIUS"
      },
      "heatIndex": {
        "degrees": 12.7,
        "unit": "CELSIUS"
      },
      "windChill": {
        "degrees": 12,
        "unit": "CELSIUS"
      },
      "wetBulbTemperature": {
        "degrees": 7.7,
        "unit": "CELSIUS"
      },
      "relativeHumidity": 51,
      "uvIndex": 1,
      "precipitation": {
        "probability": {
          "percent": 0,
          "type": "RAIN"
        },
        "qpf": {
          "quantity": 0,
          "unit": "MILLIMETERS"
        }
      },
      "thunderstormProbability": 0,
      "airPressure": {
        "meanSeaLevelMillibars": 1019.13
      },
      "wind": {
        "direction": {
          "degrees": 335,
          "cardinal": "NORTH_NORTHWEST"
        },
        "speed": {
          "value": 10,
          "unit": "KILOMETERS_PER_HOUR"
        },
        "gust": {
          "value": 19,
          "unit": "KILOMETERS_PER_HOUR"
        }
      },
      "visibility": {
        "distance": 16,
        "unit": "KILOMETERS"
      },
      "cloudCover": 0,
      "iceThickness": {
        "thickness": 0,
        "unit": "MILLIMETERS"
      }
    },
    {
      "interval": {
        "startTime": "2025-02-06T00:00:00Z",
        "endTime": "2025-02-06T01:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 5,
        "hours": 16,
        "utcOffset": "-28800s"
      },
      "isDaytime": true,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/sunny",
        "description": {
          "text": "Sunny",
          "languageCode": "en"
        },
        "type": "CLEAR"
      },
      "temperature": {
        "degrees": 12.5,
        "unit": "CELSIUS"
      },
      /.../
    },
    {
      "interval": {
        "startTime": "2025-02-06T01:00:00Z",
        "endTime": "2025-02-06T02:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 5,
        "hours": 17,
        "utcOffset": "-28800s"
      },
      "isDaytime": true,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/sunny",
        "description": {
          "text": "Sunny",
          "languageCode": "en"
        },
        "type": "CLEAR"
      },
      "temperature": {
        "degrees": 11.4,
        "unit": "CELSIUS"
      },
      /.../
    }
  ],
  "timeZone": {
    "id": "America/Los_Angeles"
  }
}

हर पेज पर दिखाए जाने वाले घंटों की संख्या तय करना

pageSize यूआरएल पैरामीटर का इस्तेमाल करके, हर पेज के लिए डेटा के घंटों की संख्या तय की जा सकती है. डिफ़ॉल्ट रूप से, हर पेज पर 24 घंटे के लिए, मौसम के पूर्वानुमान की जानकारी दिखती है.

कई पेजों की जानकारी वाले जवाबों में nextPageToken शामिल होता है. जानकारी का अगला पेज देखने के लिए, अपने अनुरोध में nextPageToken वैल्यू को pageToken पैरामीटर में पास करें.

इस उदाहरण में, माउंटेन व्यू, कैलिफ़ोर्निया के लिए मौसम के पूर्वानुमान का 25 घंटे का डेटा मांगा गया है. इसमें हर पेज पर तीन घंटे का डेटा है:

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

जवाब में, शुरुआती तीन घंटे का डेटा इस फ़ॉर्मैट में होता है:

{
  "forecastHours": [
    {
      "interval": {
        "startTime": "2025-02-06T23:00:00Z",
        "endTime": "2025-02-07T00:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 6,
        "hours": 15,
        "utcOffset": "-28800s"
      },
      "isDaytime": true,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/showers",
        "description": {
          "text": "Rain showers",
          "languageCode": "en"
        },
        "type": "RAIN_SHOWERS"
      },
      "temperature": {
        "degrees": 14.6,
        "unit": "CELSIUS"
      },
      /.../
    },
    {
      "interval": {
        "startTime": "2025-02-07T00:00:00Z",
        "endTime": "2025-02-07T01:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 6,
        "hours": 16,
        "utcOffset": "-28800s"
      },
      "isDaytime": true,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/drizzle",
        "description": {
          "text": "Light rain",
          "languageCode": "en"
        },
        "type": "LIGHT_RAIN"
      },
      "temperature": {
        "degrees": 14.4,
        "unit": "CELSIUS"
      },
      /.../
    },
    {
      "interval": {
        "startTime": "2025-02-07T01:00:00Z",
        "endTime": "2025-02-07T02:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 6,
        "hours": 17,
        "utcOffset": "-28800s"
      },
      "isDaytime": true,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/cloudy",
        "description": {
          "text": "Cloudy",
          "languageCode": "en"
        },
        "type": "CLOUDY"
      },
      "temperature": {
        "degrees": 14.4,
        "unit": "CELSIUS"
      },
      /.../
    }
  ],
  "timeZone": {
    "id": "America/Los_Angeles"
  },
  "nextPageToken": "ChYKEgm8dJMYBLZCQBH-ZffkYYVewBAZEAMYAyIMCLKClb0GEJeO18kDKhNBbWVyaWNhL0xvc19BbmdlbGVz"
}

डेटा का अगला पेज ऐक्सेस करने के लिए, अपने अनुरोध में pageToken पैरामीटर में nextPageToken वैल्यू पास करें:

curl -X GET "https://weather.googleapis.com/v1/forecast/hours:lookup?key=YOUR_API_KEY&location.latitude=37.4220&location.longitude=-122.0841&hours=25&pageSize=3&pageToken=ChYKEgm8dJMYBLZCQBH-ZffkYYVewBAZEAMYAyIMCLKClb0GEJeO18kDKhNBbWVyaWNhL0xvc19BbmdlbGVz"

जवाब इस फ़ॉर्मैट में है:

{
  "forecastHours": [
    {
      "interval": {
        "startTime": "2025-02-07T02:00:00Z",
        "endTime": "2025-02-07T03:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 6,
        "hours": 18,
        "utcOffset": "-28800s"
      },
      "isDaytime": false,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/cloudy",
        "description": {
          "text": "Cloudy",
          "languageCode": "en"
        },
        "type": "CLOUDY"
      },
      "temperature": {
        "degrees": 14.3,
        "unit": "CELSIUS"
      },
      /.../
    },
    {
      "interval": {
        "startTime": "2025-02-07T03:00:00Z",
        "endTime": "2025-02-07T04:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 6,
        "hours": 19,
        "utcOffset": "-28800s"
      },
      "isDaytime": false,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/showers",
        "description": {
          "text": "Rain showers",
          "languageCode": "en"
        },
        "type": "RAIN_SHOWERS"
      },
      "temperature": {
        "degrees": 14.2,
        "unit": "CELSIUS"
      },
      /.../
    },
    {
      "interval": {
        "startTime": "2025-02-07T04:00:00Z",
        "endTime": "2025-02-07T05:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 6,
        "hours": 20,
        "utcOffset": "-28800s"
      },
      "isDaytime": false,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/showers",
        "description": {
          "text": "Rain showers",
          "languageCode": "en"
        },
        "type": "RAIN_SHOWERS"
      },
      "temperature": {
        "degrees": 14.1,
        "unit": "CELSIUS"
      },
      /.../
    }
  ],
  "timeZone": {
    "id": "America/Los_Angeles"
  },
  "nextPageToken": "ChYKEgm8dJMYBLZCQBH-ZffkYYVewBAZEAYYBiILCPeDlb0GEICs5TMqE0FtZXJpY2EvTG9zX0FuZ2VsZXM="
}

इसे आज़माएं!

एपीआई एक्सप्लोरर की मदद से, सैंपल अनुरोध किए जा सकते हैं, ताकि आपको एपीआई और एपीआई के विकल्पों के बारे में जानकारी मिल सके.

  1. पेज की दाईं ओर मौजूद, एपीआई आइकॉन api चुनें.

  2. इसके बाद, अनुरोध पैरामीटर में बदलाव करें. हालांकि, ऐसा करना ज़रूरी नहीं है.

  3. लागू करें बटन चुनें. डायलॉग बॉक्स में, वह खाता चुनें जिसका इस्तेमाल करके आपको अनुरोध करना है.

  4. एपीआई एक्सप्लोरर पैनल में, एपीआई एक्सप्लोरर विंडो को बड़ा करने के लिए, फ़ुलस्क्रीन आइकॉन फ़ुलस्क्रीन चुनें.