๐Ÿค”โ“ OpenWeatherMap์˜ ์˜คํ”ˆ API(๋‚ ์”จapi)

์ดํฌ์—ฐยท2025๋…„ 5์›” 29์ผ

๐ŸŒค๏ธ OpenWeatherMap์˜ ์˜คํ”ˆ API ์ฃผ์†Œ

๐ŸŒค๏ธ OpenWeatherMap API ๊ธฐ๋ณธ ์—”๋“œํฌ์ธํŠธ

https://api.openweathermap.org/data/2.5/weather

๐Ÿ”‘ ๊ธฐ๋ณธ ์š”์ฒญ ํ˜•์‹ (์˜ˆ์‹œ)

https://api.openweathermap.org/data/2.5/weather?q=Seoul&appid=YOUR_API_KEY&units=metric
  • q=Seoul : ๋„์‹œ ์ด๋ฆ„ (์˜ˆ: ์„œ์šธ)
  • appid=YOUR_API_KEY : ๋ณธ์ธ์˜ API ํ‚ค
  • units=metric : ์„ญ์”จ๋กœ ์˜จ๋„๋ฅผ ๋ฐ›์œผ๋ ค๋ฉด metric, ํ™”์”จ๋Š” imperial


๐Ÿ”‘ OpenWeatherMap API ํ‚ค ๋ฐœ๊ธ‰ํ•˜๋Š” ๋ฐฉ๋ฒ•

  1. ์‚ฌ์ดํŠธ ์ ‘์†
    ๐Ÿ‘‰ https://openweathermap.org/

  2. ์˜ค๋ฅธ์ชฝ ์ƒ๋‹จ์˜ Sign In ํด๋ฆญ
    (์ด๋ฏธ ๊ณ„์ • ์žˆ์œผ๋ฉด ๋กœ๊ทธ์ธ, ์—†์œผ๋ฉด Sign Up ํด๋ฆญํ•ด์„œ ํšŒ์›๊ฐ€์ž…)

  3. ํšŒ์›๊ฐ€์ž… ์‹œ ์ž…๋ ฅํ•  ๊ฒƒ๋“ค

    • ์ด๋ฉ”์ผ ์ฃผ์†Œ
    • ๋น„๋ฐ€๋ฒˆํ˜ธ
    • ์ด๋ฆ„ ๋“ฑ ๊ธฐ๋ณธ ์ •๋ณด
  4. ๋กœ๊ทธ์ธ ํ›„ ๋‹ค์Œ ํŽ˜์ด์ง€๋กœ ์ด๋™
    ๐Ÿ‘‰ https://home.openweathermap.org/api_keys

  5. "Create Key" ๋˜๋Š” "API ํ‚ค ์ƒ์„ฑ" ๋ฒ„ํŠผ ํด๋ฆญ

    • ์ด๋ฆ„์€ ์•„๋ฌด๊ฑฐ๋‚˜ ์˜ˆ: weatherAppKey
    • ์ƒ์„ฑ๋˜๋ฉด Your API keys ๋ชฉ๋ก์— ๋‚˜์˜ด
  6. ํ•ด๋‹น API ํ‚ค ๋ณต์‚ฌํ•ด์„œ ์‚ฌ์šฉ


๐Ÿงผ ์ฐธ๊ณ ๋กœ

  • **๋ฌด๋ฃŒ ํ”Œ๋žœ(free tier)**์€ ํ•˜๋ฃจ์— ์•ฝ 1000๋ฒˆ ์ •๋„ ์š”์ฒญ ๊ฐ€๋Šฅํ•˜๋‹ˆ ํ…Œ์ŠคํŠธ์šฉ์œผ๋กœ๋Š” ์ถฉ๋ถ„ํ•จ.
  • ์ด๋ฉ”์ผ ์ธ์ฆ ๋ฉ”์ผ์ด ์˜ฌ ์ˆ˜๋„ ์žˆ์œผ๋‹ˆ๊นŒ ์ŠคํŒธํ•จ๋„ ํ™•์ธ!


๐Ÿงฉ URL ๊ตฌ์กฐ ์„ค๋ช…

https://api.openweathermap.org/data/2.5/weather?q=Seoul&appid=YOUR_API_KEY&units=metric
๋ถ€๋ถ„๋œป
https://api.openweathermap.org/data/2.5/weather๐Ÿ‘‰ API ๊ธฐ๋ณธ ์ฃผ์†Œ (๋‚ ์”จ ์กฐํšŒ์šฉ)
?๐Ÿ‘‰ **์—ฌ๊ธฐ๋ถ€ํ„ฐ๋Š” ์˜ต์…˜(ํŒŒ๋ผ๋ฏธํ„ฐ)**๋ฅผ ๋„ฃ๋Š”๋‹ค๋Š” ๋œป
q=Seoul๐Ÿ‘‰ ๋„์‹œ ์ด๋ฆ„ (์—ฌ๊ธฐ์„  ์„œ์šธ)
&๐Ÿ‘‰ ์—ฌ๋Ÿฌ ์˜ต์…˜์„ ์ด์–ด๋ถ™์ผ ๋•Œ ์”€
appid=YOUR_API_KEY๐Ÿ‘‰ ๋„ค API ํ‚ค (๋ฐ˜๋“œ์‹œ ๋„ฃ์–ด์•ผ ํ•จ!)
units=metric๐Ÿ‘‰ ์˜จ๋„ ๋‹จ์œ„: metric์€ ์„ญ์”จ, imperial์€ ํ™”์”จ, ๊ธฐ๋ณธ์€ ์ผˆ๋นˆ(K)

๐Ÿ” ์‰ฝ๊ฒŒ ๋ฐ”๊พธ๊ธฐ

  • ์„œ์šธ ๋ง๊ณ  ๋ถ€์‚ฐ: q=Busan
  • ํ™”์”จ๋กœ ๋ณด๊ณ  ์‹ถ๋‹ค๋ฉด: units=imperial
  • API ํ‚ค๋Š” ๋„ค ํ‚ค๋กœ YOUR_API_KEY ๋ถ€๋ถ„๋งŒ ๋ฐ”๊พธ๋ฉด ๋œ๋‹ค.

๐Ÿ’ก ์˜ˆ์‹œ

https://api.openweathermap.org/data/2.5/weather?q=Busan&appid=abc123xyz456&units=metric

profile
์ฝ”๋ฆฐ์ด๐ŸŒฑ / ๊ฐœ์ธ์ ์ธ ๊ณต๋ถ€๊ธฐ๋ก ๊ณต๊ฐ„์ž…๋‹ˆ๋‹ค, ์ œ๋กœ๋ฒ ์ด์Šค๋ถ€ํŠธ์บ ํ”„ ์ˆ˜๊ฐ•์ค‘...๐Ÿ˜„

0๊ฐœ์˜ ๋Œ“๊ธ€