Post

게시글 작성

POST /api/v1/posts

Headers

Name
Type
Description

Authorization*

string

accessToken

Request Body

Name
Type
Description

title*

string

content*

string

image*

string

이미지가 없으면 빈 문자열 넣기

{
    "message": "게시글 생성 성공"
}

게시글 삭제

DELETE /api/v1/posts/{id}

Path Parameters

Name
Type
Description

id*

number

Headers

Name
Type
Description

Authorization*

string

accessToken

{
    "message": "게시글 삭제 성공"
}

게시글 단건 조회

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"
}

게시글 페이징 조회

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": "게시글 수정 성공"
}

Last updated