Post
게시글 작성
POST /api/v1/posts
Headers
Name
Type
Description
Authorization*
string
accessToken
Request Body
Name
Type
Description
title*
string
content*
string
image*
string
이미지가 없으면 빈 문자열 넣기
{
"message": "게시글 생성 성공"
}{
"code": "JSON_001",
"message": "잘못된 JSON 요청입니다",
"detail_message": "title: 공백일 수 없습니다, "
}{
"code": "TOKEN_001",
"message": "유효하지 않은 토큰입니다",
"detail_message": "An error occurred while attempting to decode the Jwt: Jwt expired at 2023-09-30T13:57:22Z"
}게시글 삭제
DELETE /api/v1/posts/{id}
Path Parameters
Name
Type
Description
id*
number
Headers
Name
Type
Description
Authorization*
string
accessToken
{
"message": "게시글 삭제 성공"
}{
"code": "POST_001",
"message": "존재하지 않는 게시글입니다",
"detail_message": "존재하지 않는 post id입니다"
}{
"code": "TOKEN_001",
"message": "유효하지 않은 토큰입니다",
"detail_message": "An error occurred while attempting to decode the Jwt: Jwt expired at 2023-09-30T13:57:22Z"
}게시글 단건 조회
GET /api/v1/posts/{id}
Path Parameters
Name
Type
Description
id*
number
Headers
Name
Type
Description
Authorization
string
accessToken
{
"id": 1,
"title": "test title",
"content": "test content",
"author": "임시완",
"created_at": "2023-10-14T09:06:12.737169",
"modified_at": "2023-10-14T09:06:12.737169",
"heart_count": 0,
"comments": [
{
"comment_id": 1,
"content": "댓글 내용입니다.",
"author": "임시완",
"created_at": "2023-10-14T09:06:22.916416",
"modified_at": "2023-10-14T09:06:22.916416",
"heart_count": 0,
"is_hearted": false
}
],
"is_hearted": false,
"image": "1.jpg"
}{
"code": "POST_001",
"message": "존재하지 않는 게시글입니다",
"detail_message": "존재하지 않는 post id입니다"
}게시글 페이징 조회
GET /api/v1/posts
Query Parameters
Name
Type
Description
page
int
0번부터 시작
size
int
페이지 당 게시글 개수
sortBy
string
type: id, heart
direction
string
type: desc, asc
searchBy
string
type: all, title, content, author
keyword
string
검색어
startDate
string
"2017-01-01"
endDate
string
"2023-01-01"
Headers
Name
Type
Description
Authorization
string
accessToken
{
"content": [
{
"id": 3,
"title": "test title",
"content": "test content",
"author": "임시완",
"created_at": "2023-10-08T22:27:41.047614",
"modified_at": "2023-10-08T22:27:41.047614",
"heart_count": 0,
"image": "3.jpg"
},
{
"id": 2,
"title": "test title",
"content": "test content",
"author": "임시완",
"created_at": "2023-10-08T22:27:40.188821",
"modified_at": "2023-10-08T22:27:40.188821",
"heart_count": 0,
"image": "2.jpg"
},
{
"id": 1,
"title": "test title",
"content": "test content",
"author": "임시완",
"created_at": "2023-10-08T22:27:39.313847",
"modified_at": "2023-10-08T22:27:46.979549",
"heart_count": 1,
"image": "1.jpg"
}
],
"pageable": {
"pageNumber": 0,
"pageSize": 7,
"sort": {
"empty": false,
"sorted": true,
"unsorted": false
},
"offset": 0,
"paged": true,
"unpaged": false
},
"last": true,
"totalPages": 1,
"totalElements": 3,
"sort": {
"empty": false,
"sorted": true,
"unsorted": false
},
"first": true,
"number": 0,
"size": 7,
"numberOfElements": 3,
"empty": false
}게시글 수정
PATCH /api/v1/posts/{id}
Path Parameters
Name
Type
Description
id*
number
Headers
Name
Type
Description
Authorization*
string
accessToken
Request Body
Name
Type
Description
title
string
content
string
image
string
{
"message": "게시글 수정 성공"
}{
"code": "JSON_001",
"message": "잘못된 JSON 요청입니다",
"detail_message": "title: 공백일 수 없습니다, "
}{
"code": "POST_001",
"message": "존재하지 않는 게시글입니다",
"detail_message": "존재하지 않는 post id입니다"
}{
"code": "TOKEN_001",
"message": "유효하지 않은 토큰입니다",
"detail_message": "An error occurred while attempting to decode the Jwt: Jwt expired at 2023-09-30T13:57:22Z"
}Last updated