تعرض نقطة النهاية history.hours بيانات الطقس السابقة كل ساعة لمدة تصل إلى 24 ساعة في موقع جغرافي محدّد، بدءًا من الساعة الأخيرة. تعرض واجهة برمجة التطبيقات ما يلي:
- تمثّل هذه السمة وصفًا لحالة الطقس مع رمز مطابق لكل ساعة
- الحد الأقصى والأدنى لدرجات الحرارة اليومية
- الحدّ الأقصى والأدنى اليومي لدرجات الحرارة المحسوسة
- نقطة الندى
- مؤشر الحرارة
- درجة حرارة البصيلة الرطبة
- الرطوبة النسبية
- مؤشر أشعة UV
- الاحتمالية والنسبة المئوية والكمية ونوع هطول الأمطار
- احتمال حدوث عواصف رعدية
- الضغط على مستوى سطح البحر
- الرياح الباردة
- اتجاه الرياح وسرعتها وقوتها
- سُمك الجليد
- الرؤية وغطاء السحب
يتيح لك "مستكشف واجهات برمجة التطبيقات" إرسال طلبات مباشرة لتتعرّف على واجهة برمجة التطبيقات وخياراتها:
لمحة عن طلبات السجلّ لكل ساعة
لطلب معلومات السجلّ كل ساعة، أرسِل طلب HTTP GET إلى:
https://weather.googleapis.com/v1/history/hours:lookup?key=YOUR_API_KEY&location.latitude=LATITUDE&location.longitude=LONGITUDE
أدرِج إحداثيات خط العرض وخط الطول للموقع الجغرافي في مَعلمات عنوان URL الخاص بالطلب.
أمثلة على طلبات سجلّ البيانات لكل ساعة
تُرجع نقطة النهاية
history.hours
تلقائيًا بيانات الطقس السابقة الخاصة بآخر 24 ساعة، بدءًا من الساعة الأخيرة. يمكنك تحديد نطاق طلبك لفترة زمنية معيّنة باستخدام المَعلمة hours
.
يطلب المثال التالي معلومات السجلّ كل ساعة خلال الساعات الثلاث الماضية في Mountain View، كاليفورنيا:
curl -X GET "https://weather.googleapis.com/v1/history/hours:lookup?key=YOUR_API_KEY&location.latitude=37.4220 &location.longitude=-122.0841 &hours=3"
في الردّ، يشير العنصر interval
إلى كل ساعة من المعلومات:
{ "historyHours": [ { "interval": { "startTime": "2025-02-12T22:00:00Z", "endTime": "2025-02-12T23:00:00Z" }, "displayDateTime": { "year": 2025, "month": 2, "day": 12, "hours": 14, "utcOffset": "-28800s" }, "isDaytime": true, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/cloudy", "description": { "text": "Cloudy", "languageCode": "en" }, "type": "CLOUDY" }, "temperature": { "degrees": 12.4, "unit": "CELSIUS" }, "feelsLikeTemperature": { "degrees": 12.4, "unit": "CELSIUS" }, "dewPoint": { "degrees": 6.1, "unit": "CELSIUS" }, "heatIndex": { "degrees": 12.4, "unit": "CELSIUS" }, "windChill": { "degrees": 12.4, "unit": "CELSIUS" }, "wetBulbTemperature": { "degrees": 9.1, "unit": "CELSIUS" }, "relativeHumidity": 65, "uvIndex": 1, "precipitation": { "probability": { "percent": 10, "type": "RAIN" }, "qpf": { "quantity": 0, "unit": "MILLIMETERS" } }, "thunderstormProbability": 0, "airPressure": { "meanSeaLevelMillibars": 1010.4 }, "wind": { "direction": { "degrees": 135, "cardinal": "SOUTHEAST" }, "speed": { "value": 3, "unit": "KILOMETERS_PER_HOUR" }, "gust": { "value": 6, "unit": "KILOMETERS_PER_HOUR" } }, "visibility": { "distance": 16, "unit": "KILOMETERS" }, "cloudCover": 95, "iceThickness": { "thickness": 0, "unit": "MILLIMETERS" } }, { "interval": { "startTime": "2025-02-12T21:00:00Z", "endTime": "2025-02-12T22:00:00Z" }, "displayDateTime": { "year": 2025, "month": 2, "day": 12, "hours": 13, "utcOffset": "-28800s" }, "isDaytime": true, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/cloudy", "description": { "text": "Cloudy", "languageCode": "en" }, "type": "CLOUDY" }, /.../ }, { "interval": { "startTime": "2025-02-12T20:00:00Z", "endTime": "2025-02-12T21:00:00Z" }, "displayDateTime": { "year": 2025, "month": 2, "day": 12, "hours": 12, "utcOffset": "-28800s" }, "isDaytime": true, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/cloudy", "description": { "text": "Cloudy", "languageCode": "en" }, "type": "CLOUDY" }, /.../ } ], "timeZone": { "id": "America/Los_Angeles" } }
تحديد عدد الساعات المطلوب عرضها في كل صفحة
يمكنك تحديد عدد ساعات البيانات التي سيتم عرضها في كل صفحة باستخدام مَعلمة عنوان URL pageSize
. القيمة التلقائية هي 24 ساعة من معلومات التوقّعات
لكل صفحة.
تتضمّن الردود التي تحتوي على صفحات متعددة من المعلومات الرمز nextPageToken
. للاطّلاع على صفحة المعلومات التالية، مرِّر القيمة nextPageToken
إلى المَعلمة pageToken
في طلبك.
يطلب المثال التالي بيانات توقّعات الطقس لمدة ثماني ساعات في مدينة ماونتن فيو بولاية كاليفورنيا، مع توفير خمس ساعات من البيانات في كل صفحة:
curl -X GET "https://weather.googleapis.com/v1/history/hours:lookup?key=YOUR_API_KEY&location.latitude=37.4220 &location.longitude=-122.0841 &hours=8&pageSize=5"
تكون الاستجابة، التي تتضمّن أول ثلاث ساعات من البيانات، بالشكل التالي:
{ "historyHours": [ { "interval": { "startTime": "2025-02-12T23:00:00Z", "endTime": "2025-02-13T00:00:00Z" }, "displayDateTime": { "year": 2025, "month": 2, "day": 12, "hours": 15, "utcOffset": "-28800s" }, "isDaytime": true, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/cloudy", "description": { "text": "Cloudy", "languageCode": "en" }, "type": "CLOUDY" }, "temperature": { "degrees": 11.6, "unit": "CELSIUS" }, "feelsLikeTemperature": { "degrees": 11.6, "unit": "CELSIUS" }, "dewPoint": { "degrees": 6.3, "unit": "CELSIUS" }, "heatIndex": { "degrees": 11.6, "unit": "CELSIUS" }, "windChill": { "degrees": 11.6, "unit": "CELSIUS" }, "wetBulbTemperature": { "degrees": 8.8, "unit": "CELSIUS" }, "relativeHumidity": 70, "uvIndex": 0, "precipitation": { "probability": { "percent": 10, "type": "RAIN" }, "qpf": { "quantity": 0, "unit": "MILLIMETERS" } }, "thunderstormProbability": 0, "airPressure": { "meanSeaLevelMillibars": 1010.07 }, "wind": { "direction": { "degrees": 65, "cardinal": "EAST_NORTHEAST" }, "speed": { "value": 5, "unit": "KILOMETERS_PER_HOUR" }, "gust": { "value": 10, "unit": "KILOMETERS_PER_HOUR" } }, "visibility": { "distance": 16, "unit": "KILOMETERS" }, "cloudCover": 95, "iceThickness": { "thickness": 0, "unit": "MILLIMETERS" } }, { "interval": { "startTime": "2025-02-12T22:00:00Z", "endTime": "2025-02-12T23:00:00Z" }, "displayDateTime": { "year": 2025, "month": 2, "day": 12, "hours": 14, "utcOffset": "-28800s" }, "isDaytime": true, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/cloudy", "description": { "text": "Cloudy", "languageCode": "en" }, "type": "CLOUDY" }, /.../ }, { "interval": { "startTime": "2025-02-12T21:00:00Z", "endTime": "2025-02-12T22:00:00Z" }, "displayDateTime": { "year": 2025, "month": 2, "day": 12, "hours": 13, "utcOffset": "-28800s" }, "isDaytime": true, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/cloudy", "description": { "text": "Cloudy", "languageCode": "en" }, "type": "CLOUDY" }, /.../ }, { "interval": { "startTime": "2025-02-12T20:00:00Z", "endTime": "2025-02-12T21:00:00Z" }, "displayDateTime": { "year": 2025, "month": 2, "day": 12, "hours": 12, "utcOffset": "-28800s" }, "isDaytime": true, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/cloudy", "description": { "text": "Cloudy", "languageCode": "en" }, "type": "CLOUDY" }, /.../ }, { "interval": { "startTime": "2025-02-12T19:00:00Z", "endTime": "2025-02-12T20:00:00Z" }, "displayDateTime": { "year": 2025, "month": 2, "day": 12, "hours": 11, "utcOffset": "-28800s" }, "isDaytime": true, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/cloudy", "description": { "text": "Cloudy", "languageCode": "en" }, "type": "CLOUDY" }, /.../ } ], "timeZone": { "id": "America/Los_Angeles" }, "nextPageToken": "ChYKEgm8dJMYBLZCQL0xvc19BbmdlbGVz" }
للوصول إلى صفحة البيانات التالية، مرِّر قيمة nextPageToken
إلى المَعلمة pageToken
في طلبك:
curl -X GET "https://weather.googleapis.com/v1/history/hours:lookup?key=YOUR_API_KEY&location.latitude=37.4220 &location.longitude=-122.0841 &hours=8 &pageSize=5 &pageToken=ChYKEgm8dJMYBLZCQL0xvc19BbmdlbGVz"
يكون الردّ بالتنسيق التالي:
{ "historyHours": [ { "interval": { "startTime": "2025-02-12T18:00:00Z", "endTime": "2025-02-12T19:00:00Z" }, "displayDateTime": { "year": 2025, "month": 2, "day": 12, "hours": 10, "utcOffset": "-28800s" }, "isDaytime": true, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/cloudy", "description": { "text": "Cloudy", "languageCode": "en" }, "type": "CLOUDY" }, "temperature": { "degrees": 8.9, "unit": "CELSIUS" }, "feelsLikeTemperature": { "degrees": 8.9, "unit": "CELSIUS" }, "dewPoint": { "degrees": 5.9, "unit": "CELSIUS" }, "heatIndex": { "degrees": 8.9, "unit": "CELSIUS" }, "windChill": { "degrees": 8.9, "unit": "CELSIUS" }, "wetBulbTemperature": { "degrees": 7.3, "unit": "CELSIUS" }, "relativeHumidity": 82, "uvIndex": 1, "precipitation": { "probability": { "percent": 10, "type": "RAIN" }, "qpf": { "quantity": 0, "unit": "MILLIMETERS" } }, "thunderstormProbability": 0, "airPressure": { "meanSeaLevelMillibars": 1012.1 }, "wind": { "direction": { "degrees": 135, "cardinal": "SOUTHEAST" }, "speed": { "value": 3, "unit": "KILOMETERS_PER_HOUR" }, "gust": { "value": 8, "unit": "KILOMETERS_PER_HOUR" } }, "visibility": { "distance": 16, "unit": "KILOMETERS" }, "cloudCover": 100, "iceThickness": { "thickness": 0, "unit": "MILLIMETERS" } }, { "interval": { "startTime": "2025-02-12T17:00:00Z", "endTime": "2025-02-12T18:00:00Z" }, "displayDateTime": { "year": 2025, "month": 2, "day": 12, "hours": 9, "utcOffset": "-28800s" }, "isDaytime": true, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/cloudy", "description": { "text": "Cloudy", "languageCode": "en" }, "type": "CLOUDY" }, /.../ }, { "interval": { "startTime": "2025-02-12T16:00:00Z", "endTime": "2025-02-12T17:00:00Z" }, "displayDateTime": { "year": 2025, "month": 2, "day": 12, "hours": 8, "utcOffset": "-28800s" }, "isDaytime": true, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/cloudy", "description": { "text": "Cloudy", "languageCode": "en" }, "type": "CLOUDY" }, /.../ } ], "timeZone": { "id": "America/Los_Angeles" } }
جرِّبها الآن
يتيح لك "مستكشف واجهات برمجة التطبيقات" تقديم طلبات نموذجية لتتعرّف على واجهة برمجة التطبيقات وخياراتها.
انقر على رمز واجهة برمجة التطبيقات api في يسار الصفحة.
عدِّل مَعلمات الطلب اختياريًا.
انقر على الزر تنفيذ. في مربّع الحوار، اختَر الحساب الذي تريد استخدامه لتقديم الطلب.
في لوحة "مستكشف واجهات برمجة التطبيقات"، انقر على رمز ملء الشاشة fullscreen لتوسيع نافذة "مستكشف واجهات برمجة التطبيقات".