🍯 Game Honey API 문서
모바일 앱에서 게임 소식을 구독하고 알림을 받을 수 있는 API
1. 게임 목록 조회
GET
/api/games/
사용 가능한 모든 게임 목록을 조회합니다.
{
"results": [
{
"id": 1,
"game_id": "maplestory",
"display_name": "메이플스토리",
"icon_url": "https://...",
"categories": ["공지사항", "업데이트", "이벤트"]
}
]
}
GET
/api/games/{game_id}/
특정 게임의 상세 정보를 조회합니다.
GET /api/games/maplestory/
{
"id": 1,
"game_id": "maplestory",
"display_name": "메이플스토리",
"icon_url": "https://...",
"categories": ["공지사항", "업데이트", "이벤트"]
}
2. 구독 관리
🔒 로그인 필요
GET
/api/subscriptions/
현재 사용자의 구독 목록을 조회합니다.
{
"results": [
{
"id": 1,
"game": 1,
"game_id": "maplestory",
"game_name": "메이플스토리",
"category": "공지사항",
"created_at": "2024-01-15T10:30:00Z"
}
]
}
POST
/api/subscriptions/
새로운 구독을 추가합니다.
POST /api/subscriptions/
Content-Type: application/json
{
"game_id": "maplestory",
"category": "공지사항"
}
Response:
{
"id": 1,
"game": 1,
"game_id": "maplestory",
"game_name": "메이플스토리",
"category": "공지사항",
"created_at": "2024-01-15T10:30:00Z"
}
DELETE
/api/subscriptions/{id}/
구독을 취소합니다.
DELETE /api/subscriptions/1/
Response: 204 No Content
3. 알림 피드
🔒 로그인 필요
GET
/api/notifications/
구독한 게임의 최신 소식을 가져옵니다.
GET /api/notifications/?limit=50
[
{
"game": "메이플스토리",
"game_id": "maplestory",
"category": "공지사항",
"title": "정기점검 안내",
"url": "https://maplestory.nexon.com/...",
"date": "2024-01-15",
"collected_at": "2024-01-15T10:30:00Z"
}
]
4. 푸시 토큰 관리
🔒 로그인 필요
POST
/api/push-tokens/
FCM 푸시 토큰을 등록합니다.
POST /api/push-tokens/
Content-Type: application/json
{
"token": "fcm_token_here",
"device_type": "android" // "android" or "ios"
}
Response:
{
"id": 1,
"token": "fcm_token_here",
"device_type": "android",
"created_at": "2024-01-15T10:30:00Z"
}
DELETE
/api/push-tokens/{id}/
푸시 토큰을 삭제합니다.
5. 인증
Django Session 인증
현재 API는 Django의 기본 세션 인증을 사용합니다.
로그인 후 세션 쿠키를 통해 인증됩니다.
// 요청 시 쿠키 포함
fetch('/api/subscriptions/', {
credentials: 'include',
headers: {
'Content-Type': 'application/json'
}
})
6. 사용 예시
전체 플로우 예시
// 1. 게임 목록 조회
const games = await fetch('/api/games/').then(r => r.json());
// 2. 메이플스토리 공지사항 구독
await fetch('/api/subscriptions/', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
game_id: 'maplestory',
category: '공지사항'
})
});
// 3. 알림 피드 확인
const feed = await fetch('/api/notifications/?limit=20', {
credentials: 'include'
}).then(r => r.json());
// 4. 푸시 토큰 등록
await fetch('/api/push-tokens/', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
token: 'your_fcm_token',
device_type: 'android'
})
});