Skip to content

REST API Reference

HwiY edited this page Jul 21, 2024 · 119 revisions

REST API Reference

  • Version : 1.0.0

메인

로그인 🔑

URL Descriptions Token 구현 여부
POST /login 로그인 -> 해당 API는 개발 시, 소셜 사용하기 전에 사용하는 겁니다~! X O
GET /login/oauth2/code/{registrationId} 소셜 로그인 X O
POST /token 토큰 재발급 O O
POST /logout 로그아웃 O O
GET /teams 구단 조회 O O
PUT /profile/team 구단 선택하기 O O
PUT /profile/details 프로필 설정하기 O O
GET /profile/nickname-check 닉네임 중복확인 O O

오늘의 승부 예측 ⚾️

URL Descriptions Token 구현 여부
GET /games 오늘의 승부예측 조회 O O
GET /games/{gameId} gameId 단건 조회 O O
POST /games/vote 오늘의 승부예측 투표 O O
PUT /voteUpdate/{gameId} 오늘의 승부예측 투표 변경 O O
DELETE /voteDelete/{gameId} 오늘의 승부예측 투표 취소 O O
GET /games/daily-replies 오늘의 승부예측 댓글 조회 O O
GET /games/daily-replies{replyId}/sub 오늘의 승부예측 대댓글 조회 O O
POST /games/daily-reply 오늘의 승부예측 댓글 작성 O O
POST /games/daily-reply/{replyId}/sub 오늘의 승부예측 대댓글 작성 O O
POST /games/daily-reply/like 오늘의 승부예측 댓글 좋아요 O O
DELETE /games/daily-reply/like 오늘의 승부예측 댓글 좋아요 취소 O O
DELETE /replies/{replyId} 댓글 삭제 O O
GET /replies/{replyId}/report 댓글 신고 항목 조회 O O
POST /replies/{replyId}/report 댓글 신고 O O
GET /games/past 지난 승부예측 조회 O O

채팅방 👨‍👩‍👧‍👦

URL Descriptions Token 구현 여부
WS /chat 채팅방 연결 O O
WS /chat 채팅방 입장 O O
WS /chat 미니투표 만들기 O O
WS /chat 미니투표 O O
WS /chat 미니투표 결과 O O
WS /chat 오류 메세지 O O
WS /chat 채팅방 나가기 O O
PUT /gift/token 토큰 선물하기 O O

월간 승리요정 😇

URL Descriptions Token 구현 여부
GET /statistics 월간 승리요정 리스트 조회 O O
GET /statistics/replies 월간 승리요정 댓글 조회 O O
GET /statistics/replies/{replyId}/sub 월간 승리요정 대댓글 조회 O O
POST /statistics/reply 월간 승리요정 댓글 작성 O O
POST /statistics/repies/{replyId}/sub 월간 승리요정 대댓글 작성 O O
DELETE /statistics/replies 월간 승리요정 댓글 삭제 O O
POST /statistics/replies/like 월간 승리요정 댓글 좋아요 O O
DELETE /statistics/replies/like 월간 승리요정 댓글 좋아요 취소 O O
GET /profiles 월간 승리요정 프로필 조회 O O

마이페이지 🧑‍💻

URL Description Token 구현 여부
GET /profile/details 마이페이지 프로필 정보 조회 O O
GET /profile/history/fairy-statistics 마이페이지 요정 통계 조회 O O
GET /profile/history/votes 마이페이지 요정 기록 조회 O O
GET /profile/history/gifts 마이페이지 선물내역 조회 O O

댓글 pageable정리

페이지 네이션 정보 설명
페이지네이션 정보 설명

로그인 POST login

Request Parameters

개발 테스트에 필요한 로그인 API입니다. (운영은 소셜 로그인 추후 개발 예정)

Filed Type Description
username String ID
password String 비밀번호

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
refreshToken String 쿠키에 담깁니다!
accessToken String Access Token

성공 예제

POST /login
Cookie -> "refreshToken=asdasdasdasd"

{
    "code": 200,
    "message": "정상적으로 처리되었습니다.",
    "data": {
        "profileImageUrl": null,
        "nickname": "테스트유저1",
        "teamName": "LG 트윈스",
        "accessToken": "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJwbGF5ZG90MSIsImlhdCI6MTcxOTc1NjIzOSwiZXhwIjoxNzE5ODQyNjM5fQ.wnQ8FkMM5jEUlrPtURB_x7jwqUcFW95XOnPiw6T7ydQ"
    }
}

소셜 로그인 GET login/oauth2/code/{registrationId}

Request Parameters

소셜 로그인 API입니다.

