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

# Post

post 관련 api method를 설명한 페이지

## 거리를 기준으로 식당 조회 메서드

<mark style="color:blue;">`GET`</mark> `get/restaurants`

x, y, range를 기준으로 식당 조회 (ST\_Distance\_Sphehe 사용)

#### Query Parameters

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| longitude<mark style="color:red;">\*</mark> | double | 경도          |
| latitude<mark style="color:red;">\*</mark>  | double | 위도          |
| range<mark style="color:red;">\*</mark>     | double | 거리          |

{% tabs %}
{% tab title="200: OK 거리 순으로 정렬" %}

```json
[
    {
        "id": 6,
        "location": {
            "x": 37.5786,
            "y": 26.978
        },
        "restaurantName": "경복궁1",
        "categories": [
            "분위기",
            "맛집"
        ],
        "hashTags": [
            "한식",
            "양식"
        ],
        "memberNames": [
            "정국",
            "진",
            "RM"
        ],
        "scrapCount": 0,
        "visitorReviewScore": 0.0,
        "visitorReviewCount": 0
    },
    {
        "id": 7,
        "location": {
            "x": 38.5786,
            "y": 27.978
        },
        "restaurantName": "경복궁",
        "categories": [
            "분위기",
            "맛집"
        ],
        "hashTags": [
            "한식",
            "양식"
        ],
        "memberNames": [
            "정국",
            "진",
            "RM"
        ],
        "scrapCount": 0,
        "visitorReviewScore": 0.0,
        "visitorReviewCount": 0
    }
]
```

{% endtab %}
{% endtabs %}

## Scrap 기능을 위한 메서드

<mark style="color:green;">`POST`</mark> `/user/scrap`

#### Query Parameters

| Name                                 | Type | Description  |
| ------------------------------------ | ---- | ------------ |
| id<mark style="color:red;">\*</mark> | Long | post의 id(pk) |

#### Headers

| Name          | Type   | Description             |
| ------------- | ------ | ----------------------- |
| Authorization | String | login시 생성 된 accessToken |

{% tabs %}
{% tab title="204: No Content " %}

{% endtab %}

{% tab title="404: Not Found 해당 id의 post가 없는 경우 발생" %}

{% endtab %}
{% endtabs %}

## Scrap한 글들을 조회하는 메서드

<mark style="color:blue;">`GET`</mark> `/user/scrap/list`

#### Query Parameters

| Name | Type | Description       |
| ---- | ---- | ----------------- |
| page | int  | defaultValue -> 0 |
| size | int  | defaultValue -> 5 |

#### Headers

| Name                                            | Type   | Description             |
| ----------------------------------------------- | ------ | ----------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | login시 생성 된 accessToken |

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

```json
{
    "content": [
        {
            "id": 1,
            "location": {
                "x": 37.5665,
                "y": 26.978
            },
            "restaurantName": "한식",
            "categories": [],
            "hashTags": [],
            "memberNames": [],
            "scrapCount": 1
        },
        {
            "id": 2,
            "location": {
                "x": 37.5666,
                "y": 26.9781
            },
            "restaurantName": "양식",
            "categories": [],
            "hashTags": [],
            "memberNames": [],
            "scrapCount": 1
        }
    ],
    "pageable": {
        "sort": {
            "empty": true,
            "sorted": false,
            "unsorted": true
        },
        "offset": 0,
        "pageNumber": 0,
        "pageSize": 5,
        "unpaged": false,
        "paged": true
    },
    "last": true,
    "totalPages": 1,
    "totalElements": 2,
    "size": 5,
    "number": 0,
    "sort": {
        "empty": true,
        "sorted": false,
        "unsorted": true
    },
    "first": true,
    "numberOfElements": 2,
    "empty": false
}
```

{% endtab %}
{% endtabs %}
