Skip to content

API Spec 분석 및 모델링

SR edited this page Oct 2, 2021 · 22 revisions

API 분석하기

사용자 관련

도메인 METHOD URI Prarameter Authentication RETURN
User POST /api/users/login email, password X UserResponse
User POST /api/users email, username, password X UserResponse
User GET /api/user - O UserResponse
User PUT /api/user email, username, password, image, bio O UserResponse
Profile GET /api/prifiles/:username username O/X ProfileResponse
Profile POST /api/prifiles/:username/follow username O ProfileResponse
Profile DELETE /api/prifiles/:username/follow username O ProfileResponse

글 관련

도메인 METHOD URI Prarameter Authentication RETURN
Articles GET /api/articles/feed limit, offset O MultiArticlesResponse
Articles GET /api/articles tag, author, favorited, limit, offset X MultiArticlesResponse
Articles POST /api/articles article O SingleArticleResponse
Articles GET /api/articles/:slug slug X SingleArticleResponse
Articles PUT /api/articles/:slug slug, article O SingleArticleResponse
Articles DELETE /api/articles/:slug slug O -
Comments GET /api/articles/:slug/comments slug X MultipleCommentsResponse
Comments POST /api/articles/:slug/comments slug, comment O SingleCommentResponse
Comments POST /api/articles/:slug/comments/:id slug, id O -

글 좋아요 관련

도메인 METHOD URI Prarameter Authentication RETURN
Favorites POST /api/articles/:slug/favorite slug O SingleArticleResponse
Favorites DELETE /api/articles/:slug/favorite slug O SingleArticleResponse

태그 관련

도메인 METHOD URI Prarameter Authentication RETURN
Tag DELETE /api/tags - X TagResponse

URI에 대한 문제제기

  • slug는 유니크 하지만 타이틀이 변경되면 slug 또한 변경이 가능한데 이에 대한 문제는?
  • username은 유니크한가?
  • 글 조회시 조건 검색에 favorited 파라미터는 나의 관심 글에 대한 저자의 글 리스트를 조회하는 것으로 인증이 없으면 관심 글이라는 기능조차 없기 때문에 무의미한건 아닐까? (그래서 인증기능이 옵션이라는 걸까?)