Filed Type Description
registrationId String 소셜 타입 [google, naver, kakao]
code String 응답코드

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
profileImageUrl String 프로필 이미지 url
nickname String 닉네임
teamName String 응원하는 팀 이름
newMember boolean 신규 회원 여부 (true : 신규 회원 / false : 기존 회원)

성공 예제

/login/oauth2/code/{registrationId}?code={code}

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": {
    "profileImageUrl": null,
    "nickname": "NAVER_aa",
    "teamName": null,
    "newMember": false
  }
}

토큰 재발급 POST /token

Request Parameters

토큰 재발급하는 API입니다.

Filed Type Description

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
accessToken String Access Token

성공 예제

/token

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": {
    "accessToken" : "Bearer asdasdsadasdasd"
  }
}

로그아웃 POST /logout

Request Parameters

로그아웃 API입니다.

Filed Type Description

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

/logout

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": 
}

구단 조회 GET teams

Request Parameters

구단 조회하는 API입니다.

Filed Type Description

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
teamId Integer 팀 ID
teamName String 팀 명

성공 예제

GET /teams

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": [
    {
      "teamId": 1,
      "teamName": "한화 이글스"
    },
    ...
  ]
}

구단 선택하기 PUT profile/team

Request Parameters

최애 구단 선택하는 API입니다.

Filed Type Description
teamId Integer 팀 ID

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

PUT /profile/team

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": null
}

프로필 설정하기 PUT profile/details

Request Parameters

프로필 이미지, 닉네임, 한마디를 설정하는 API입니다.

Filed Type Description
profileImage File 프로필 이미지 파일 (form-data)
data JSON form-data Text application/json
nickname String 닉네임
comment String 한마디
프로필 수정 요청 예시

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

PUT /profile/details

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": null
}

닉네임 중복확인 GET profile/nickname-check

Request Parameters

닉네임 중복확인 체크하는 API입니다.

Filed Type Description
nickname String 닉네임

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
exist Boolean 중복여부 (true : 중복 / false : 가능)

성공 예제

PUT /profile/details

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": {
    "exist": true
  }
}

오늘의 승부예측 조회 GET games

Request Parameters

오늘의 승부예측 페이지 리스트를 조회하는 API입니다.

Filed Type Description

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
games Array 경기 목록
gameId Long 게임 ID
homeTeam 홈 팀 정보
teamName String 팀 명
teamShortName String 팀 Short명
score Integer 홈 팀 스코어
id Integer 홈 팀 ID
voteRatio String 투표율
hasVote Boolean 투표 여부
awayTeam 어웨이 팀 정보
teamName String 팀 명
teamShortName String 팀 Short명
score Integer 어웨이 팀 스코어
voteRatio String 투표율
id Integer 홈 팀 ID
hasVote Boolean 투표 여부
gameTime String 경기 시작 시간
status String 경기 상태

성공 예제

GET /games

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": [
    {
      "gameId": 1,
      "homeTeam": {
        "teamName": "두산 베어스",
        "teamShortName": "두산",
        "score": 1,
        "voteRatio": 60,
        "id": 5,
        "hasVote": false
      },
      "awayTeam": {
        "teamName": "롯데 자이언츠",
        "teamShortName": "롯데",
        "score": 6,
        "voteRatio": 40,
        "id": 7,
        "hasVote": false
      },
      "gameTime": "2024-01-17 14:00:00",
      "status": "PROGRESS"
    },
    ...
  ]
}

gameId 단건 조회 GET games/{gameId}

Request Parameters

gameId 단건 조회하는 API입니다.

Filed Type Description
gameId Long 게임 ID (Path Variable)

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
games Array 경기 목록
gameId Long 게임 ID
homeTeam 홈 팀 정보
teamName String 팀 명
teamShortName String 팀 Short명
score Integer 홈 팀 스코어
id Integer 홈 팀 ID
voteRatio String 투표율
hasVote Boolean 투표 여부
awayTeam 어웨이 팀 정보
teamName String 팀 명
teamShortName String 팀 Short명
score Integer 어웨이 팀 스코어
voteRatio String 투표율
id Integer 홈 팀 ID
hasVote Boolean 투표 여부
gameTime String 경기 시작 시간
status String 경기 상태

성공 예제

GET /games/431

{
    "code": 200,
    "message": "정상적으로 처리되었습니다.",
    "data": {
        "gameId": 431,
        "homeTeam": {
            "teamName": "삼성 라이온즈",
            "teamShortName": "삼성",
            "score": 0,
            "voteRatio": 0,
            "id": 8,
            "hasVote": false
        },
        "awayTeam": {
            "teamName": "KT 위즈",
            "teamShortName": "KT",
            "score": 0,
            "voteRatio": 0,
            "id": 2,
            "hasVote": false
        },
        "gameTime": "2024-05-21 18:30:00",
        "status": "READY"
    }
}

