분류
Method
API 명
설명
게시글 조회 API
GET
/articles
게시글 전체 조회
GET
/articles/{id}
게시글 단건 조회
게시글 등록 API
POST
/article
게시글 등록
게시글 수정 API
PUT
/articles/{id}
게시글 수정
게시글 삭제 API
DELETE
/articles
게시글 여러건 삭제
DELETE
/articles/{id}
게시글 단건 삭제
Response Body에는 아래의 필드가 포함됩니다.
필드
타입
필수 여부
설명
status
Boolean
필수
api 호출 결과 상태 * true : 올바른 요청 * false : 잘못된 요청
message
String
필수
결과 메시지
result
Json Object / Json Array
선택
응답 데이터 * 1건 조회 : Json Object * 전체 조회 : Json Array
curl -X GET ' http://localhost/articles/{id}'
메서드
요청 url
GET
/articles/{id}
path parameter : article id
{
"status" : true ,
"message" : "article 1 조회" ,
"result" : {
"id" : 1 ,
"title" : "게시글 1번입니다." ,
"content" : "안녕하세요 게시글 1번 본문입니다." ,
"modified_at" : "2023-12-10T21:54:32.321" ,
"created_at" : "2023-12-10T21:54:32.321"
}
}
{
"status" : false ,
"message" : "잘못된 게시글 번호입니다."
}
curl -X GET ' http://localhost/articles'
{
"status" : true ,
"message" : "article 전체 조회" ,
"result" : [
{
"id" : 1 ,
"title" : "게시글 1번입니다." ,
"content" : "안녕하세요 게시글 1번 본문입니다." ,
"modified_at" : "2023-12-10T21:54:32.321" ,
"created_at" : "2023-12-10T21:54:32.321"
},
{
"id" : 2 ,
"title" : "2번입니다." ,
"content" : "안녕하세요 게시글 2번 본문입니다." ,
"modified_at" : "2023-12-10T21:54:32.321" ,
"created_at" : "2023-12-10T21:54:32.321"
},
{
"id" : 3 ,
"title" : "게시글 3번." ,
"content" : "안녕하세요 게시글 3번 본문입니다." ,
"modified_at" : "2023-12-10T21:54:32.321" ,
"created_at" : "2023-12-10T21:54:32.321"
}
]
}
curl -X POST ' http://localhost/article'
{
"title" : "",
" content ": " "
}
파라미터
타입
필수 여부
설명
title
String
필수
제목
content
String
필수
본문
Response Header
HTTP/1.1 201 Created
Location: http://localhost:8080/articles/{id}
{
"status" : true ,
"message" : "등록되었습니다."
}
{
"status" : false ,
"message" : "제목을 입력해주세요."
}
curl -X PUT ' http://localhost/articles/{id}'
메서드
요청 url
PUT
/articles/{id}
Path Parameter : article id
{
"id" : 1 ,
"title" : "" ,
"content" : ""
}
파라미터
타입
필수 여부
설명
id
Long
필수
수정할 article id
title
String
필수
제목
content
String
필수
본문
Response Header
HTTP/1.1 201 Created
Location: http://localhost:8080/articles/{id}
{
"status" : true ,
"message" : "수정되었습니다."
}
{
"status" : false ,
"message" : "제목을 입력해주세요."
}
실패 응답 예시 - 없는 게시글 id에 대한 수정 요청
{
"status" : false ,
"message" : "잘못된 게시글 번호입니다."
}
curl -X DELETE ' http://localhost/articles/{id}'
메서드
요청 url
DELETE
/articles/{id}
Path Parameter : article id
Response Header
HTTP/1.1 204 No Content
Location: http://localhost:8080/articles
curl -X DELETE ' http://localhost/articles'
메서드
요청 url
DELETE
/articles
파라미터
타입
필수 여부
설명
정수형 배열
JsonArray
필수
삭제할 article id 번호 리스트
Response Header
HTTP/1.1 204 No Content
Location: http://localhost:8080/articles