Skip to content
Jeong InHo edited this page May 12, 2021 · 14 revisions

로그인 요청

POST ip/login?code={asdf3421}

req

query params

code

res

200 Ok

{
    name: Jeong In Ho,
    email: derosatam76@gmail.com,
    userId: eNoLJ,
    token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MjA2OTc3MjAsInVzZXJJZCI6ImVOb0xKIn0.Pv8Lfs90B7LRyCqKrob3RGjDtMgAk9ahdB8pRM1MY9Q
}

400 Bad Request

{
    "timestamp": "2021-05-12T08:17:36.148+00:00",
    "status": 400,
    "error": "Bad Request",
    "message": "OAuth 인증에 실패 했습니다.",
    "path": "/login"
}

로그아웃 요청

GET ip/logout

req

header

Authorization: Bearer {token}

res

200 Ok

401 Unauthorized

{
    "timestamp": "2021-05-12T08:20:59.720+00:00",
    "status": 401,
    "error": "Unauthorized",
    "message": "유효하지 않은 토큰입니다.",
    "path": "/logout"
}

팀 별 선수목록 요청

GET ip/members/{teamName}

res

200 Ok

[
    {
        id: 1,
        name: 김광진,
        AVG: 0.32
    },
    {
        id: 2,
	name: 류현진,
	AVG: 0.33
    }
]

400 Bad Request

{
    "timestamp": "2021-05-12T08:23:31.649+00:00",
    "status": 400,
    "error": "Bad Request",
    "message": "해당 엔티티를 찾을 수 없습니다.",
    "path": "/members/Tiger"
}

게임목록 요청

GET ip/games

req

header

Authorization: Bearer {token}

res

200 Ok

[
    {
	homeTeamName: marvel,
	awayTeamName: tigers
    },
    {
	homeTeamName: tigers,
	awayTeamName: twins
    }
]

401 Unauthorized

{
    "timestamp": "2021-05-12T08:20:59.720+00:00",
    "status": 401,
    "error": "Unauthorized",
    "message": "유효하지 않은 토큰입니다.",
    "path": "/logout"
}

게임 시작 요청

POST ip/games/{teamName}

req

header

Authorization: Bearer {token}

res

200 Ok

{
    playTeam: captin,
    roundInfo: {
        round: 2,
	strike: 1,
	ball: 2,
	out: 1,
	firstBase: true,
	secondBase: false,
	thirdBase: true
    },
    offenceTeam: {
	teamName: captin(away team의 선공),
	score: 1
	hitter: {
	    name: 류현진,
	    AVG: 0.312,
	    TPA: 2,
	    hits(안타): 1
	}
    },
    defenseTeam: {
        teamName: Marvel(home team의 후공),
	score: 5
	pitcher: {
	    name: 최동원,
	    pit: 39
	}
    },
    story: [볼(오래됨), 스트라이크]
}

400 Bad Request

{
    "timestamp": "2021-05-12T08:23:31.649+00:00",
    "status": 400,
    "error": "Bad Request",
    "message": "해당 엔티티를 찾을 수 없습니다.",
    "path": "/members/Tiger"
}

401 Unauthorized

{
    "timestamp": "2021-05-12T08:20:59.720+00:00",
    "status": 401,
    "error": "Unauthorized",
    "message": "유효하지 않은 토큰입니다.",
    "path": "/logout"
}

경기 중 406 (구현 중)


투구(pitch) 요청

PATCH ip/games (공수 교대 X) POST ip/games (공수 교대 O)

req

header

Authorization: Bearer {token}

body

{ playTeam: captin, roundInfo: { round: 2, strike: 1, ball: 2, out: 1, firstBase: true, secondBase: false, thirdBase: true }, offenceTeam: { teamName: captin(away team의 선공), score: 1 hitter: { name: 류현진, AVG: 0.312, TPA: 2, hits(안타): 1 } }, defenseTeam: { teamName: Marvel(home team의 후공), score: 5 pitcher: { name: 최동원, pit: 39 } }, story: [볼(오래됨), 스트라이크] }

res

200 Ok

{
    playTeam: captin,
    roundInfo: {
        round: 2,
	strike: 1,
	ball: 2,
	out: 1,
	firstBase: true,
	secondBase: false,
	thirdBase: true
    },
    offenceTeam: {
	teamName: captin(away team의 선공),
	score: 1
	hitter: {
	    name: 류현진,
	    AVG: 0.312,
	    TPA: 2,
	    hits(안타): 1
	}
    },
    defenseTeam: {
        teamName: Marvel(home team의 후공),
	score: 5
	pitcher: {
	    name: 최동원,
	    pit: 39
	}
    },
    story: [볼(오래됨), 스트라이크]
}

400 Bad Request

{
    "timestamp": "2021-05-12T08:23:31.649+00:00",
    "status": 400,
    "error": "Bad Request",
    "message": "해당 엔티티를 찾을 수 없습니다.",
    "path": "/members/Tiger"
}

401 Unauthorized

{
    "timestamp": "2021-05-12T08:20:59.720+00:00",
    "status": 401,
    "error": "Unauthorized",
    "message": "유효하지 않은 토큰입니다.",
    "path": "/logout"
}

게임의 스코어 요청

GET ip/games/scores

req

header

Authorization: Bearer {token}

res

{
    homeTeam: {
	teamName: marvel,
	scores: [1, 0, 0, 0]
    },
    awayTeam: {
	teamName: captin,
	scores: [1, 2, 2]
    },
}

400 Bad Request

{
    "timestamp": "2021-05-12T08:23:31.649+00:00",
    "status": 400,
    "error": "Bad Request",
    "message": "해당 엔티티를 찾을 수 없습니다.",
    "path": "/members/Tiger"
}

401 Unauthorized

{
    "timestamp": "2021-05-12T08:20:59.720+00:00",
    "status": 401,
    "error": "Unauthorized",
    "message": "유효하지 않은 토큰입니다.",
    "path": "/logout"
}

팀 별 모든 멤버의 스코어

GET ip/games/scores/{teamName}

req

header

Authorization: Bearer {token}

res

[
    {
	id: 1,
	name: 김광진,
	TPA(타석): 1,
	hits: 1,
	out: 0
    },
    {
	id: 2,
	name: 류현진,
	TPA(타석): 1,
	hits: 0,
	out: 1
    }
]

400 Bad Request

{
    "timestamp": "2021-05-12T08:23:31.649+00:00",
    "status": 400,
    "error": "Bad Request",
    "message": "해당 엔티티를 찾을 수 없습니다.",
    "path": "/members/Tiger"
}

401 Unauthorized

{
    "timestamp": "2021-05-12T08:20:59.720+00:00",
    "status": 401,
    "error": "Unauthorized",
    "message": "유효하지 않은 토큰입니다.",
    "path": "/logout"
}

Clone this wiki locally