오늘의 승부예측 투표 POST games/{gameId}/vote

Request Parameters

오늘의 승부예측 페이지에서 승부예측 투표하는 API입니다.

Filed Type Description
gameId Long 게임 ID (Path Variable)
teamId Long 투표한 팀 ID

Response Parameters

HTTP Result Code가 201 Created일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

POST /games/1/vote

{
  "code": 201,
  "message": "정상적으로 처리되었습니다.",
  "data": []
}

오늘의 승부예측 투표 변경 PUT games/voteUpdate/{gameId}

Request Parameters

오늘의 승부예측 페이지에서 승부예측 투표 변경하는 API입니다.

Filed Type Description
gameId Long 게임 ID (Path Variable)
teamId Long 투표한 팀 ID

Response Parameters

HTTP Result Code가 201 Created일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

PUT/games/voteUpdate/1

{
  "code": 201,
  "message": "정상적으로 처리되었습니다.",
  "data": []
}

오늘의 승부예측 투표 취소 DELETE games/voteDelete/{gameId}

Request Parameters

오늘의 승부예측 페이지에서 승부예측 투표 취소하는 API입니다.

Filed Type Description
gameId Long 게임 ID (Path Variable)

Response Parameters

HTTP Result Code가 201 Created일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

DELETE /games/voteDelete/1

{
  "code": 201,
  "message": "정상적으로 처리되었습니다.",
  "data": []
}

오늘의 승부예측 댓글 조회 GET games/daily-replies

Request Parameters

오늘의 승부예측 페이지의 댓글을 조회하는 API입니다.

Filed Type Description
page Integer 페이지 번호 (Query Parameter)
item Integer 페이지별 조회 건 수 (Query Parameter)

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
profileImageUrl String 프로필 이미지 url
nickname String 닉네임
teamName String 팀명
replyId Long 댓글 ID
comment String 댓글 내용
likeCount Integer 좋아요 갯수
createdAt LocalDateTime 댓글 작성일
isLiked Boolean 좋아요 여부

성공 예제

GET /games/daily-replies?page=1&item=15

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": {
  "content": [
  {
    "profileImageUrl": "/profiles/asdasdasdasdasd.jpg",
    "nickname": "삼성짱",
    "teamName": "삼성 라이온즈",
    "replyId": 5,
    "comment": "언제 이기냐ㅠ",
    "likeCount": 30,
    "createdAt": "2024-01-10 17:22:04",
    "isLiked": true
  },
  ...
  ]
}
}

오늘의 승부예측 대댓글 조회 GET games/daily-replies/{replyId}/sub

Request Parameters

오늘의 승부예측 페이지의 대댓글을 조회하는 API입니다.

Filed Type Description
replyId Long 댓글 ID (Path Variable)

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
profileImageUrl String 프로필 이미지 url
nickname String 닉네임
teamName String 팀명
replyId Long 댓글 ID
comment String 댓글 내용
likeCount Integer 좋아요 갯수
createdAt LocalDateTime 댓글 작성일
isLiked Boolean 좋아요 여부

성공 예제

GET /games/daily-replies/1/sub

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": {
    "content": [
      {
        "profileImageUrl": "/profiles/asdasdasdasdasd.jpg",
        "nickname": "삼성짱",
        "teamName": "삼성 라이온즈",
        "replyId": 5,
        "comment": "언제 이기냐ㅠ",
        "likeCount": 30,
        "createdAt": "2024-01-10 17:22:04",
        "isLiked": false
      },
      ...
    ]
  }
}

오늘의 승부예측 댓글 작성 POST games/daily-reply

Request Parameters

오늘의 승부예측 페이지의 댓글을 작성하는 API입니다.

Filed Type Description
content String 댓글 내용

Response Parameters

HTTP Result Code가 201 Created일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

POST /games/daily-reply

{
  "code": 201,
  "message": "정상적으로 처리되었습니다.",
  "data": null
}

오늘의 승부예측 대댓글 작성 POST games/daily-replies/{replyId}/sub

Request Parameters

오늘의 승부예측 페이지의 대댓글을 작성하는 API입니다.

Filed Type Description
replyId Long 댓글 ID (Path Variable)
content String 대댓글 내용

Response Parameters

HTTP Result Code가 201 Created일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

POST /games/daily-replies/{
  replyId
}/sub

{
  "code": 201,
  "message": "정상적으로 처리되었습니다.",
  "data": null
}

오늘의 승부예측 댓글 좋아요 POST games/daily-reply/{replyId}/like

Request Parameters

오늘의 승부예측 페이지 댓글의 좋아요 누르는 API입니다.

