> For the complete documentation index, see [llms.txt](https://documenttesting.gitbook.io/ecolog-api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documenttesting.gitbook.io/ecolog-api-reference/reference/api/like.md).

# 게시물 하트

## 하트 활성화 <a href="#active" id="active"></a>

## 게시물에 좋아요를 누를 수 있는 API

<mark style="color:green;">`POST`</mark> `https://www.eco-log-backend.kro.kr/api/post/heart`

#### Headers

| Name                                    | Type   | Description                                          |
| --------------------------------------- | ------ | ---------------------------------------------------- |
| key<mark style="color:red;">\*</mark>   | String | Authorization                                        |
| value<mark style="color:red;">\*</mark> | String | <p>로그인 시 JWT<br>  - ex. <code>Bearer {토큰}</code></p> |

#### Request Body

| Name                                           | Type    | Description       |
| ---------------------------------------------- | ------- | ----------------- |
| targetPostId<mark style="color:red;">\*</mark> | Integer | 좋아요를 선택하려는 게시물 ID |

{% tabs %}
{% tab title="200: OK 요청 결과" %}

{% endtab %}

{% tab title="400: Bad Request 요청 반복 시 오류" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## 하트 비활성화 <a href="#unactive" id="unactive"></a>

## 게시물에 눌렀던 좋아요를 취소하는 API

<mark style="color:red;">`DELETE`</mark> `https://www.eco-log-backend.kro.kr/api/post/heart`

#### Headers

| Name                                    | Type   | Description                                          |
| --------------------------------------- | ------ | ---------------------------------------------------- |
| key<mark style="color:red;">\*</mark>   | String | Authorization                                        |
| value<mark style="color:red;">\*</mark> | String | <p>로그인 시 JWT<br>  - ex. <code>Bearer {토큰}</code></p> |

#### Request Body

| Name         | Type    | Description     |
| ------------ | ------- | --------------- |
| targetPostId | Integer | 좋아요를 취소할 게시물 ID |

{% tabs %}
{% tab title="200: OK 요청 결과" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}
