HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
♥️
2기 최종 프로젝트 팀별 공간
/
👩‍👩‍👦‍👦
[팀01] 김팽박이
/
🔴
API 명세
/
💰
피드
💰

피드


Postman Mock Server API 주소

TEST_MOCK_SERVER
The Postman Documenter generates and maintains beautiful, live documentation for your collections. Never worry about maintaining API documentation again.
TEST_MOCK_SERVER
https://documenter.getpostman.com/view/21169354/UzXNVxrq
TEST_MOCK_SERVER
  • 필수값(required), 데이터 타입 상기 API 문서에 기입완료
  • 개발시 호출은 하기와 같은 예시로 하시면 됩니다. (~pstmn.io/(URL API))
    • http://c69dc827-4460-41db-8879-0e6d753aff12.mock.pstmn.io/api/v1/posts?lastPostId=4&size=10
  • API 문서나 호출시 이상있으면 말씀해주세요 !

게시글 전체 조회 👍

GET /api/v1/posts

Request (param)

{ "lastPostId": 4, "size": 10 }

Response

{ "posts": [ //array { "postId": 1, //number "memberId": 1, //number "nickname": "김팽박이", //string "mbti": "ENTP", //string "updatedAt": "2022-02-11 10:11:12", //string "profileImageUrl": "http://prgrms.stuti/profile/image1.jpg", //string "contents": "오늘 spring security jwt에 대해서 학습했습니다.", //string "postImageUrl": "http://prgrms.stuti/post/studyImage1.jpg", //string "likedMembers":[1,2], //array // number "totalPostComments": 10 //number } ], "hasNext": true //boolean }
 

나의 게시글 조회 — 마이 페이지에서 쓰이는 API

GET /api/v1/posts/myposts

Request (param)

{ "lastPostId" : 4, "size" : 10 }

Response

{ "posts": [ //array { "postId": 1, //number "memberId": 1, //number "nickname": "김팽박이", //string "mbti": "ENTP", //string "updatedAt": "2022-02-11 10:11:12", //string "profileImageUrl": "http://prgrms.stuti/profile/image1.jpg", //string "contents": "오늘 spring security jwt에 대해서 학습했습니다.", //string "postImageUrl": "http://prgrms.stuti/post/studyImage1.jpg", //string "likedMembers":[1,2], //array // number "totalPostComments": 10 //number } ], "hasNext": true //boolean }
 

게시글 작성

POST /api/v1/posts

Request (body)

{ "contents": "어쩌구 저쩌구 오늘은 이걸 공부해보았습니다.", "postImage": "image.jpg" }

Response - 200 OK

{ "postId" : 1 //number }
 

게시글 수정

PATCH /api/v1/posts/{postId}

Request (body)

{ "contents" : "내용 수정 합니다.", "postImage" : "image.jpg" }

Response

{ "postId" : 1 //number }
 

게시글 삭제

DELETE /api/v1/posts/{postId}

Request

요청값 없음. postId는 url뒤에 붙는것으로 함

Response

응답값 없음. HTTP response code 204 (No Content) // 수정 200 OK
 

게시글 좋아요 등록

POST /api/v1/posts/{postId}/likes

Request

요청값 없음. postId는 url뒤에 붙는것으로 함

Response

{ "postLikeId" : 1 //number }
 

게시글 좋아요 삭제

DELETE /api/v1/posts/{postId}/likes

Request

요청값 없음. commentId는 url뒤에 붙는것으로 함

Response

응답값 없음. HTTP response code 204 (No Content) // 수정 200 OK
 

댓글 조회 - offset

GET /api/v1/posts/{postId}/comments

Request (param)

{ "lastCommentId": 4, "size": 10 }

Response

{ "contents": [ //array { "postCommentId": 1, //number "questionId": 1, //number "parentId": null, //null (부모일때) "profileImageUrl": "http://prgrms.stuti/image1.jpg", //string "memberId": 1, //number "nickname": "팽", //string "contents": "글이 좋네요 어떤스터디에 참여하고 계신가요?", //string "updatedAt": "2000-02-22 10:00:00", //(수정 changedAt -> updatedAt) string "children": [ { "parentId": 1, //number "postCommentId": 2, "questionId": 4, "profileImageUrl": "http://prgrms.stuti/image33.jpg", "memberId": 2, "nickname": "키아", "contents": "김팽박이라는 스터디에 참여하고있습니다.", "updatedAt": "2000-02-22 10:00:00" }, { "parentId": 1, "postCommentId": 3, "questionId": 5, "profileImageUrl": "http://prgrms.stuti/image33.jpg", "memberId": 1, "nickname": "팽", "contents": "아직 모집중인가요? 저도 참여하고싶습니다.", "updatedAt": "2000-02-22 10:00:00" }, { "parentId": 1, "postCommentId": 4, "questionId": 6, "profileImageUrl": "http://prgrms.stuti/image33.jpg", "memberId": 2, "nickname": "키아", "contents": "네~ 스터디 검색해서 신청해주세요 ~", "updatedAt": "2000-02-22 10:00:00" } ] } ], "hasNext": true, //boolean "totalElements": 50 //number }
 

댓글 내용 조회 (텍스트값이 정상으로 들어갔는지 확인용)

GET /api/v1/posts/{postId}/comments/{commentId}

Request

요청값 없음. commentId는 url뒤에 붙는것으로 함

Response

{ "postCommentId" : 1, //number "parentId" : null, // 부모면 null 아니면 number "contents" : "댓글입니다." //string }
 

댓글 작성

POST /api/v1/posts/{postId}/comments

Request (body)

{ "parentId" : null //최상단 댓글인경우 null, 그 외는 부모의 commnentId "contents": "댓글입니다." }

Response

{ "postCommentId": 1, //number "parentId": null, //부모면 null 아니면 number "profileImageUrl": "http://prgrms.stuti/image1.jpg", //string "memberId": 1, //number "nickname": "팽", //string "contents": "글이 좋네요 어떤스터디에 참여하고 계신가요?", //string "updatedAt": "2000-02-22 10:00:00" //string }
 

댓글 수정

PATCH /api/v1/posts/{postId}/comments/{commentId}

Request (body)

{ "parentId": null, //댓글이면 null 아니면 number "contents" : "수정된 대댓글입니다." //string }

Response

{ "postCommentId": 1, //댓글 작성과 동일 "parentId": null, "profileImageUrl": "http://prgrms.stuti/image1.jpg", "memberId": 1, "nickname": "팽", "contents": "글이 좋네요 어떤스터디에 참여하고 계신가요?", "updatedAt": "2000-02-22 10:00:00" }
 

댓글 삭제

DELETE /api/v1/posts/{postId}/comments/{commentId}

Request

요청값 없음. commentId는 url뒤에 붙는것으로 함

Response

응답값 없음. HTTP response code 204 (No Content)
 
얘기 해 볼것
  • 댓글도 페이징 할건지?
    • 한다. 댓글은 최초 피드 조회시에는 보여주지 않다가, 댓글 조회 request 받으면 size 만큼 할거임
  • 피드 무한스크롤 할건지?
    • 네
  • 댓글 삭제 기록 남길건지(화면에 ”삭제된 댓글 입니다.”)?
    • 아니요. 그냥 아예 삭제
  • UPSERT 지원할건지?
    • advanced
  • data type, null 허용여부 표기하기
 
 
spring multipart
www.baeldung.com
https://www.baeldung.com/sprint-boot-multipart-requests