Filed Type Description
replyId Long 댓글 ID (Path Variable)

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

POST /games/daily-reply/1/like

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": null
}

오늘의 승부예측 댓글 좋아요 취소 DELETE games/daily-reply/{replyId}/like

Request Parameters

오늘의 승부예측 페이지 댓글의 좋아요 취소 API입니다.

Filed Type Description
replyId Long 댓글 ID (Path Variable)

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

DELETE /games/daily-reply/1/like

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": null
}

댓글 삭제 DELETE replies/{replyId}

Request Parameters

오늘의 승부예측, 월간 승리요정 페이지의 댓글/대댓글 삭제하는 API입니다.

Filed Type Description
replyId Long 댓글 ID (Path Variable)

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

DELETE /replies/1

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": null
}

댓글 신고 항목 조회 GET /replies/{replyId}/report

Request Parameters

오늘의 승부예측, 월간 승리요정 페이지의 댓글 신고 시, 신고 항목을 조회하는 API입니다.

Filed Type Description
replyId Long 댓글 ID (Path Variable)

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
type String 댓글 신고 타입
comment String 상세 내용

성공 예제

GET /replies/1/report

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": [
    {
      "type": "ABUSE",
      "comment": "부적절한 언어 사용"
    },
    {
      "type": "SPAM",
      "comment": "스팸/홍보 및 도배글"
    },
    {
      "type": "PRIVACY",
      "comment": "개인정보 노출"
    },
    {
      "type": "ETC",
      "comment": "기타"
    }
  ]
}

댓글 신고 POST /replies/{replyId}/report

Request Parameters

오늘의 승부예측, 월간 승리요정 페이지의 댓글 신고 API입니다.

Filed Type Description
replyId Long 댓글 ID (Path Variable)
reportType String 신고 타입

Response Parameters

HTTP Result Code가 201 CREATED일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

POST /replies/1/report

{
  "code": 201,
  "message": "정상적으로 처리되었습니다.",
  "data": []
}

지난 승부예측 조회 GET games/past

Request Parameters

지난 승부예측 페이지 조회하는 API입니다.

Filed Type Description
startDate String 조회 시작일 (yyyy-MM-dd) Query String
endDate String 조회 마지막 날짜 (yyyy-MM-dd) Query String

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
games Array 경기 목록
gameId Long 게임 ID
homeTeam 홈 팀 정보
teamName String 팀 명
voteRatio String 투표율
id Integer 홈 팀 ID
awayTeam 어웨이 팀 정보
teamName String 팀 명
teamShortName String 팀 Short명
voteRatio String 투표율
id Integer 홈 팀 ID
gameDate String 경기일
voteTeamId Integer 투표팀 ID

성공 예제

GET /games/past?startDate=2024-01-10&endDate=2024-01-17

{
    "code": 200,
    "message": "정상적으로 처리되었습니다.",
    "data": [
        {
            "games": [
                {
                    "gameId": 1,
                    "homeTeam": {
                        "id": 5,
                        "teamName": "두산 베어스",
                        "voteRatio": 0
                    },
                    "awayTeam": {
                        "id": 7,
                        "teamName": "롯데 자이언츠",
                        "voteRatio": 0
                    },
                    "gameDate": "2024.07.01",
                    "voteTeamId": 7
                },
                ...
            ]
        },
        ...
    ]
}

채팅방 API

1. 채팅방 연결

  • 채팅방 EndPoint : /chat
  • Method: Connection

Request Payload

  • gameId가 String인 이유?
    • 설명: SimpMessageHeaderAccessor.getFirstNativeHeader값에선 STOMP 헤더에서 주어진 이름의 첫 번째 값을 String 형태로 반환하기 때문이다.
Filed Type Description
gameId String 게임ID
Authorization String jwt 토큰 값

Response Payload

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description

2. 채팅방 입장

  • 채팅방 EndPoint : /chat
  • 연결 방법: WebSocket 연결 후 STOMP를 통해 메시지 전송
  • 메세지 보내기:
    • 경로: /pub/chat/message
    • 설명 : 사용자가 채팅방에 입장하려고 할 때, 이 경로로 메시지를 전송하고, type구분에 따라 외치기 or 일반 채팅인지 확인 할 수 있다.

Request Payload 채팅방에서 채팅을 전송하는 API입니다.

Filed Type Description
gameId Long 게임ID (Path Variable)
type String 메시지 타입 (일반 채팅(NORMAL), 외치기(BAWWLING), 입장 구분(ENTER))
content String 채팅 내용
  • 메세지 수신:
    • 경로: /sub/chat/{gameId}
    • 설명: 사용자가 채팅방에 성공적으로 입장하면, 해당 채팅방(gameId)을 구독하고 있는 모든 클라이언트에게 사용자 입장 메시지가 보내진다.

