暦データAPI

日本の暦データ(祝日、六曜、日々のキーワードなど)をJSON形式で提供する無料のAPIサービスです。 GitHub Pagesでホストされ、CORS対応により様々なWebアプリケーションから利用できます。

本日のデータ
読み込み中...

概要

提供データ

  • 日付情報(年月日、曜日)
  • 日本の祝日
  • 六曜(大安、友引など)
  • 日々のキーワード
  • おすすめお茶
  • 曜日カラー

新機能

  • 検索機能 - 六曜、祝日、キーワード検索
  • 運勢診断 - 37項目統合の総合運勢
  • 週間運勢・相性診断
  • 統計情報・ラッキーデー検索
  • 完全無料・認証不要
  • レスポンシブAPIドキュメント

エンドポイント

エンドポイント 説明 レスポンス アクション
/api/2025/01.json 2025年1月のデータ 月別データオブジェクト 開く
/api/2025/02.json 2025年2月のデータ 月別データオブジェクト 開く
/api/2025/[MM].json 2025年の指定月データ(01-12) 月別データオブジェクト
/api/2025/all.json 2025年全体のデータ 年間データオブジェクト 開く

クイックアクセス

月別データ(2025年)
年間データ・形式

使用例

JavaScript / Fetch API

// 2025年1月のデータを取得
fetch('https://your-username.github.io/japanese-calendar-api/api/2025/01.json')
  .then(response => response.json())
  .then(data => {
    console.log('2025年1月のデータ:', data);
    // データを使用してカレンダーを表示
    data.days.forEach(day => {
      console.log(`${day.day}日: ${day.weekday} (${day.rokuyo})`);
      if (day.is_holiday) {
        console.log(`祝日: ${day.holiday_name}`);
      }
    });
  })
  .catch(error => console.error('エラー:', error));

// 本日のデータを取得する関数
async function getTodayData() {
  const today = new Date();
  const month = String(today.getMonth() + 1).padStart(2, '0');
  const day = today.getDate();
  
  try {
    const response = await fetch(`https://your-username.github.io/japanese-calendar-api/api/2025/${month}.json`);
    const monthData = await response.json();
    const todayData = monthData.days.find(d => d.day === day);
    return todayData;
  } catch (error) {
    console.error('データの取得に失敗しました:', error);
    return null;
  }
}

Python / requests

import requests
import json
from datetime import datetime

# 2025年全体のデータを取得
def get_yearly_data():
    url = 'https://rei-abekura-lvgs.github.io/CalendarAPI/api/2025/all.json'
    try:
        response = requests.get(url)
        response.raise_for_status()
        return response.json()
    except requests.RequestException as e:
        print(f'エラー: {e}')
        return None

# 本日のデータを取得
def get_today_data():
    today = datetime.now()
    month = f"{today.month:02d}"
    
    url = f'https://rei-abekura-lvgs.github.io/CalendarAPI/api/2025/{month}.json'
    try:
        response = requests.get(url)
        response.raise_for_status()
        month_data = response.json()
        
        # 本日のデータを検索
        today_data = next((day for day in month_data['days'] if day['day'] == today.day), None)
        return today_data
    except requests.RequestException as e:
        print(f'エラー: {e}')
        return None

# 使用例
if __name__ == '__main__':
    data = get_today_data()
    if data:
        print(f"本日は{data['weekday']}、六曜は{data['rokuyo']}です")
        print(f"今日のキーワード: {data['daily_keyword']}")
        print(f"おすすめのお茶: {data['recommended_tea']}")
        
        if data['is_holiday']:
            print(f"祝日: {data['holiday_name']}")
    else:
        print('データの取得に失敗しました')

cURL

# 2025年1月のデータを取得
curl -X GET "https://rei-abekura-lvgs.github.io/CalendarAPI/api/2025/01.json" \
     -H "Accept: application/json"

# 2025年全体のデータを取得
curl -X GET "https://rei-abekura-lvgs.github.io/CalendarAPI/api/2025/all.json" \
     -H "Accept: application/json" | jq '.'

# 特定の月のデータをファイルに保存
curl -o "january_2025.json" \
     "https://rei-abekura-lvgs.github.io/CalendarAPI/api/2025/01.json"

レスポンス形式

月別データレスポンス例

{
  "year": 2025,
  "month": 1,
  "month_name": "January",
  "month_name_jp": "1月",
  "api_version": "v1",
  "generated_at": "2025-06-20T10:00:00.000000",
  "days": [
    {
      "day": 1,
      "date": "2025-01-01",
      "weekday": "水曜日",
      "weekday_en": "Wednesday",
      "weekday_short": "Wed",
      "is_weekend": false,
      "is_holiday": true,
      "holiday_name": "元日",
      "rokuyo": "先勝",
      "season_24": null,
      "moon_phase": "調査中",
      "daily_keyword": "運命の扉が開く日",
      "color_of_the_day": "空色",
      "recommended_tea": "アールグレイ",
      "lucky_number": 1,
      "power_stone": "アメジスト",
      "aroma_oil": "ラベンダー",
      "meditation_theme": "感謝の瞑想",
      "flower_of_the_day": "桜 - 精神の美",
      "energy_advice": "今日は新しい挑戦の時",
      "...": "(他17項目)"
    }
  ]
}

主要フィールド説明

実際のAPIレスポンスには27項目の包括的なデータが含まれています。以下は主要なフィールドです。

フィールド 説明
yearnumber
monthnumber月(1-12)
daynumber日(1-31)
datestringISO形式の日付
weekdaystring曜日(日本語)
is_holidayboolean祝日かどうか
holiday_namestring|null祝日名
rokuyostring六曜
daily_keywordstringその日のキーワード
color_of_the_daystring今日の色(日本語)
recommended_teastringおすすめのお茶
その他のデータ項目:ラッキーナンバー、パワーストーン、アロマオイル、瞑想テーマ、花言葉、エネルギーアドバイス、占星術、タロット、格言、音楽推奨、食事推奨、クリスタルヒーリング、風水アドバイスなど、合計27項目のデータを提供しています。

利用規約・ライセンス

利用規約

  • 本APIは無料でご利用いただけます
  • 商用・非商用問わずご利用可能です
  • 大量アクセスによるサーバー負荷にはご配慮ください
  • データの正確性については保証いたしかねます

ライセンス

MIT License - 詳細はGitHubリポジトリをご確認ください。

免責事項

本APIで提供される情報の利用により生じた損害について、開発者は一切の責任を負いません。 祝日情報等は簡易的なものであり、正確な情報については公式ソースをご確認ください。