تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تقدّم نقطة نهاية forecast معلومات عن توقّعات جودة الهواء كل ساعة لمدة تصل إلى 96 ساعة (4 أيام) في موقع جغرافي معيّن. يتضمّن كل توقّع مؤشرات جودة الهواء كل ساعة، بالإضافة إلى معلومات إضافية:
وقت وتاريخ محدّدان أو فترة زمنية للتوقّعات
رمز اللغة للحقول المترجَمة
مؤشر جودة الهواء (AQI) المحلي أو المخصّص
اقتراحات بشأن الصحة
الملوّثات السائدة
تركيز الملوّث
معلومات إضافية حول الملوّثات
حجم صفحة الردّ
لوحة الألوان
يتيح لك "مستكشف واجهات برمجة التطبيقات" إرسال طلبات مباشرة لتتعرّف على واجهة برمجة التطبيقات وخياراتها:
أدرِج
المَعلمات
في نص الطلب. يحتوي نص الطلب على الموقع الجغرافي الذي تريد الحصول على معلومات توقّعات جودة الهواء كل ساعة بشأنه، بالإضافة إلى خيارات متنوعة للتحكّم في المعلومات الإضافية التي سيتم تضمينها في الرد.
لمحة عن الردود على التوقعات
يوفّر نص الردّ التاريخ والوقت بتوقيت غرينتش الذي سيتم عرض معلومات توقّعات جودة الهواء ومؤشرات جودة الهواء والمعلومات المخصّصة الإضافية بشأنهما. يتضمّن نص الاستجابة أيضًا رمزًا مميزًا لاسترداد الصفحة التالية إذا لم تتضمّن الصفحة المطلوبة جميع المعلومات.
مثال على طلب أساسي
يوضّح الرمز التالي كيفية إنشاء طلب توقّع. في هذا المثال، يمكنك تحديد الموقع الجغرافي والتاريخ والوقت (بدءًا من الساعة التالية وحتى 96 ساعة) الذي تريد عرض معلومات توقّعات جودة الهواء فيه كل ساعة.
{"hourlyForecasts":[{"dateTime":"2024-02-09T08:00:00Z","indexes":[{"code":"uaqi","displayName":"Universal AQI","aqi":80,"aqiDisplay":"80","color":{"red":0.34509805,"green":0.74509805,"blue":0.20784314},"category":"Excellent air quality","dominantPollutant":"pm25"}]}],"regionCode":"us"}
مثال على طلب يتضمّن مَعلمات متعدّدة
يوضّح الرمز التالي كيفية إنشاء نص طلب يتضمّن مَعلمات متعدّدة. في هذا المثال، عليك تحديد ما يلي:
الموقع الجغرافي
الفترة الزمنية التي سيتم عرض معلومات توقّعات جودة الهواء فيها
رمز اللغة
عمليات حسابية إضافية (مثل اقتراحات بشأن الصحة، وتركيز الملوّث السائد، ومعلومات إضافية عن الملوّثات)
يؤدي ذلك إلى عرض الصفحة التالية من معلومات التوقعات:
{"hourlyForecasts":[{"dateTime":"2024-02-27T21:00:00Z","indexes":[{"code":"uaqi","displayName":"Universal AQI","aqi":74,"aqiDisplay":"74","color":{"red":0.44705883,"green":0.78431374,"blue":0.2},"category":"Good air quality","dominantPollutant":"o3"}],"pollutants":[{"code":"o3","displayName":"O3","fullName":"Ozone","concentration":{"value":32.07,"units":"PARTS_PER_BILLION"},"additionalInfo":{"sources":"...","effects":"..."}}],"healthRecommendations":{"generalPopulation":"...","elderly":"...","lungDiseasePopulation":"...","heartDiseasePopulation":"...","athletes":"...","pregnantWomen":"...","children":"..."}},{"dateTime":"2024-02-27T22:00:00Z","indexes":[{"code":"uaqi","displayName":"Universal AQI","aqi":75,"aqiDisplay":"75","color":{"red":0.43137255,"green":0.7764706,"blue":0.20392157},"category":"Good air quality","dominantPollutant":"o3"}],"pollutants":[{"code":"o3","displayName":"O3","fullName":"Ozone","concentration":{"value":30.94,"units":"PARTS_PER_BILLION"},"additionalInfo":{"sources":"...","effects":"..."}}],"healthRecommendations":{"generalPopulation":"...","lungDiseasePopulation":"...","heartDiseasePopulation":"...","athletes":"...","pregnantWomen":"...","children":"..."}},/.../]"regionCode":"us"}
جرِّبها الآن
يتيح لك "مستكشف واجهات برمجة التطبيقات" تقديم طلبات نموذجية لتتعرّف على واجهة برمجة التطبيقات وخياراتها.
انقر على رمز واجهة برمجة التطبيقات api
في يسار الصفحة.
عدِّل مَعلمات الطلب اختياريًا.
انقر على الزر تنفيذ. في مربّع الحوار، اختَر الحساب الذي تريد استخدامه لتقديم الطلب.
في لوحة "مستكشف واجهات برمجة التطبيقات"، انقر على رمز ملء الشاشة
fullscreen لتوسيع نافذة "مستكشف واجهات برمجة التطبيقات".
تاريخ التعديل الأخير: 2025-08-31 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-31 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe Air Quality API's forecast endpoint provides hourly air quality forecasts for up to 96 hours (4 days) for a specified location.\u003c/p\u003e\n"],["\u003cp\u003eForecast data includes air quality indexes, dominant pollutants, health recommendations, pollutant concentrations, and more.\u003c/p\u003e\n"],["\u003cp\u003eRequests are made via HTTP POST to the endpoint with parameters specifying location, time, and optional data inclusions.\u003c/p\u003e\n"],["\u003cp\u003eResponses contain hourly forecast data, potentially paginated, with a token for retrieving subsequent pages if necessary.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can customize requests to include specific language codes, color palettes, and additional computations for a tailored response.\u003c/p\u003e\n"]]],[],null,["The [`forecast`](/maps/documentation/air-quality/reference/rest/v1/forecast/lookup) endpoint\nprovides up to 96 hours (4 days) of hourly air\nquality forecast information for a given location. Each forecast includes hourly\nair quality indexes as well as additional information:\n\n- Specific time and date or time period for forecast\n- Language code for translated fields\n- Local or custom air quality index (AQI)\n- Health recommendations\n- Dominant pollutants\n- Pollutant concentration\n- Additional information about pollutants\n- Response page size\n- Color palette\n\nThe APIs Explorer lets you make live requests so that you can get familiar with\nthe API and the API options: \n[Try it!](#try_it)\n| To get air quality forecasts, set the `dateTime` parameter to a future date and time, as shown in the [basic\n| request example](/maps/documentation/air-quality/forecast#example_of_basic_request) below.\n\nAbout forecast requests\n\nYou can request hourly air quality forecast information using the\nforecast endpoint by sending an HTTP POST request to: \n\n```html\nhttps://airquality.googleapis.com/v1/forecast:lookup?key=YOUR_API_KEY\n```\n\nInclude your\n[parameters](/maps/documentation/air-quality/reference/rest/v1/forecast/lookup#request-body)\nin the request body. The request body contains the location for which you would\nlike to get air quality hourly forecast information and various options to\ncontrol what additional information to include in the response.\n\nAbout forecast responses\n\nThe response body provides the UTC date and time for which to display air\nquality forecast information, air quality indexes, and additional customized\ninformation. The response body also includes a token to retrieve the next page\nif the information does not fit within the requested page size.\n\nExample of basic request\n\nThe following code shows how to construct a forecast request. In this example,\nyou specify the location, date and time (beginning from the next hour up to 96\nhours) for which to show hourly air quality forecast information. \n\n```bash\ncurl -X POST -d '{\n \"location\": {\n \"latitude\": 37.4125333,\n \"longitude\": -122.0840937\n },\n \"dateTime\": \"2024-02-09T08:00:00Z\"\n}' \\\n-H \"Content-Type: application/json\" \\\n-H \"Accept-Language: *\" \\\n\"https://airquality.googleapis.com/v1/forecast:lookup?key=YOUR_API_KEY\"\n```\n\nThe call generates the following JSON response. \n\n```json\n{\n \"hourlyForecasts\": [\n {\n \"dateTime\": \"2024-02-09T08:00:00Z\",\n \"indexes\": [\n {\n \"code\": \"uaqi\",\n \"displayName\": \"Universal AQI\",\n \"aqi\": 80,\n \"aqiDisplay\": \"80\",\n \"color\": {\n \"red\": 0.34509805,\n \"green\": 0.74509805,\n \"blue\": 0.20784314\n },\n \"category\": \"Excellent air quality\",\n \"dominantPollutant\": \"pm25\"\n }\n ]\n }\n ],\n \"regionCode\": \"us\"\n}\n```\n| **Note:** If a `color` field value is `0`, that field is omitted from the response.\n\nExample of request with multiple parameters\n\nThe following code shows how to construct a request body with multiple\nparameters. In this example, you specify the following:\n\n- Location\n- Time period for which to display air quality forecast information\n- Language code\n- Extra computations (such as health recommendations, the dominant pollutant concentration, and additional pollutant information)\n- Color palette\n\n```bash\ncurl -X POST -d '{\n \"pageSize\": \"10\",\n \"universalAqi\": \"true\",\n \"location\": {\n \"latitude\": \"40.741895\",\n \"longitude\": \"-73.989308\"\n },\n \"period\": {\n \"startTime\": \"2024-02-27T13:58:14+02:00\",\n \"endTime\": \"2024-02-28T16:58:14+02:00\"\n },\n \"languageCode\": \"en\",\n \"extraComputations\": [\n \"HEALTH_RECOMMENDATIONS\",\n \"DOMINANT_POLLUTANT_CONCENTRATION\",\n \"POLLUTANT_ADDITIONAL_INFO\"\n ],\n \"uaqiColorPalette\": \"RED_GREEN\"\n}' \\\n-H \"Content-Type: application/json\" \\\n-H \"Accept-Language: *\" \\\n\"https://airquality.googleapis.com/v1/forecast:lookup?key=YOUR_API_KEY\"\n```\n\nThe call generates the following JSON response. \n\n```json\n{\n {\n \"hourlyForecasts\": [\n {\n \"dateTime\": \"2024-02-27T11:00:00Z\",\n \"indexes\": [\n {\n \"code\": \"uaqi\",\n \"displayName\": \"Universal AQI\",\n \"aqi\": 75,\n \"aqiDisplay\": \"75\",\n \"color\": {\n \"red\": 0.43137255,\n \"green\": 0.7764706,\n \"blue\": 0.20392157\n },\n \"category\": \"Good air quality\",\n \"dominantPollutant\": \"pm25\"\n }\n ],\n \"pollutants\": [\n {\n \"code\": \"pm25\",\n \"displayName\": \"PM2.5\",\n \"fullName\": \"Fine particulate matter (\\u003c2.5µm)\",\n \"concentration\": {\n \"value\": 15.1,\n \"units\": \"MICROGRAMS_PER_CUBIC_METER\"\n },\n \"additionalInfo\": {\n \"sources\": \"...\",\n \"effects\": \"...\"\n }\n }\n ],\n \"healthRecommendations\": {\n \"generalPopulation\": \"...\",\n \"lungDiseasePopulation\": \"...\",\n \"heartDiseasePopulation\": \"...\",\n \"athletes\": \"...\",\n \"pregnantWomen\": \"...\"\n }\n },\n {\n \"dateTime\": \"2024-02-27T12:00:00Z\",\n \"indexes\": [\n {\n \"code\": \"uaqi\",\n \"displayName\": \"Universal AQI\",\n \"aqi\": 67,\n \"aqiDisplay\": \"67\",\n \"color\": {\n \"red\": 0.5882353,\n \"green\": 0.8392157,\n \"blue\": 0.16862746\n },\n \"category\": \"Good air quality\",\n \"dominantPollutant\": \"pm25\"\n }\n ],\n \"pollutants\": [\n {\n \"code\": \"pm25\",\n \"displayName\": \"PM2.5\",\n \"fullName\": \"Fine particulate matter (\\u003c2.5µm)\",\n \"concentration\": {\n \"value\": 19.96,\n \"units\": \"MICROGRAMS_PER_CUBIC_METER\"\n },\n \"additionalInfo\": {\n \"sources\": \"...\",\n \"effects\": \"...\"\n }\n }\n ],\n \"healthRecommendations\": {\n \"generalPopulation\": \"...\",\n \"lungDiseasePopulation\": \"...\",\n \"heartDiseasePopulation\": \"...\",\n \"athletes\": \"...\",\n \"pregnantWomen\": \"...\",\n \"children\": \"...\"\n }\n },\n /.../\n ]\n }\n \"regionCode\": \"us\",\n \"nextPageToken\": \"CjMKEglwCFVq9l5EQBH0aoDSUH9SwBoQCgYI1pDirgYSBgiGiOiuBiABKgMCBAMyAmVuOAEQGA==\"\n}\n```\n\nTo view the next page of forecast information, pass in the `nextPageToken`\nreturned at the end of the response body: \n\n```bash\ncurl -X POST -d '{\n \"universalAqi\": \"true\",\n \"location\": {\n \"latitude\": \"40.741895\",\n \"longitude\": \"-73.989308\"\n },\n \"period\": {\n \"startTime\": \"2024-02-27T13:58:14+02:00\",\n \"endTime\": \"2024-02-28T16:58:14+02:00\"\n },\n \"languageCode\": \"en\",\n \"extraComputations\": [\n \"HEALTH_RECOMMENDATIONS\",\n \"DOMINANT_POLLUTANT_CONCENTRATION\",\n \"POLLUTANT_ADDITIONAL_INFO\"\n ],\n \"uaqiColorPalette\": \"RED_GREEN\",\n \"pageToken\": \"CjMKEglwCFVq9l5EQBH0aoDSUH9SwBoQCgYI1pDirgYSBgiGiOiuBiABKgMCBAMyAmVuOAEQGA==\"\n}' \\\n-H \"Content-Type: application/json\" \\\n-H \"Accept-Language: *\" \\\n\"https://airquality.googleapis.com/v1/forecast:lookup?key=YOUR_API_KEY\"\n```\n\nThis returns the next page of forecast information: \n\n```json\n{\n \"hourlyForecasts\": [\n {\n \"dateTime\": \"2024-02-27T21:00:00Z\",\n \"indexes\": [\n {\n \"code\": \"uaqi\",\n \"displayName\": \"Universal AQI\",\n \"aqi\": 74,\n \"aqiDisplay\": \"74\",\n \"color\": {\n \"red\": 0.44705883,\n \"green\": 0.78431374,\n \"blue\": 0.2\n },\n \"category\": \"Good air quality\",\n \"dominantPollutant\": \"o3\"\n }\n ],\n \"pollutants\": [\n {\n \"code\": \"o3\",\n \"displayName\": \"O3\",\n \"fullName\": \"Ozone\",\n \"concentration\": {\n \"value\": 32.07,\n \"units\": \"PARTS_PER_BILLION\"\n },\n \"additionalInfo\": {\n \"sources\": \"...\",\n \"effects\": \"...\"\n }\n }\n ],\n \"healthRecommendations\": {\n \"generalPopulation\": \"...\",\n \"elderly\": \"...\",\n \"lungDiseasePopulation\": \"...\",\n \"heartDiseasePopulation\": \"...\",\n \"athletes\": \"...\",\n \"pregnantWomen\": \"...\",\n \"children\": \"...\"\n }\n },\n {\n \"dateTime\": \"2024-02-27T22:00:00Z\",\n \"indexes\": [\n {\n \"code\": \"uaqi\",\n \"displayName\": \"Universal AQI\",\n \"aqi\": 75,\n \"aqiDisplay\": \"75\",\n \"color\": {\n \"red\": 0.43137255,\n \"green\": 0.7764706,\n \"blue\": 0.20392157\n },\n \"category\": \"Good air quality\",\n \"dominantPollutant\": \"o3\"\n }\n ],\n \"pollutants\": [\n {\n \"code\": \"o3\",\n \"displayName\": \"O3\",\n \"fullName\": \"Ozone\",\n \"concentration\": {\n \"value\": 30.94,\n \"units\": \"PARTS_PER_BILLION\"\n },\n \"additionalInfo\": {\n \"sources\": \"...\",\n \"effects\": \"...\"\n }\n }\n ],\n \"healthRecommendations\": {\n \"generalPopulation\": \"...\",\n \"lungDiseasePopulation\": \"...\",\n \"heartDiseasePopulation\": \"...\",\n \"athletes\": \"...\",\n \"pregnantWomen\": \"...\",\n \"children\": \"...\"\n }\n },\n /.../\n ]\n \"regionCode\": \"us\"\n}\n```\n\nTry it!\n\nThe APIs Explorer lets you make sample requests so\nthat you can get familiar with the API and the API options.\n\n1. Select the API icon api\n on the right side of the page.\n\n2. Optionally edit the request parameters.\n\n3. Select the **Execute** button. In the dialog, choose the account\n that you want to use to make the request.\n\n4. In the APIs Explorer panel, select the fullscreen icon\n fullscreen to expand the APIs Explorer window."]]