Response Payload

Filed Type Description
profile 프로필 정보
profileImageUrl String 프로필 이미지 url
nickname String 닉네임
teamName String 사용자 teamName
teamType String 투표한 팀 정보 (home, away)
type String 메시지 타입 (일반 채팅, 외치기)
content String 채팅 내용

성공 예제

{
  "type": "BAWWLING",
  "gameId": 256,
  "message": "테스트",
  "profile": {
    "nickname": "테스트유저2",
    "profileImageUrl": null,
    "teamName": "SSG 랜더스"
  },
  "teamType": "home"
}
  • 메세지 수신:
    • 경로: /user/{nickName}/chat/enter
    • 설명: 사용자가 채팅방에 성공적으로 입장후 미니게임이 존재 할 시, 미니게임 관련 정보를 보내준다.
    • 예시 : 사용자가 투표를 하지 않고 들어 왔을 시

Response Payload

Filed Type Description
miniGameId Long 미니게임 ID
message String 투표 시작 메세지
profile 사용자 프로필 정보
nickname String 사용자 nickname
profileImageUrl String 사용자 profileImageUrl
teamName String 사용자 teamName
miniGames 투표 내용
question String 질문 내용
option1 String 질문 선택 내용
option2 String 질문 선택 내용
startedAt LocalDateTime 투표 시작일

성공 예제

{"miniGameId":315,"message":"투표가 시작되었습니다.","profile":{"nickname":"테스트유저1","profileImageUrl":null,"teamName":"LG 트윈스"},"miniGames":{"question":"오늘 날씨 어때?","option1":"좋아","option2":"별로"},"startedAt":"2024-07-21 15:33:02"}
  • 예시 : 사용자가 투표를 한 후 다시 나갔다 들어왔을 경우(미니게임 투표를 완료한 경우)

Response Payload

Filed Type Description
VoteCreator 미니투표 생성자
creatorNickname String 미니투표 생성자 nickname
creatorOptions 미니 투표 내용
question String 질문 내용
option1 String 질문 선택 내용1
option2 String 질문 선택 내용2
myProfile 사용자 프로필 정보
nickname String 사용자 nickname
profileImageUrl String 사용자 profileImageUrl
teamName String 사용자 teamName
voteRatio 투표 결과 (퍼센트율)
option1VoteRatio Integer 질문 선택내용1 퍼센트율
option2VoteRatio Integer 질문 선택내용2 퍼센트율

성공 예제

{"voteCreator":{"creatorNickname":"테스트유저1","creatorOptions":{"question":"오늘 날씨 어때?","option1":"좋아","option2":"별로"}},"myProfile":{"nickname":"테스트유저2","profileImageUrl":null,"teamName":"SSG 랜더스"},"voteRatio":{"option1VoteRatio":100,"option2VoteRatio":0}}

3. 미니투표 만들기

채팅방 경로: ws /chat

  • 메시지 보내기:
    • 경로: /pub/chat/createVote
    • 설명: 사용자가 채팅방 내에서 투표를 생성하려고 할 때, 이 경로로 메시지를 전송한다.

Request Payload 채팅방에서 미니투표 생성한 후 전송하는 API입니다.

Filed Type Description
gameId Long 현재 채팅방의 gameId
question String 질문 내용
option1 String 질문 선택 내용1
option2 String 질문 선택 내용2
  • 메시지 수신:
    • 경로: /sub/chat/{gameId}
    • 설명: 투표가 성공적으로 생성되면, 이 경로를 구독하고 있는 모든 클라이언트에게 투표 관련 메시지가 보내진다.

Response Payload

Filed Type Description
miniGameId Long 미니게임 ID
message String 투표 시작 메세지
profile 사용자 프로필 정보
nickname String 사용자 nickname
profileImageUrl String 사용자 profileImageUrl
teamName String 사용자 teamName
miniGames 투표 내용
question String 질문 내용
option1 String 질문 선택 내용
option2 String 질문 선택 내용
startedAt LocalDateTime 투표 시작일

**투표 진행중 성공 예제 ** image

  • 메시지 수신:
    • 경로: /sub/chat/{gameId}
    • 설명: 투표가 종료되면, 이 경로를 구독하고 있는 모든 클라이언트에게 투표 관련 메시지가 보내진다.

Response Payload

Filed Type Description
message String 투표 종료 메세지

**투표 종료 성공 예제 ** image

  • 메시지 수신:
    • 경로: /user/{nickname}/chat/{gameId}
    • 설명: 투표가 성공적으로 생성되고 이미 미니투표가 진행 중이면 현재 미니투표를 진행 할 수 없어 잠시 대기하라는 메세지를 보낸다.

