forecast.days 엔드포인트는 특정 위치에 대한 최대 10일의 예측 정보를 현재 날짜부터 반환합니다. API는 다음을 반환합니다.
- 낮 (오전 7시~오후 7시) 및 밤 (오후 7시~오전 7시) 날씨 상태에 관한 설명과 해당 아이콘
- 일일 최고 및 최저 기온
- 일일 최대 및 최저 체감 ('느껴지는') 온도
- 열 지수
- 상대 습도
- 자외선 지수
- 강수 확률, 비율, 수량, 유형
- 뇌우 가능성
- 해수면 기압
- 체감 온도
- 풍향 방향, 속도, 돌풍
- 얼음 두께
- 가시성 및 구름 덮음
- 일출, 일몰, 달이 뜨는 시간, 달이 지는 시간
일일 예측 요청 정보
현재 상태를 요청하려면 다음 주소로 HTTP GET 요청을 전송합니다.
https://weather.googleapis.com/v1/forecast/days:lookup?key=YOUR_API_KEY&location.latitude=LATITUDE&location.longitude=LONGITUDE
요청 URL 매개변수에 위치의 위도 및 경도 좌표를 포함합니다.
일일 예측 요청 예시
기본적으로 forecast.days 엔드포인트는 현재 시간부터 시작하여 10일간의 데이터를 반환합니다. days
매개변수를 사용하여 요청 범위를 특정 일 수로 제한할 수 있습니다.
다음 예는 캘리포니아 마운틴뷰의 향후 2일 동안의 일일 예측 정보를 요청합니다.
curl -X GET "https://weather.googleapis.com/v1/forecast/days:lookup?key=YOUR_API_KEY&location.latitude=37.4220 &location.longitude=-122.0841 &days=2"
응답에서 interval
객체는 각 날짜의 정보를 나타냅니다.
{ "forecastDays": [ { "interval": { "startTime": "2025-02-10T15:00:00Z", "endTime": "2025-02-11T15:00:00Z" }, "displayDate": { "year": 2025, "month": 2, "day": 10 }, "daytimeForecast": { "interval": { "startTime": "2025-02-10T15:00:00Z", "endTime": "2025-02-11T03:00:00Z" }, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/party_cloudy", "description": { "text": "Partly sunny", "languageCode": "en" }, "type": "PARTLY_CLOUDY" }, "relativeHumidity": 54, "uvIndex": 3, "precipitation": { "probability": { "percent": 5, "type": "RAIN" }, "qpf": { "quantity": 0, "unit": "MILLIMETERS" } }, "thunderstormProbability": 0, "wind": { "direction": { "degrees": 280, "cardinal": "WEST" }, "speed": { "value": 6, "unit": "KILOMETERS_PER_HOUR" }, "gust": { "value": 14, "unit": "KILOMETERS_PER_HOUR" } }, "cloudCover": 53 }, "nighttimeForecast": { "interval": { "startTime": "2025-02-11T03:00:00Z", "endTime": "2025-02-11T15:00:00Z" }, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/partly_clear", "description": { "text": "Partly cloudy", "languageCode": "en" }, "type": "PARTLY_CLOUDY" }, "relativeHumidity": 85, "uvIndex": 0, "precipitation": { "probability": { "percent": 10, "type": "RAIN_AND_SNOW" }, "qpf": { "quantity": 0, "unit": "MILLIMETERS" } }, "thunderstormProbability": 0, "wind": { "direction": { "degrees": 201, "cardinal": "SOUTH_SOUTHWEST" }, "speed": { "value": 6, "unit": "KILOMETERS_PER_HOUR" }, "gust": { "value": 14, "unit": "KILOMETERS_PER_HOUR" } }, "cloudCover": 70 }, "maxTemperature": { "degrees": 13.3, "unit": "CELSIUS" }, "minTemperature": { "degrees": 1.5, "unit": "CELSIUS" }, "feelsLikeMaxTemperature": { "degrees": 13.3, "unit": "CELSIUS" }, "feelsLikeMinTemperature": { "degrees": 1.5, "unit": "CELSIUS" }, "sunEvents": { "sunriseTime": "2025-02-10T15:02:35.703929582Z", "sunsetTime": "2025-02-11T01:43:00.762932858Z" }, "moonEvents": { "moonPhase": "WAXING_GIBBOUS", "moonriseTimes": [ "2025-02-10T23:54:17.713157984Z" ], "moonsetTimes": [ "2025-02-10T14:13:58.625181191Z" ] }, "maxHeatIndex": { "degrees": 13.3, "unit": "CELSIUS" }, "iceThickness": { "thickness": 0, "unit": "MILLIMETERS" } }, { "interval": { "startTime": "2025-02-11T15:00:00Z", "endTime": "2025-02-12T15:00:00Z" }, "displayDate": { "year": 2025, "month": 2, "day": 11 }, "daytimeForecast": { "interval": { "startTime": "2025-02-11T15:00:00Z", "endTime": "2025-02-12T03:00:00Z" }, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/scattered_showers", "description": { "text": "Scattered showers", "languageCode": "en" }, "type": "SCATTERED_SHOWERS" }, /.../ } } ], "timeZone": { "id": "America/Los_Angeles" } }
페이지당 반환할 일 수 지정
pageSize
URL 매개변수를 사용하여 페이지당 반환할 데이터 일 수를 지정할 수 있습니다. 기본값은 페이지당 5일의 예측 정보입니다.
정보가 여러 페이지인 응답에는 nextPageToken
가 포함됩니다. 다음 페이지의 정보를 보려면 요청의 pageToken
매개변수에 nextPageToken
값을 전달합니다.
다음 예에서는 페이지당 3일씩 캘리포니아 마운틴뷰의 6일 동안의 일기예보 데이터를 요청합니다.
curl -X GET "https://weather.googleapis.com/v1/forecast/days:lookup?key=YOUR_API_KEY&location.latitude=37.4220 &location.longitude=-122.0841 &days=6&pageSize=3"
응답은 처음 3일의 데이터를 포함하며 다음과 같은 형식입니다.
{ "forecastDays": [ { "interval": { "startTime": "2025-02-10T15:00:00Z", "endTime": "2025-02-11T15:00:00Z" }, "displayDate": { "year": 2025, "month": 2, "day": 10 }, "daytimeForecast": { "interval": { "startTime": "2025-02-10T15:00:00Z", "endTime": "2025-02-11T03:00:00Z" }, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/party_cloudy", "description": { "text": "Partly sunny", "languageCode": "en" }, "type": "PARTLY_CLOUDY" }, "relativeHumidity": 52, "uvIndex": 3, "precipitation": { "probability": { "percent": 5, "type": "RAIN" }, "qpf": { "quantity": 0, "unit": "MILLIMETERS" } }, "thunderstormProbability": 0, "wind": { "direction": { "degrees": 280, "cardinal": "WEST" }, "speed": { "value": 6, "unit": "KILOMETERS_PER_HOUR" }, "gust": { "value": 14, "unit": "KILOMETERS_PER_HOUR" } }, "cloudCover": 53 }, "nighttimeForecast": { "interval": { "startTime": "2025-02-11T03:00:00Z", "endTime": "2025-02-11T15:00:00Z" }, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/partly_clear", "description": { "text": "Partly cloudy", "languageCode": "en" }, "type": "PARTLY_CLOUDY" }, "relativeHumidity": 85, "uvIndex": 0, "precipitation": { "probability": { "percent": 10, "type": "RAIN_AND_SNOW" }, "qpf": { "quantity": 0, "unit": "MILLIMETERS" } }, "thunderstormProbability": 0, "wind": { "direction": { "degrees": 201, "cardinal": "SOUTH_SOUTHWEST" }, "speed": { "value": 6, "unit": "KILOMETERS_PER_HOUR" }, "gust": { "value": 14, "unit": "KILOMETERS_PER_HOUR" } }, "cloudCover": 69 }, "maxTemperature": { "degrees": 13.5, "unit": "CELSIUS" }, "minTemperature": { "degrees": 1.5, "unit": "CELSIUS" }, "feelsLikeMaxTemperature": { "degrees": 13.5, "unit": "CELSIUS" }, "feelsLikeMinTemperature": { "degrees": 1.5, "unit": "CELSIUS" }, "sunEvents": { "sunriseTime": "2025-02-10T15:02:35.703929582Z", "sunsetTime": "2025-02-11T01:43:00.762932858Z" }, "moonEvents": { "moonPhase": "WAXING_GIBBOUS", "moonriseTimes": [ "2025-02-10T23:54:17.713157984Z" ], "moonsetTimes": [ "2025-02-10T14:13:58.625181191Z" ] }, "maxHeatIndex": { "degrees": 13.5, "unit": "CELSIUS" }, "iceThickness": { "thickness": 0, "unit": "MILLIMETERS" } }, { "interval": { "startTime": "2025-02-11T15:00:00Z", "endTime": "2025-02-12T15:00:00Z" }, "displayDate": { "year": 2025, "month": 2, "day": 11 }, /.../ }, { "interval": { "startTime": "2025-02-12T15:00:00Z", "endTime": "2025-02-13T15:00:00Z" }, "displayDate": { "year": 2025, "month": 2, "day": 12 }, /.../ } ], "timeZone": { "id": "America/Los_Angeles" }, "nextPageToken": "ChYKEgm8dJMYBLZCQBH-ZffkYYVewBAGEAMYAyILCKyAqr0GEKOR6lUqE0FtZXJpY2EvTG9zX0FuZ2VsZXM=" }
데이터의 다음 페이지에 액세스하려면 요청의 pageToken
매개변수에 nextPageToken
값을 전달합니다.
curl -X GET "https://weather.googleapis.com/v1/forecast/days:lookup?key=YOUR_API_KEY&location.latitude=37.4220 &location.longitude=-122.0841 &days=6 &pageSize=3 &pageToken=ChYKEgm8dJMYBLZCQBH-ZffkYYVewBAGEAMYAyILCKyAqr0GEKOR6lUqE0FtZXJpY2EvTG9zX0FuZ2VsZXM="
응답 형식은 다음과 같습니다.
{ "forecastDays": [ { "interval": { "startTime": "2025-02-13T15:00:00Z", "endTime": "2025-02-14T15:00:00Z" }, "displayDate": { "year": 2025, "month": 2, "day": 13 }, "daytimeForecast": { "interval": { "startTime": "2025-02-13T15:00:00Z", "endTime": "2025-02-14T03:00:00Z" }, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/drizzle", "description": { "text": "Light rain", "languageCode": "en" }, "type": "LIGHT_RAIN" }, "relativeHumidity": 81, "uvIndex": 2, "precipitation": { "probability": { "percent": 75, "type": "RAIN" }, "qpf": { "quantity": 15.588, "unit": "MILLIMETERS" } }, "thunderstormProbability": 20, "wind": { "direction": { "degrees": 181, "cardinal": "SOUTH" }, "speed": { "value": 14, "unit": "KILOMETERS_PER_HOUR" }, "gust": { "value": 32, "unit": "KILOMETERS_PER_HOUR" } }, "cloudCover": 100 }, "nighttimeForecast": { "interval": { "startTime": "2025-02-14T03:00:00Z", "endTime": "2025-02-14T15:00:00Z" }, "weatherCondition": { "iconBaseUri": "https://maps.gstatic.com/weather/v1/showers", "description": { "text": "Rain showers", "languageCode": "en" }, "type": "RAIN_SHOWERS" }, "relativeHumidity": 87, "uvIndex": 0, "precipitation": { "probability": { "percent": 75, "type": "RAIN" }, "qpf": { "quantity": 11.3513, "unit": "MILLIMETERS" } }, "thunderstormProbability": 10, "wind": { "direction": { "degrees": 222, "cardinal": "SOUTHWEST" }, "speed": { "value": 14, "unit": "KILOMETERS_PER_HOUR" }, "gust": { "value": 31, "unit": "KILOMETERS_PER_HOUR" } }, "cloudCover": 95 }, "maxTemperature": { "degrees": 15.9, "unit": "CELSIUS" }, "minTemperature": { "degrees": 11.2, "unit": "CELSIUS" }, "feelsLikeMaxTemperature": { "degrees": 15.9, "unit": "CELSIUS" }, "feelsLikeMinTemperature": { "degrees": 11, "unit": "CELSIUS" }, "sunEvents": { "sunriseTime": "2025-02-13T14:59:17.439839464Z", "sunsetTime": "2025-02-14T01:46:14.345904643Z" }, "moonEvents": { "moonPhase": "WANING_GIBBOUS", "moonriseTimes": [ "2025-02-14T03:08:04.049988754Z" ], "moonsetTimes": [ "2025-02-13T15:44:40.326916694Z" ] }, "maxHeatIndex": { "degrees": 15.9, "unit": "CELSIUS" }, "iceThickness": { "thickness": 0, "unit": "MILLIMETERS" } }, { "interval": { "startTime": "2025-02-14T15:00:00Z", "endTime": "2025-02-15T15:00:00Z" }, "displayDate": { "year": 2025, "month": 2, "day": 14 }, /.../ }, { "interval": { "startTime": "2025-02-15T15:00:00Z", "endTime": "2025-02-16T15:00:00Z" }, "displayDate": { "year": 2025, "month": 2, "day": 15 }, /.../ } ], "timeZone": { "id": "America/Los_Angeles" } }