[Open API] OpenweatherMap Open API
OpenweatherMap
날씨 정보를 제공하는 OpenAPI로 APi key를 발급받아 사용한다.
https://www.openweathermap.org/
Usage
OpenWeatherMap은 API 호출시 API Key를 APPID
파라미터로 전달한다. 예를 들어 서울의 날씨를 얻으려면
1 | api.openweathermap.org/data/2.5/weather?q={city name} |
그러나 한 API Key로 10분에 1번 호출 해야 한다.
API Key
4ecbcfa0c4210bfff11d93ea02cd9290
1 | http://api.openweathermap.org/data/2.5/weather?q=seoul,kr&appid=4ecbcfa0c4210bfff11d93ea02cd9290 |
API 가입
https://openweathermap.org/api 에서 원하는 API를 골라 Subscribe 한 후에 사용할 수 있다. 가입 자격에 따라서 API 호출 빈도가 달라진다.
Weather data
JSON
Example of API respond:
1 | { |
Parameters:
- coord
- coord.lon City geo location, longitude
- coord.lat City geo location, latitude
- weather (more info Weather condition codes)
- weather.id Weather condition id
- weather.main Group of weather parameters (Rain, Snow, Extreme etc.)
- weather.description Weather condition within the group
- weather.icon Weather icon id
- base Internal parameter
main
main.temp Temperature. Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
main.pressure Atmospheric pressure (on the sea level, if there is no sea_level or grnd_level data), hPa
main.humidity Humidity, %
main.temp_min Minimum temperature at the moment. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded (use these parameter optionally). Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
main.temp_max Maximum temperature at the moment. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded (use these parameter optionally). Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
main.sea_level Atmospheric pressure on the sea level, hPa
main.grnd_level Atmospheric pressure on the ground level, hPa
wind
wind.speed Wind speed. Unit Default: meter/sec, Metric: meter/sec, Imperial: miles/hour.
wind.deg Wind direction, degrees (meteorological)
clouds
clouds.all Cloudiness, %
rain
rain.3h Rain volume for the last 3 hours
snow
snow.3h Snow volume for the last 3 hours
dt Time of data calculation, unix, UTC
sys
sys.type Internal parameter
sys.id Internal parameter
sys.message Internal parameter
sys.country Country code (GB, JP etc.)
sys.sunrise Sunrise time, unix, UTC
sys.sunset Sunset time, unix, UTC
id City ID
name City name
cod Internal parameter
[Open API] OpenweatherMap Open API
https://blog.thinkbee.kr/openapi-openweathermap-2e5b7fc2d52e/