개요

Http 동사

본 REST API에서 사용하는 HTTP 동사(verbs)는 가능한 표준 HTTP 와 REST 규약을 따릅니다.

동사 용례

GET

리소스를 가져올 때 사용

POST

새 리소스를 만들 때 사용

PUT

기존 리소스를 수정할 때 사용

PATCH

기존 리소스의 일부를 수정할 때 사용

DELETE

기존 리소스를 삭제할 떄 사용

HTTP 상태 코드

본 REST API에서 사용하는 HTTP 상태 코드는 가능한 표준 HTTP와 REST 규약을 따릅니다.

상태 코드 용례

200 OK

요청을 성공적으로 처리함

201 Created

새 리소스를 성공적으로 생성함. 응답의 Location 헤더에 해당 리소스의 URI가 담겨있다.

204 No Content

기존 리소스를 성공적으로 수정함.

400 Bad Request

잘못된 요청을 보낸 경우. 응답 본문에 더 오류에 대한 정보가 담겨있다.

404 Not Found

요청한 리소스가 없음.

409 Conflict

클라이언트의 요청이 서버의 상태와 충돌이 발생한 경우.

게시물 관리

관리자 회원만 사용가능합니다.

게시물 목록 조회

요청

GET /admin/posts?searchKeyword=title&searchCondition=TITLE&page=0&size=10 HTTP/1.1
Host: jeeoklog.jeeok.com
Parameter Description

searchCondition

검색 조건

searchKeyword

검색 키워드

page

검색 페이지

size

검색 사이즈

응답

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 635

{"transaction_time":"2022-11-10T15:40:41.2680476","code":"SUCCESS","message":null,"errors":null,"data":[{"postId":null,"postTitle":"title0","postContent":"content","hits":0,"createdDate":null,"createdBy":null},{"postId":null,"postTitle":"title1","postContent":"content","hits":0,"createdDate":null,"createdBy":null},{"postId":null,"postTitle":"title2","postContent":"content","hits":0,"createdDate":null,"createdBy":null},{"postId":null,"postTitle":"title3","postContent":"content","hits":0,"createdDate":null,"createdBy":null},{"postId":null,"postTitle":"title4","postContent":"content","hits":0,"createdDate":null,"createdBy":null}]}
Path Type Description

transaction_time

String

api 요청 시간

code

String

SUCCESS or ERROR

message

Null

메시지

errors

Null

에러

data[*].postId

Null

게시물 고유번호

data[*].postTitle

String

게시물 제목

data[*].postContent

String

게시물 내용

data[*].hits

Number

조회수

data[*].createdDate

Null

등록일

data[*].createdBy

Null

등록자

게시물 단건 조회

요청

GET /admin/posts/0 HTTP/1.1
Host: jeeoklog.jeeok.com
Table 1. /admin/posts/{postId}
Parameter Description

postId

게시물 고유번호

응답

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 208

{"transaction_time":"2022-11-10T15:40:41.1980509","code":"SUCCESS","message":null,"errors":null,"data":{"postId":null,"postTitle":"title","postContent":"content","hits":0,"createdDate":null,"createdBy":null}}
Path Type Description

transaction_time

String

api 요청 시간

code

String

SUCCESS or ERROR

message

Null

메시지

errors

Null

에러

data.postId

Null

게시물 고유번호

data.postTitle

String

게시물 제목

data.postContent

String

게시물 내용

data.hits

Number

조회수

data.createdDate

Null

등록일

data.createdBy

Null

등록자

게시물 저장

요청

POST /admin/posts HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 45
Host: jeeoklog.jeeok.com

{"postTitle":"title","postContent":"content"}
Path Type Description

postTitle

String

게시물 제목

postContent

String

게시물 내용

응답

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 124

{"transaction_time":"2022-11-10T15:40:41.0910483","code":"SUCCESS","message":null,"errors":null,"data":{"savedPostId":null}}
Path Type Description

transaction_time

String

api 요청 시간

code

String

SUCCESS or ERROR

message

Null

메시지

errors

Null

에러

data.savedPostId

Null

저장된 게시물 고유번호

게시물 수정

요청

PUT /admin/posts/0 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 59
Host: jeeoklog.jeeok.com

{"postTitle":"update_title","postContent":"update_content"}
Table 2. /admin/posts/{postId}
Parameter Description

postId

게시물 고유번호

Path Type Description

postTitle

String

게시물 제목

postContent

String

게시물 내용

응답

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 126

{"transaction_time":"2022-11-10T15:40:41.2280475","code":"SUCCESS","message":null,"errors":null,"data":{"updatedPostId":null}}
Path Type Description

transaction_time

String

api 요청 시간

code

String

SUCCESS or ERROR

message

Null

메시지

errors

Null

에러

data.updatedPostId

Null

수정된 게시물 고유번호

게시물 삭제

요청

DELETE /admin/posts/0 HTTP/1.1
Host: jeeoklog.jeeok.com
Table 3. /admin/posts/{postId}
Parameter Description

postId

게시물 고유번호

응답

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 106

{"transaction_time":"2022-11-10T15:40:41.30305","code":"SUCCESS","message":null,"errors":null,"data":null}
Path Type Description

transaction_time

String

api 요청 시간

code

String

SUCCESS or ERROR

message

Null

메시지

errors

Null

에러

data

Null

데이터