# POST API

## 게시물 쓰기

<mark style="color:green;">`POST`</mark> `https://Yeollin-jib/post`

form-data : image (multipart/form-data)

#### Request Body

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| image<mark style="color:red;">\*</mark>     | file   |             |
| contents<mark style="color:red;">\*</mark>  | String |             |
| title<mark style="color:red;">\*</mark>     | String |             |
| longitude<mark style="color:red;">\*</mark> | String |             |
| dueDate<mark style="color:red;">\*</mark>   | String |             |
| address<mark style="color:red;">\*</mark>   | String |             |
| latitude<mark style="color:red;">\*</mark>  | String |             |
| category1<mark style="color:red;">\*</mark> | String |             |
| category2                                   | String |             |

{% tabs %}
{% tab title="201: Created " %}
![](https://1863515620-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB1Q97Frgb6lsOVPvauMx%2Fuploads%2FKkSYt71eiJB9Q2f2wZNB%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-10-29%20%E1%84%8B%E1%85%A9%E1%84%8C%E1%85%A5%E1%86%AB%2011.35.10.png?alt=media\&token=4f2a3399-2270-4b6e-9a98-725aeae526b2)
{% endtab %}

{% tab title="403: Forbidden " %}

```javascript
{
    message: "게시글이 생성되지 않았습니다."
}
```

{% endtab %}
{% endtabs %}

## 게시물 리스트 조회(첫 게시물 페이지)

<mark style="color:blue;">`GET`</mark> `https://Yeollin-jib.site/post/page`

{% tabs %}
{% tab title="200: OK " %}
![](https://1863515620-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB1Q97Frgb6lsOVPvauMx%2Fuploads%2FgUFUPJ2RxgIUJvp4KoWR%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-10-29%20%E1%84%8B%E1%85%A9%E1%84%8C%E1%85%A5%E1%86%AB%2011.46.08.png?alt=media\&token=496c8073-a181-451f-ba81-b574451cf47b)
{% endtab %}

{% tab title="404: Not Found " %}

```javascript
{
    message: "더이상 조회할 게시물이 없습니다."
}
```

{% endtab %}
{% endtabs %}

## 게시물 리스트 조회 (무한스크롤)

<mark style="color:blue;">`GET`</mark> `https://Yeollin-jib/post/page/:postId`

#### Path Parameters

| Name   | Type   | Description |
| ------ | ------ | ----------- |
| postId | params |             |

#### Headers

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| AccessToken | String |             |

{% tabs %}
{% tab title="200: OK " %}
![](https://1863515620-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB1Q97Frgb6lsOVPvauMx%2Fuploads%2FlwrEXKTdQEYn7K1C8X0t%2Fimage.png?alt=media\&token=7bc40803-4b71-45cf-b6d2-22d3fe33a8e4)

```
// Some code
```

{% endtab %}

{% tab title="404: Not Found " %}

```javascript
{
   message: "더이상 조회할 게시물이 없습니다."
}
```

{% endtab %}
{% endtabs %}

## 유저가 작성한 게시물 전체 조회 (마이페이지 내가 쓴 글)

<mark style="color:blue;">`GET`</mark> `https://Yeollin-jib/post/user`

#### Headers

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| AccessToken | String |             |

{% tabs %}
{% tab title="200: OK " %}
![](https://1863515620-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB1Q97Frgb6lsOVPvauMx%2Fuploads%2FQGjoxUrERyxAcSlFGdW7%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-10-29%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%2012.03.41.png?alt=media\&token=7108baed-5126-46f0-9133-e0ef7d0eec20)
{% endtab %}

{% tab title="404: Not Found " %}

```javascript
{
    message: "작성한 게시물이 없습니다."
}
```

{% endtab %}
{% endtabs %}

## 게시물 카테고리별 리스트 조회

<mark style="color:blue;">`GET`</mark> `https://Yeollin-jib/post/:id`

![](https://1863515620-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB1Q97Frgb6lsOVPvauMx%2Fuploads%2Fa8p89IXAndLkk0Cm3zGz%2FKakaoTalk_Image_2021-10-20-21-55-09.png?alt=media\&token=8ad9e118-2f00-4a68-b5ce-dd5eb6d4753a)

#### Query Parameters

| Name  | Type   | Description |
| ----- | ------ | ----------- |
| code1 | number |             |
| code2 | String |             |

{% tabs %}
{% tab title="200: OK " %}
![](https://1863515620-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB1Q97Frgb6lsOVPvauMx%2Fuploads%2FF49MBMGHeQlhbaYpRyOj%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-10-29%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%2012.08.40.png?alt=media\&token=e52be382-7aa7-40df-a269-8a31633713a9)
{% endtab %}

{% tab title="404: Not Found " %}

```javascript
{
    message: "작성한 게시물이 없습니다."
}
```

{% endtab %}
{% endtabs %}

## 게시물 조회 (열람)

<mark style="color:blue;">`GET`</mark> `https://Yeollin-jib/post/category?code1={}&code2={}`

#### Path Parameters

| Name   | Type   | Description |
| ------ | ------ | ----------- |
| postId | parmas |             |

{% tabs %}
{% tab title="200: OK " %}
![](https://1863515620-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB1Q97Frgb6lsOVPvauMx%2Fuploads%2FfAx0RqMDoVf1MgzZb1YU%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-10-29%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%2012.11.09.png?alt=media\&token=b5d42f6e-8ef5-4d24-b112-dc74da9e7ec3)
{% endtab %}

{% tab title="404: Not Found " %}

```javascript
{
    message: "이미 삭제된 게시글이거나 없는 게시글 입니다."
}
```

{% endtab %}
{% endtabs %}

## 게시물 수정 (수정 부분만 전송)

<mark style="color:purple;">`PATCH`</mark> `https://Yeollin-jib/post/:id`

imageDelete(remove), imagePath(save)

![](https://1863515620-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB1Q97Frgb6lsOVPvauMx%2Fuploads%2FSHkuYUN3PRRmMHJ5es76%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-10-29%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%2012.19.51.png?alt=media\&token=bbfe1227-6a2e-41a7-af24-9f0b5d7b98a5)

#### Request Body

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| imageDelete | String |             |
| imagePath   | String |             |
| imagefile   | file   |             |
| title       | String |             |
| contents    | String |             |
| address     | String |             |
| dueDate     | String |             |
| latitude    | String |             |
| longitude   | String |             |

{% tabs %}
{% tab title="201: Created " %}

```javascript
{
    postId: postId, message: "게시글이 수정되었습니다."
}
```

{% endtab %}

{% tab title="409: Conflict " %}

```javascript
{
    massage: "삭제 되었거나, 존재하지 않는 파일입니다."
}
```

{% endtab %}
{% endtabs %}

## 게시물 카테고리 True False 지정

<mark style="color:purple;">`PATCH`</mark> `https://Yeollin-jib/post/category`

![](https://1863515620-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB1Q97Frgb6lsOVPvauMx%2Fuploads%2FG4AhuIFJUmAy5uvpfXxk%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-11-10%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%201.37.08.png?alt=media\&token=0dacb8d0-7435-4f87-a96f-7eea3a2f673c)

#### Request Body

| Name       | Type   | Description        |
| ---------- | ------ | ------------------ |
| PostId     | String | postId             |
| categoryId | String | promise categoryId |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
   "message": "정보 수정이 완료되었습니다"
}
```

{% endtab %}

{% tab title="501: Not Implemented " %}

```javascript
{
    message: "서버 에러 입니다."
}
```

{% endtab %}
{% endtabs %}

## 게시물 삭제

<mark style="color:red;">`DELETE`</mark> `https://Yeollin-jib/post/:postid`

#### Path Parameters

| Name   | Type  | Description |
| ------ | ----- | ----------- |
| postId | prams |             |

{% tabs %}
{% tab title="200: OK " %}
![](https://1863515620-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB1Q97Frgb6lsOVPvauMx%2Fuploads%2F2dB4A2KYDzDoGzgkdXHG%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-10-29%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%2012.21.46.png?alt=media\&token=826e85c2-a564-46e3-9e67-527d495ec025)
{% endtab %}

{% tab title="404: Not Found " %}

```javascript
{
    message: "삭제하려는 게시물이 없습니다."
}
```

{% endtab %}
{% endtabs %}