Response Payload

Filed Type Description
miniGameId Long 미니게임 ID
message String 투표 시작 메세지
profile 사용자 프로필 정보
nickname String 사용자 nickname
profileImageUrl String 사용자 profileImageUrl
teamName String 사용자 teamName
miniGames 투표 내용
question String 질문 내용
option1 String 질문 선택 내용
option2 String 질문 선택 내용
startedAt LocalDateTime 투표 시작일

**성공 예제 ** image

4. 미니투표

채팅방 경로: ws /chat

  • 메시지 보내기:
    • 경로: /pub/chat/vote
    • 설명: 사용자가 채팅방 내에서 투표를 생성된 후, 투표를 한다.

Request Payload 채팅방에서 미니투표 생성한 후 투표를 하는 API입니다.

Filed Type Description
miniGameId Long 미니 게임 ID
option Integer 미니게임 투표 한 값 (ex: option1: 1, option2: 2)
  • option 설명:
{"gameId": 2, "question": "오늘 날씨 어때?", "option1": "좋아","option2": "별로"}

option1을 선택시 1의 값이 넘어가고 option2 선택시 2의 값이 넘어간다.

  • 메시지 수신:
    • 경로: /user/{nickname}/voteResult
    • 설명: 미니투표가 만들어진 후, 투표를 완료 했다고 메세지를 보내준다.

Response Payload

Filed Type Description
message String 메세지

성공 예제 image

5. 미니투표 결과

채팅방 경로: ws /chat

  • 메시지 보내기:
    • 경로: /pub/chat/voteResult
    • 설명: 사용자가 미니투표를 완료 한 후 미니게임ID를 보내준다.

Request Payload

Filed Type Description
miniGameId Long 미니 게임 ID
  • 메시지 수신:
    • 경로: /sub/voteRatioResults/{miniGameId}
    • 설명: 미니투표를 완료 한후, 결과값(투표율)이 보여진다.

Response Payload

Filed Type Description
VoteCreator 미니투표 생성자
creatorNickname String 미니투표 생성자 nickname
creatorOptions 미니 투표 내용
question String 질문 내용
option1 String 질문 선택 내용1
option2 String 질문 선택 내용2
myProfile 사용자 프로필 정보
nickname String 사용자 nickname
profileImageUrl String 사용자 profileImageUrl
teamName String 사용자 teamName
voteRatio 투표 결과 (퍼센트율)
option1VoteRatio Integer 질문 선택내용1 퍼센트율
option2VoteRatio Integer 질문 선택내용2 퍼센트율

성공 예제 image

6. 오류 메세지

채팅방 경로: ws /chat

  • 메시지 수신 :
    • 경로: /user/{nickname}/chat/errors
    • 설명: 오류 메세지를 보내준다.

Response Payload

Filed Type Description
message String 메세지

성공 예제 image

7. 채팅방 나가기

채팅방 경로: ws /chat

  • 메시지 보내기:
    • 경로: /pub/chat/leave
    • 설명: 사용자가 채팅방을 나갈 때 gameId를 보내준다.

Request Payload

Filed Type Description
gameId Long 오늘의 승부예측 gameId
  • 메시지 수신:
    • 경로: /sub/chat/{gameId}
    • 설명: 사용자가 채팅방을 나갈 시, 누가 나갔는지 메세지를 보내준다.

Response Payload

Filed Type Description
nickname String 사용자 nickname
message String 메세지

성공 예제 image

토큰 선물하기 PUT gift/token

Request Parameters

토큰 선물하기 API입니다.

Filed Type Description
recipientNickName String 선물 받는 사용자 닉네임
token Integer 선물할 토큰 갯수
comment String 한마디
  • 토큰 5개 -> 미니투표권 1개와 동일

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

PUT /gift/token

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": []
}

월간 승리요정 리스트 조회 GET statistics

Request Parameters

월간 승리요정 페이지의 승리요정/패배요정 리스트를 조회하는 API입니다.

Filed Type Description

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
winMembers Array 승리요정 목록
rank Integer 등 수
voteRatio Integer 적중률
memberId Long 사용자 ID
nickname String 닉네임
winFairyCount Integer 승리요정 횟수
loseFairyCount Integer 패배요정 횟수
title String 한마디
loseMembers Array 패배요정 목록
rank Integer 등 수
voteRatio Integer 적중률
memberId Long 사용자 ID
nickname String 닉네임
winFairyCount Integer 승리요정 횟수
loseFairyCount Integer 패배요정 횟수
title String 한마디

성공 예제

