Weather API

指定した場所の現在の天気と、現地時間の 6 時から 24 時まで 3 時間刻みの天気予報を返す API です。 天気データは Open-Meteo を利用しています。

GET /api/weather?location=東京都大田区

Endpoint

GET /api/weather

レスポンス形式は JSON です。GET 以外のメソッドは 405 を返します。

Parameters

location 必須。地名または住所風の文字列を指定します。日本語も利用できます。 q も同じ意味の別名として使えます。
date 任意。YYYY-MM-DD 形式の日付を指定します。未指定の場合は対象地点の タイムゾーンにおける当日を使います。

Examples

Response

current には現在の天気、weather には 6, 9, 12, 15, 18, 21, 24 時の配列が入ります。 未知の天気コードは 不明(NN) の形式で返します。

{
  "location": {
    "name": "大田区",
    "country": "日本",
    "admin1": "東京都",
    "latitude": 35.56126,
    "longitude": 139.71605,
    "timezone": "Asia/Tokyo"
  },
  "requestedLocation": "東京都大田区",
  "searchedLocation": "大田区,東京都",
  "date": "2026-08-31",
  "intervalHours": 3,
  "hours": [6, 9, 12, 15, 18, 21, 24],
  "units": {
    "temperature": "°C",
    "humidity": "%",
    "precipitationProbability": "%",
    "precipitation": "mm",
    "windSpeed": "km/h"
  },
  "current": {
    "time": "2026-08-31T11:45",
    "weatherCode": 2,
    "weather": "一部曇り",
    "temperature": 29.1,
    "humidity": 72,
    "precipitation": 0,
    "windSpeed": 10.4
  },
  "weather": [
    {
      "time": "2026-08-31T06:00",
      "hour": 6,
      "weatherCode": 1,
      "weather": "晴れ",
      "temperature": 27.4,
      "humidity": 78,
      "precipitationProbability": 10,
      "windSpeed": 8.2
    }
  ]
}

Location Lookup

東京都大田区 のような入力は、内部で 大田区,東京都大田,東京都 の順に候補化して検索します。候補で見つからない場合は、元の入力でも検索します。

Status Codes

200 天気情報の取得に成功しました。
400 location または q が指定されていません。
404 指定された場所が見つかりません。
405 GET 以外のメソッドが使われました。
500 外部 API への問い合わせに失敗しました。