エンドポイント | 説明 | レスポンス | アクション |
---|---|---|---|
/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年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;
}
}
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('データの取得に失敗しました')
# 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項目の包括的なデータが含まれています。以下は主要なフィールドです。
フィールド | 型 | 説明 |
---|---|---|
year | number | 年 |
month | number | 月(1-12) |
day | number | 日(1-31) |
date | string | ISO形式の日付 |
weekday | string | 曜日(日本語) |
is_holiday | boolean | 祝日かどうか |
holiday_name | string|null | 祝日名 |
rokuyo | string | 六曜 |
daily_keyword | string | その日のキーワード |
color_of_the_day | string | 今日の色(日本語) |
recommended_tea | string | おすすめのお茶 |
MIT License - 詳細はGitHubリポジトリをご確認ください。
本APIで提供される情報の利用により生じた損害について、開発者は一切の責任を負いません。 祝日情報等は簡易的なものであり、正確な情報については公式ソースをご確認ください。