GET /statistics

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": {
    "winMembers": [
      {
        "rank": 1,
        "voteRatio": 90,
        "memberId": 1,
        "nickname": "테스트유저1",
        "winFairyCount": 10,
        "loseFairyCount": 2,
        "title": "한마디~"
      },
      ...
    ],
    "lose_members": [
      {
        "rank": 1,
        "voteRatio": 90,
        "memberId": 3,
        "nickname": "패배요정나야나",
        "winFairyCount": 1,
        "loseFairyCount": 4,
        "title": "ㅠㅠ"
      },
      ...
    ]
  }
  ]
}

월간 승리요정 댓글 조회 GET statistics/replies

Request Parameters

월간 승리요정 페이지의 댓글을 조회하는 API입니다.

Filed Type Description
page Integer 페이지 번호 (Query Parameter)
item Integer 페이지별 조회 건 수 (Query Parameter)

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
profileImageUrl String 프로필 이미지 url
nickname String 닉네임
teamName String 팀명
replyId Long 댓글 ID
comment String 댓글 내용
likeCount Integer 좋아요 갯수
createdAt LocalDateTime 댓글 작성일
isLiked Boolean 좋아요 여부

성공 예제

GET /statistics/replies?page=1&item=15

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": {
  "content": [
  {
    "profileImageUrl": "/profiles/asdasdasdasdasd.jpg",
    "nickname": "삼성짱",
    "teamName": "삼성 라이온즈",
    "replyId": 5,
    "comment": "언제 이기냐ㅠ",
    "likeCount": 30,
    "createdAt": "2024-01-10 17:22:04",
    "isLiked": true
  },
...
]
}
}

월간 승리요정 대댓글 조회 GET statistics/replies/{replyId}/sub

Request Parameters

월간 승리요정 페이지의 대댓글을 조회하는 API입니다.

Filed Type Description
replyId Long 댓글 ID (Path Variable)

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
profileImageUrl String 프로필 이미지 url
nickname String 닉네임
teamName String 팀명
replyId Long 댓글 ID
comment String 댓글 내용
likeCount Integer 좋아요 갯수
createdAt LocalDateTime 댓글 작성일
isLiked Boolean 좋아요 여부

성공 예제

GET /games/daily-replies/1/sub

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": {
    "content": [
      {
        "profileImageUrl": "/profiles/asdasdasdasdasd.jpg",
        "nickname": "삼성짱",
        "teamName": "삼성 라이온즈",
        "replyId": 5,
        "comment": "언제 이기냐ㅠ",
        "likeCount": 30,
        "createdAt": "2024-01-10 17:22:04",
        "isLiked": true
      },
      ...
    ]
  }
}

월간 승리요정 댓글 작성 POST statistics/reply

Request Parameters

월간 승리요정 페이지의 댓글을 작성하는 API입니다.

Filed Type Description
content String 댓글 내용

Response Parameters

HTTP Result Code가 201 Created일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

POST /statistics/reply

{
  "code": 201,
  "message": "정상적으로 처리되었습니다.",
  "data": null
}

월간 승리요정 대댓글 작성 POST statistics/replies/{replyId}/sub

Request Parameters

월간 승리요정 페이지의 대댓글을 작성하는 API입니다.

Filed Type Description
replyId Long 댓글 ID (Path Variable)
comment String 대댓글 내용

Response Parameters

HTTP Result Code가 201 Created일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

POST /statistics/replies/{
  replyId
}/sub

{
  "code": 201,
  "message": "정상적으로 처리되었습니다.",
  "data": null
}

월간 승리요정 댓글 삭제 DELETE statistics/replies/{replyId}

Request Parameters

월간 승리요정 페이지의 댓글을 삭제하는 API입니다.

Filed Type Description
replyId Long 댓글 ID (Path Variable)

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

DELETE /statistics/replies/1

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": null
}

월간 승리요정 댓글 좋아요 POST statistics/replies/{replyId}/like

Request Parameters

월간 승리요정 페이지의 댓글에 좋아요 기능 API입니다.

Filed Type Description
replyId Long 댓글 ID (Path Variable)

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

POST /statistics/replies/1/like

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": null
}

월간 승리요정 댓글 좋아요 취소 DELETE statistics/replies/{replyId}/like

Request Parameters

월간 승리요정 페이지의 댓글에 좋아요 취소 API입니다.

Filed Type Description
replyId Long 댓글 ID (Path Variable)

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description

성공 예제

DELETE /statistics/replies/1/like

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": null
}

월간 승리요정 프로필 조회 GET profiles

Request Parameters

월간 승리요정 페이지의 프로필 조회 API입니다.

