실무 프로젝트로 배우는 Kotlin & Spring/이슈 관리 서비스 개발하기

API 스펙 정의

webmaster 2022. 11. 26. 18:35
728x90

이슈 목록 조회 API

GET {host}/api/v1/issues?status=TODO
  • status: TODO(기본값), IN_PROGRESS, RESOLVED

응답 

[
   {
      "id":1,
      "comments":[
         {
            "id":1,
            "issueId":1,
            "userId":1,
            "body":"이것은 댓글입니다",
            "username":"sanghoon"
         }
      ],
      "summary":"테스트",
      "description":"설명",
      "userId":1,
      "type":"TASK",
      "priority":"LOW",
      "status":"TODO",
      "createdAt":"2022-06-12 00:16:42",
      "updatedAt":"2022-06-12 00:16:42"
   }
]
  • type : BUG , TASK 
  • priority : LOW , MEDIUM , HIGH
  • status : TODO , IN_PROGRESS , RESOLVED

이슈 등록

POST {host}/api/v1/issues
{
    "summary" : "테스트",
    "description" : "설명",
    "userId": 1,
    "type" : "TASK",
    "priority" : "LOW",
    "status" : "TODO"
}

응답

{
    "id": 1,
    "comments": [],
    "summary": "테스트",
    "description": "설명",
    "userId": 1,
    "type": "TASK",
    "priority": "LOW",
    "status": "TODO",
    "createdAt": "2022-06-12 00:16:42",
    "updatedAt": "2022-06-12 00:16:42"
}

이슈 상세 조회 API

GET {host}/api/v1/issues/{issueId}

응답

{
   "id":1,
   "comments":[
      {
         "id":1,
         "issueId":1,
         "userId":1,
         "body":"이것은 댓글입니다",
         "username":"sanghoon"
      }
   ],
   "summary":"테스트",
   "description":"설명",
   "userId":1,
   "type":"TASK",
   "priority":"LOW",
   "status":"TODO"
}

이슈 수정 API

PUT {host}/api/v1/issues/{issueId}
{
    "summary" : "변경된 제목",
    "description" : "바뀐 설명",
    "type" : "BUG",
    "priority" : "HIGH",
    "status" : "TODO"
}

응답

{
    "id": 1,
    "comments": [],
    "summary": "변경된 제목",
    "description": "바뀐 설명",
    "userId": 1,
    "type": "BUG",
    "priority": "HIGH",
    "status": "TODO",
    "createdAt": "2022-06-12 00:16:41",
    "updatedAt": "2022-06-12 00:18:01"
}

이슈 삭제 API

DELETE {host}/api/v1/issues/{issueId}

응답 

204 No Content

코멘트 등록 API

POST {host}/api/v1/issues/{issueId}/comments
{
	"body":"이것은 댓글입니다"
}

응답

{
    "id": 1,
    "issueId": 1,
    "userId": 1,
    "body": "이것은 댓글입니다"
}

코멘트 수정 API

PUT {host}/api/v1/issues/{issueId}/comments/{commentId}
{
	"body":"이것은 수정된 댓글입니다"
}

응답

{
    "id": 1,
    "issueId": 1,
    "userId": 1,
    "body": "이것은 수정된 댓글입니다"
}

코멘트 삭제 API

DELETE {host}/api/v1/issues/{issueId}/comments/{commentId}

응답

204 No Content
728x90