LESSON
20
5日間(3時間ごと)の天気を調べる方法
都市名で指定(By city name)
:cityは国コードも指定
http://api.openweathermap.org/data/2.5/forecast?q={city}&
appid={key}&lang=ja&units=metric
都市IDで指定(By city ID)
http://api.openweathermap.org/data/2.5/forecast?id={cityID}
&appid={key}&lang=ja&units=metric
緯度経度で指定
(By geographic coordinates)
http://api.openweathermap.org/data/2.5/forecast?lat={lat}&
lon={lon}&appid={key}&lang=ja&units=metric
郵便番号で指定(By ZIP code)
:zipCodeは国コードも指定
http://api.openweathermap.org/data/2.5/forecast?zip=
{zipCode}&appid={key}&lang=ja&units=metric
5日間の天気を取得する
それでは、「都市名で指定して、5日間の天気を取得する」を試してみましょう。
以下が、都市名で指定するときの書き方ですが、この
{city}を都市名に、{key}をAPIキー
に置き換えてリクエストします。 ...