0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

はじめに

こちらの記事は前回の続きです。

レスポンス

今回は&lang=jaをつけて日本語で情報を取得。

https://api.openweathermap.org/data/2.5/weather?lat=35.71005584999215&lon=139.81071722377004&appid=xxxxxxxxxxxxxxxxxx&lang=ja

上記のAPIを叩くと以下のレスポンスを受け取ることができる。(appidは自身のAPIkeyを指定)

{
	"coord": {
		"lon": 139.8107,
		"lat": 35.7101
	},
	"weather": [
		{
			"id": 502,
			"main": "Rain",
			"description": "強い雨",
			"icon": "10d"
		}
	],
	"base": "stations",
	"main": {
		"temp": 299.47,
		"feels_like": 299.47,
		"temp_min": 297.61,
		"temp_max": 299.94,
		"pressure": 1002,
		"humidity": 84,
		"sea_level": 1002,
		"grnd_level": 1002
	},
	"visibility": 10000,
	"wind": {
		"speed": 4.63,
		"deg": 180
	},
	"rain": {
		"1h": 6.14
	},
	"clouds": {
		"all": 75
	},
	"dt": 1720744604,
	"sys": {
		"type": 2,
		"id": 268105,
		"country": "JP",
		"sunrise": 1720726448,
		"sunset": 1720778291
	},
	"timezone": 32400,
	"id": 1857140,
	"name": "南千住",
	"cod": 200
}

レスポンス情報

注意点

気温の数値がケルビン温度で応答されるので、摂氏温度にするには273.15を引けばよさそう。

項目 説明
coord
- lon 139.8107 (都市の地理位置、経度)
- lat 35.7101 (都市の地理位置、緯度)
weather 配列で複数の気象条件を保持(詳しくはこちら
- id 502 (気象条件ID)
- main Rain (気象パラメータのグループ:雨、雪、雲など)
- description 強い雨 (グループ内の気象条件)(詳しくはこちら
- icon 10d (天気アイコンID)
base stations (内部パラメータ)
main
- temp 299.47 (気温:ケルビン温度)
- feels_like 299.47 (体感温度:ケルビン温度)
- temp_min 297.61 (現時点での最低気温:ケルビン温度)
- temp_max 299.94 (現時点での最高気温:ケルビン温度)
- pressure 1002 (海面上の気圧:ヘクトパスカル)
- humidity 84 (湿度:パーセント)
- sea_level 1002 (海面上の気圧:ヘクトパスカル)
- grnd_level 1002 (地表面上の気圧:ヘクトパスカル)
visibility 10000 (視認性:メートル、最大値は10km)
wind
- speed 4.63 (風速:メートル毎秒)
- deg 180 (風向き:度)
rain
- 1h 6.14 (過去1時間の降雨量:ミリメートル)
clouds
- all 75 (曇り度:パーセント)
dt 1720744604 (データ計算時刻:Unix時間、UTC)
sys
- type 2 (内部パラメータ)
- id 268105 (内部パラメータ)
- country JP (国コード:日本)
- sunrise 1720726448 (日の出時刻:Unix時間、UTC)
- sunset 1720778291 (日没時刻:Unix時間、UTC)
timezone 32400 (UTCからの秒単位のシフト)
id 1857140 (都市ID)
name 南千住 (都市名)
cod 200 (内部パラメータ)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?