# API 문서 ## User 관련 ### 로그인 ---- 사용자 로그인 기능 제공 * URL `/api/v1/login` * Method: `POST` * URL Params Required: None * Body ```JSON { email : String, password : String } ``` * Success Response: * Code: 200 OK Content: ```json { token_type : String, access_token : String, refresh_token : String, user_id : Long, email : String } ``` * Error Response: * Code: 404 NOT FOUND Content: ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 로그아웃 ---- 사용자 로그아웃 기능 제공 * URL `/api/v1/logout` * Method: `POST` * URL Params Required: None * Body ```JSON { email : String } ``` * Success Response: * Code: 200 OK Content: ```json { success: boolean } ``` * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 회원가입 ---- 사용자 회원가입 기능 제공 * URL `/api/v1/signup` * Method: `POST` * URL Params Required: None * Body ```JSON { email : String, password : String, nickname : String } ``` * Success Response: * Code: 201 CREATED Content: ```json { userId : Long } ``` > 201 CREATED : 회신 메시지의 body에 생성된 자원을 동봉해야 하지만, 그냥 일단 userId만 포함시켰음 * Error Response: * Code: 400 BAD REQUEST Content: ```json { errorMsg : String, result : String, uriRequested : String } ``` * Code: 409 CONFLICT Content: ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 이메일 검증 ---- 사용자 회원가입시, 이메일 중복 검사 기능 제공 * URL `/api/v1/users/validation/{email}` * Method: `GET` * URL Params Required: `email : String` * Body None * Success Response: * Code: 204 NO CONTENT Content: None * Error Response: * Code: 409 CONFLICT Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 별명 검증 ---- 사용자 회원가입시, 별명 중복 검사 기능 제공 * URL `/api/v1/users/validation/{nickname}` * Method: `GET` * URL Params Required: `nickname : String` * Body None * Success Response: * Code: 204 NO CONTENT Content: None * Error Response: * Code: 409 CONFLICT Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 유저 정보 가져오기 ---- 사용자의 정보를 가져오는 기능 * URL `/api/v1/users/{user_id}` * Method: `GET` * URL Params Required: `user_id : Long` * Body None * Success Response: * Code: 200 OK Content: ```json { userId : Long, email : String, password : String, nickname : String, githubUrl : String, blogUrl : String } ``` * Error Response: * Code: 401 UNAUTHORIZED Content ```json { errorMsg : String, result : String, uriRequested : String } ``` * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 유저 정보 수정하기 ---- 사용자의 정보를 수정하는 기능 * URL `/api/v1/users/{user_id}` * Method: `PUT` * URL Params Required: `user_id : Long` * Body None * Success Response: * Code: 200 OK Content: ```json { userId : Long, email : String, password : String, nickname : String, githubUrl : String, blogUrl : String } ``` * Error Response: * Code: 401 UNAUTHORIZED Content ```json { errorMsg : String, result : String, uriRequested : String } ``` * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 유저 탈퇴하기 ---- 사용자 탈퇴기능 * URL `/api/v1/users/{user_id}` * Method: `DELETE` * URL Params Required: `user_id : Long` * Body None * Success Response: * Code: 200 OK Content: ```json { userId : Long } ``` * Error Response: * Code: 401 UNAUTHORIZED Content ```json { errorMsg : String, result : String, uriRequested : String } ``` * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ## Profile 화면 관련 ### Mypage(Profile) 정보 가져오기 ---- Mypage(Profile) 정보 가져오기 * URL `/api/v1/users/{user_id}/profile` * Method: `GET` * URL Params Required: `user_id : Long` * Body None * Success Response: * Code: 200 OK Content: ```json { nickname : String, githubUrl : String, blogUrl : String, introduce : String, userTechTag : TechTag[], projects : Project[] } ``` * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` * Code: 404 NOT FOUND Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### Github 주소 수정하기 ---- Github 주소 수정 * URL `/api/v1/users/{user_id}/github-url` * Method: `PUT` * URL Params Required: `user_id : Long` * Body ``` { githubUrl : String } ``` * Success Response: * Code: 204 NO CONTENT Content: None * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### Blog 주소 수정하기 ---- Blog 주소 수정 * URL `/api/v1/users/{user_id}/blog-url` * Method: `PUT` * URL Params Required: `user_id : Long` * Body ``` { blogUrl : String } ``` * Success Response: * Code: 204 NO CONTENT Content: None * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 자기소개(한줄) 수정하기 ---- Profile 화면에서의 자기소개 수정 * URL `/api/v1/users/{user_id}/introduce` * Method: `PUT` * URL Params Required: `user_id : Long` * Body ``` { introduce : String } ``` * Success Response: * Code: 204 NO CONTENT Content: None * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 백준 아이디 수정하기 ---- Solved.ac 티어를 보여주기 위한 백준 아이디 수정 * URL `/api/v1/users/{user_id}/baekjoon-id` * Method: `PUT` * URL Params Required: `user_id : Long` * Body ``` { baekjoonId : String } ``` * Success Response: * Code: 204 NO CONTENT Content: None * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` * Code: 404 NOT FOUND Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 관심 있는 기술 태그 추가하기 ---- 관심 있는 기술 태그 추가하기 * URL `/api/v1/users/{user_id}/tech` * Method: `POST` * URL Params Required: `user_id : Long` * Body ``` { skill : String } ``` * Success Response: * Code: 204 NO CONTENT Content: None * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 관심 있는 기술 태그 삭제하기 ---- 관심 있는 기술 태그 삭제하기 * URL `/api/v1/users/{user_id}/tech/{tech_id}` * Method: `DELETE` * URL Params Required: `user_id : Long` `tech_id : Long` * Body None * Success Response: * Code: 204 NO CONTENT Content: None * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 프로젝트 추가하기 ---- 본인이 진행한 프로젝트 추가하기 * URL `/api/v1/users/{user_id}/projects` * Method: `POST` * URL Params Required: `user_id : Long` * Body ``` { name : String, startDate : Date, endDate : Date, content : String, githubUrl : String, deployUrl : String, projectTechTag : TechTag[] } ``` * Success Response: * Code: 200 Content: ``` { projectId : Long } ``` * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 프로젝트 수정하기 ---- 본인이 진행한 프로젝트 수정하기 * URL `/api/v1/users/{user_id}/projects/{project_id}` * Method: `PUT` * URL Params Required: `user_id : Long` `project_id : Long` * Body ``` { name : String, startDate : Date, endDate : Date, content : String, githubUrl : String, deployUrl : String, projectTechTag : TechTag[] } ``` * Success Response: * Code: 200 Content: ``` { projectId : Long } ``` * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 프로젝트 삭제하기 ---- 본인이 진행한 프로젝트 삭제하기 * URL `/api/v1/users/{user_id}/projects/{project_id}` * Method: `DELETE` * URL Params Required: `user_id : Long` `project_id : Long` * Body None * Success Response: * Code: 200 Content: ``` { projectId : Long } ``` * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` * Code: 404 NOT FOUND Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ## POST 관련 ### 게시글 작성하기 ---- 게시글 작성하기 * URL `/api/v1/posts` * Method: `POST` * URL Params Required: None * Body ```json { user_id : Long, title : String, content : String, postTags : PostTag[], category : String } ``` * Success Response: * Code: 200 OK Content: ```json { postId : Long } ``` * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 게시글 읽기 ---- 게시글 읽기 * URL `/api/v1/posts/{post_id}` * Method: `GET` * URL Params Required: `post_id : Long` * Body None * Success Response: * Code: 200 OK Content: ```json { postId : Long, title : String, content : String, tag : String[], category : String, createdAt : Date, updatedAt : Date, comments : Comment[] } ``` * Error Response: * Code: 404 NOT FOUND Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 게시글 수정하기 ---- 게시글 수정하기 * URL `/api/v1/posts/{post_id}` * Method: `PUT` * URL Params Required: `post_id : Long` * Body ```json { user_id : Long, title : String, content : String, tag : String[], category : String } ``` * Success Response: * Code: 200 OK Content: ```json { postId : Long } ``` * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 게시글 삭제하기 ---- 게시글 삭제하기 * URL `/api/v1/posts/{post_id}` * Method: `DELETE` * URL Params Required: `post_id : Long` * Body None * Success Response: * Code: 200 OK Content: ```json { postId : Long } ``` * Error Response: * Code: 404 NOT FOUND Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 게시글 목록 불러오기 ---- 게시글 목록 불러오기 * URL `/posts?offset={offset}&limit={limit}&keyword={keyword}` * Method: `GET` * URL Params Required: `post_id : Long` `offset : Integer` `limit : Integer` `keyword : String` * Body None * Success Response: * Code: 200 OK Content: ```json { postCount : Integer, posts : Post[] } ``` * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ## Comment 관련 ### 댓글 작성하기 ---- 댓글 작성하기 * URL `/api/v1/posts/{post_id}/comments` * Method: `POST` * URL Params Required: `post_id : Long` * Body ```json { user_id : Long, parent_id : Long, comment : String } ``` * Success Response: * Code: 200 OK Content: ```json { commentId : Long } ``` * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 댓글 수정하기 ---- 댓글 수정하기 * URL `/api/v1/posts/{post_id}/comments/{comment_id}` * Method: `PUT` * URL Params Required: `post_id : Long` `comment_id : Long` * Body ```json { user_id : Long, parent_id : Long, comment : String } ``` * Success Response: * Code: 200 OK Content: ```json { commentId : Long } ``` * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 댓글 삭제하기 ---- 댓글 삭제하기 * URL `/api/v1/posts/{post_id}/comments/{comment_id}` * Method: `DELETE` * URL Params Required: `post_id : Long` `comment_id : Long` * Body None * Success Response: * Code: 200 OK Content: ```json { commentId : Long } ``` * Error Response: * Code: 404 NOT FOUND Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ## Message 관련 ### 쪽지 작성하기 ---- 쪽지 작성하기 * URL `/api/v1/messages/{user_id}/{from_user_id}` * Method: `POST` * URL Params Required: `user_id : Long` `from_user_id : Long` * Body ```json { content : String } ``` * Success Response: * Code: 200 OK Content: ```json { messageId : Long } ``` * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 쪽지 목록(리스트) 확인하기 ---- 쪽지 목록(리스트)하기 * URL `/api/v1/messages/{user_id}` * Method:fromUserList `GET` * URL Params Required: `user_id : Long` * Body None * Success Response: * Code: 200 OK Content: ```json { messageUsers : MessageUser[] } ``` * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 쪽지 당사자와 내용 확인하기 ---- 쪽지 당사자와 내용 확인하기 * URL `/api/v1/messages/{user_id}/{from_user_id}` * Method: `GET` * URL Params Required: `user_id : Long` `from_user_id : Long` * Body None * Success Response: * Code: 200 OK Content: ```json { messages: Message[] } ``` * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ### 쪽지 당사자와 내용 전체 삭제하기 ---- 쪽지 당사자와 내용 전체 삭제하기 * URL `/api/v1/messages/{user_id}/{from_user_id}` * Method: `DELETE` * URL Params Required: `user_id : Long` `from_user_id : Long` * Body None * Success Response: * Code: 204 NO CONTENT Content: None * Error Response: * Code: 400 BAD REQUEST Content ```json { errorMsg : String, result : String, uriRequested : String } ``` ## Model ### TechTag ```json { skill : String, color : String, textColor : String } ``` ### Project ```json { projectId : Long, userId : Long, startDate : Date, endDate : Date, title : String, content : String, githubUrl : String, deployUrl : String } ``` ### Post ```json { postId : Long, userId : Long, title : String, content : String, createdAt : Date, updatedAt : Date, : String[] } ``` ### Comment ```json { commentId : Long, userId : Long, postId : Long, parentId : Long, content : String, createdAt : Date, updatedAt : Date } ``` ### PostTag ```json { postId : Long, postTagId : Long, tag : String, } ``` ### Message ```json { messageId : Long, userId : Long, fromUserId : Long, content : String, createdAt : Date } ``` ### MessageUser ```json { userNickname : String } ```