Filed Type Description
nickname String 닉네임 (Query Parameter)

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
nickname String 닉네임
profileImageUrl String 프로필 이미지 url
winFairyCount Integer 승리요정 횟수
loseFairyCount Integer 패배요정 횟수

성공 예제

GET /profiles?nickname=테스트유저2

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": [
    {
      "nickname": "테스트유저2",
      "profileImageUrl": "/profile/asd123sdasd.jpg",
      "winFairyCount": 8,
      "loseFairyCount": 1
    }
  ]
}

마이페이지 프로필 정보 조회 GET profile/details

Request Parameters

마이페이지의 상단 프로필 정보를 조회하는 API입니다.

Filed Type Description

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
nickname String 닉네임
profileImageurl String 프로필 이미지 url
level Integer 레벨
token Integer 보유 토큰
teamName String 응원하는 팀명
comment String 한마디

성공 예제

GET /profile/details

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": [
    {
      "nickname": "닉네임",
      "profileImageUrl": "/profile/asdasd12323.jpg",
      "level": 5,
      "token": 30,
      "teamName": "기아 타이거즈",
      "comment": "한마디"
    }
  ]
}

마이페이지 요정 통계 조회 GET profile/history/fairy-statistics

Request Parameters

마이페이지의 요정 횟수 통계를 조회하는 API입니다.

Filed Type Description

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
totalRank Integer 등 수
title String 승리요정/패배요정 등 수 정보
count Integer 횟수

성공 예제

GET /profile/history/fairy-statistics

{
  "code": 200,
  "message": "정상적으로 처리되었습니다.",
  "data": [
    {
      "totalRank": 1,
      "title": "승리요정 1등",
      "count": 9
    },
    ...
  ]
}

마이페이지 요정 기록 조회 GET profile/history/votes

Request Parameters

마이페이지의 요정 기록을 조회하는 API입니다.

Filed Type Description
page Integer 페이지 번호 (Query Parameter)
item Integer 건 수 (Query Parameter)

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
type String 승리요정/패배요정 구분
rank Integer 등 수
comment String 한마디
historyDate Date 날짜

성공 예제

GET /profile/history/votes?page=1&item=10

{
"code": 200,
"message": "정상적으로 처리되었습니다.",
"data": [
{
"type": "승리요정",
"rank": 1,
"comment": "한마디~",
"historyDate": "2023-12-01"
},
...
]
}

마이페이지 선물내역 조회 GET profile/history/gifts

Request Parameters

마이페이지의 선물내역을 조회하는 API입니다.

Filed Type Description
page Integer 페이지 번호 (Query Parameter)
item Integer 조회 건수 (Query Parameter)

Response Parameters

HTTP Result Code가 200 OK일 때 반환하는 정보입니다.

Filed Type Description
nickname String 닉네임
teamName String 응원하는 팀 이름
token Integer 선물한 토큰 갯수
comment String 한마디
takeDate Date 선물한 날짜

성공 예제

GET /profile/history/gifts?page=1&item=10

{
"code": 200,
"message": "정상적으로 처리되었습니다.",
"data": [
  {
    "nickname": "닉네임",
    "teamName" : "한화 이글스",
    "token": 3,
    "comment": "한마디",
    "takeDate": "2023-12-01"
  },
  ...
]
}

페이지네이션 정보 설명

페이지네이션에 대한 정보를 설명합니다.

성공 예제

{
    "pageable": {
        "sort": {
            "sorted": false,
            "unsorted": true,
            "empty": false
        },
        "offset": 30,
        "pageSize": 15,
        "pageNumber": 3,
        "paged": true,
        "unpaged": false
    },
    "totalPages": 3,
    "totalElements": 36,
    "last": true,
    "number": 3,
    "sort": {
        "sorted": false,
        "unsorted": true,
        "empty": false
    },
    "size": 15,
    "numberOfElements": 6,
    "first": false,
    "empty": false
}

페이지네이션 속성

속성 설명
sorted 정렬 사용 여부
unsorted 정렬 미사용 여부
empty 리스트가 비어 있는지 여부
offset 데이터 시작 위치: ex) 첫번째 페이지 offset: 0, 두번째 페이지 offset: 15)

페이지 정보

속성 설명
pageSize, size 한 페이지 당 보여줄 데이터 개수
pageNumber, number 현재 페이지 번호
paged 페이지네이션 사용 여부
unpaged 페이지네이션 사용하지 않는지 여부
totalPages 총 페이지 수
totalElements 전체 데이터 수
last 현재 페이지가 마지막 페이지인지 여부
numberOfElements 현재 페이지의 데이터: 수 ex) totalElements:36일 때, 3번 째 페이지 numberOfElements: 6
first 현재 페이지가 첫번째 페이지인지 여부

Clone this wiki locally