---
# System prepended metadata

title: '**「和 Restaurant 有關」的 API**'

---

# **「和 Restaurant 有關」的 API**

## GET /api/v1/restaurants

顯示全部餐廳

## Parameters

NO

## Request body

NO

## Response

Success | Code : 200

```
{
    "restaurants": [
        {
            "id": 1,
            "name": "Mrs. Cecil Leannon",
            "tel": "1-240-250-5580",
            "address": "44854 Veum Mountains",
            "openingHours": "08:00",
            "description": "Eius cupiditate provident sit nostrum magni saepe ",
            "image": "https://loremflickr.com/320/240/restaurant,food/?random=89.27241615419679",
            "viewCounts": 20,
            "createdAt": "2022-07-13T15:56:53.000Z",
            "updatedAt": "2022-07-16T15:51:51.000Z",
            "categoryId": 4,
            "Category": {
                "id": 4,
                "name": "墨西哥料理",
                "createdAt": "2022-07-13T15:56:52.000Z",
                "updatedAt": "2022-07-13T15:56:52.000Z"
            },
            "isFavorited": false,
            "isLiked": false
        },
        {
            "id": 2,
            "name": "Dorothy Wyman",
            "tel": "555.876.9405 x7315",
            "address": "22108 Emmerich Springs",
            "openingHours": "08:00",
            "description": "Reiciendis est eos qui nesciunt. Quo assumenda sed",
            "image": "https://loremflickr.com/320/240/restaurant,food/?random=64.94734023560473",
            "viewCounts": 2,
            "createdAt": "2022-07-13T15:56:53.000Z",
            "updatedAt": "2022-07-16T14:04:00.000Z",
            "categoryId": 2,
            "Category": {
                "id": 2,
                "name": "日本料理",
                "createdAt": "2022-07-13T15:56:52.000Z",
                "updatedAt": "2022-07-13T15:56:52.000Z"
            },
            "isFavorited": false,
            "isLiked": false
        },
        {
            "id": 3,
            "name": "Rodney Ritchie",
            "tel": "(656) 356-4883 x72553",
            "address": "086 Weimann Groves",
            "openingHours": "08:00",
            "description": "Velit inventore voluptas harum ut atque occaecati ",
            "image": "https://loremflickr.com/320/240/restaurant,food/?random=40.55705667441292",
            "viewCounts": 1,
            "createdAt": "2022-07-13T15:56:53.000Z",
            "updatedAt": "2022-07-16T12:23:29.000Z",
            "categoryId": 7,
            "Category": {
                "id": 7,
                "name": "複合式料理",
                "createdAt": "2022-07-13T15:56:52.000Z",
                "updatedAt": "2022-07-13T15:56:52.000Z"
            },
            "isFavorited": false,
            "isLiked": false
        }
    ]
}
```
Failure Response | code : 401

```
{
    "status": "error",
    "message": "unauthorized"
}
```


## GET /api/v1/restaurants/:id

顯示個別餐廳詳細資料

## Parameters

| Params | Required | Type | Description |
| --- | --- | --- | --- |
| id | Required | int | 餐廳的 id |

## Request Body

NO

## Response

Success | Code : 200

```
{
    "restaurant": {
        "id": 3,
        "name": "Rodney Ritchie",
        "tel": "(656) 356-4883 x72553",
        "address": "086 Weimann Groves",
        "openingHours": "08:00",
        "description": "Velit inventore voluptas harum ut atque occaecati tenetur. Et ullam amet sint inventore numquam reprehenderit vel. Consequatur earum voluptatem provident rem iure excepturi aut. Dicta molestiae delectus dolorum facilis qui. Est itaque consequatur optio.",
        "image": "https://loremflickr.com/320/240/restaurant,food/?random=40.55705667441292",
        "viewCounts": 3,
        "createdAt": "2022-07-13T15:56:53.000Z",
        "updatedAt": "2022-07-20T14:33:10.000Z",
        "categoryId": 7,
        "Category": {
            "id": 7,
            "name": "複合式料理",
            "createdAt": "2022-07-13T15:56:52.000Z",
            "updatedAt": "2022-07-13T15:56:52.000Z"
        }
}
```
Failure Response | code : 401
```
{
    "status": "error",
    "message": "unauthorized"
}
```

## GET /api/v1/restaurants/feeds

顯示最新上架 3 個餐廳以及最新 3 筆評論

## Parameters

NO

## Request Body

NO

## Response

Success | Code : 200

```
{
    "restaurants": [
        {
            "id": 1,
            "name": "Mrs. Cecil Leannon",
            "tel": "1-240-250-5580",
            "address": "44854 Veum Mountains",
            "openingHours": "08:00",
            "description": "Eius cupiditate provident sit nostrum magni saepe quos.",
            "image": "https://loremflickr.com/320/240/restaurant,food/?random=89.27241615419679",
            "viewCounts": 20,
            "createdAt": "2022-07-13T15:56:53.000Z",
            "updatedAt": "2022-07-16T15:51:51.000Z",
            "categoryId": 4,
            "Category": {
                "id": 4,
                "name": "墨西哥料理",
                "createdAt": "2022-07-13T15:56:52.000Z",
                "updatedAt": "2022-07-13T15:56:52.000Z"
            }
        },
        {
            "id": 2,
            "name": "Dorothy Wyman",
            "tel": "555.876.9405 x7315",
            "address": "22108 Emmerich Springs",
            "openingHours": "08:00",
            "description": "Reiciendis est eos qui nesciunt. Quo assumenda sed fuga. Est a ut harum unde distinctio dolor. Sed beatae eum voluptate iste. Porro corrupti aliquam. Est porro dolores qui omnis reiciendis.\n \rOdio veniam corporis. Consectetur dolores similique quis consequatur aperiam quis. Nulla repudiandae sed.\n \rQuod enim suscipit ut officiis. Ducimus natus occaecati beatae illo. Praesentium totam optio ut est sequi repellat quae sint praesentium. Aut quas eos beatae. Voluptate qui nisi ipsam asperiores molestias aut temporibus odit. Facere vitae dignissimos tenetur voluptatem.",
            "image": "https://loremflickr.com/320/240/restaurant,food/?random=64.94734023560473",
            "viewCounts": 2,
            "createdAt": "2022-07-13T15:56:53.000Z",
            "updatedAt": "2022-07-16T14:04:00.000Z",
            "categoryId": 2,
            "Category": {
                "id": 2,
                "name": "日本料理",
                "createdAt": "2022-07-13T15:56:52.000Z",
                "updatedAt": "2022-07-13T15:56:52.000Z"
            }
        },
        {
            "id": 3,
            "name": "Rodney Ritchie",
            "tel": "(656) 356-4883 x72553",
            "address": "086 Weimann Groves",
            "openingHours": "08:00",
            "description": "Velit inventore voluptas harum ut atque occaecati tenetur. Et ullam amet sint inventore numquam reprehenderit vel. Consequatur earum voluptatem provident rem iure excepturi aut. Dicta molestiae delectus dolorum facilis qui. Est itaque consequatur optio.",
            "image": "https://loremflickr.com/320/240/restaurant,food/?random=40.55705667441292",
            "viewCounts": 4,
            "createdAt": "2022-07-13T15:56:53.000Z",
            "updatedAt": "2022-07-20T14:33:31.000Z",
            "categoryId": 7,
            "Category": {
                "id": 7,
                "name": "複合式料理",
                "createdAt": "2022-07-13T15:56:52.000Z",
                "updatedAt": "2022-07-13T15:56:52.000Z"
            }
        }
    ],
    "comments": [
        {
            "id": 4,
            "text": "Voluptate ea et necessitatibus.",
            "user_id": 1,
            "restaurant_id": 11,
            "createdAt": "2022-07-13T15:56:53.000Z",
            "updatedAt": "2022-07-13T15:56:53.000Z",
            "restaurantId": 11,
            "userId": 1,
            "User": {
                "id": 1,
                "name": "root",
                "email": "root@example.com",
                "password": "$2a$10$TanvhzNPNv5M3o9F2Z6ReObOVtcT8oXJggCOog8I5Wm37ePY86WR2",
                "isAdmin": 1,
                "image": "https://i.imgur.com/95OpHUx.jpeg",
                "createdAt": "2022-07-13T15:56:52.000Z",
                "updatedAt": "2022-07-13T19:08:40.000Z"
            },
            "Restaurant": {
                "id": 11,
                "name": "Terrell Lueilwitz",
                "tel": "(821) 751-5023 x2782",
                "address": "263 Simonis Parkway",
                "openingHours": "08:00",
                "description": "qui consequatur officia",
                "image": "https://loremflickr.com/320/240/restaurant,food/?random=28.010994332996454",
                "viewCounts": 2,
                "createdAt": "2022-07-13T15:56:53.000Z",
                "updatedAt": "2022-07-14T16:38:09.000Z",
                "categoryId": 1
            }
        },
        {
            "id": 23,
            "text": "Ut et non accusamus aut architecto voluptatem est temporibus mollitia.",
            "user_id": 1,
            "restaurant_id": 3,
            "createdAt": "2022-07-13T15:56:53.000Z",
            "updatedAt": "2022-07-13T15:56:53.000Z",
            "restaurantId": 3,
            "userId": 1,
            "User": {
                "id": 1,
                "name": "root",
                "email": "root@example.com",
                "password": "$2a$10$TanvhzNPNv5M3o9F2Z6ReObOVtcT8oXJggCOog8I5Wm37ePY86WR2",
                "isAdmin": 1,
                "image": "https://i.imgur.com/95OpHUx.jpeg",
                "createdAt": "2022-07-13T15:56:52.000Z",
                "updatedAt": "2022-07-13T19:08:40.000Z"
            },
            "Restaurant": {
                "id": 3,
                "name": "Rodney Ritchie",
                "tel": "(656) 356-4883 x72553",
                "address": "086 Weimann Groves",
                "openingHours": "08:00",
                "description": "Velit inventore voluptas harum ut atque occaecati tenetur. Et ullam amet sint inventore numquam reprehenderit vel. Consequatur earum voluptatem provident rem iure excepturi aut. Dicta molestiae delectus dolorum facilis qui. Est itaque consequatur optio.",
                "image": "https://loremflickr.com/320/240/restaurant,food/?random=40.55705667441292",
                "viewCounts": 4,
                "createdAt": "2022-07-13T15:56:53.000Z",
                "updatedAt": "2022-07-20T14:33:31.000Z",
                "categoryId": 7
            }
        },
        {
            "id": 21,
            "text": "Doloribus vero aperiam nesciunt.",
            "user_id": 2,
            "restaurant_id": 47,
            "createdAt": "2022-07-13T15:56:53.000Z",
            "updatedAt": "2022-07-13T15:56:53.000Z",
            "restaurantId": 47,
            "userId": 2,
            "User": {
                "id": 2,
                "name": "user1",
                "email": "user1@example.com",
                "password": "$2a$10$Bdhk7zJUkVW2OEAnFrUZgeqX69UVeZxTaMiZCyz7TQj9468eI8m7S",
                "isAdmin": 0,
                "image": null,
                "createdAt": "2022-07-13T15:56:52.000Z",
                "updatedAt": "2022-07-13T15:56:52.000Z"
            },
            "Restaurant": {
                "id": 47,
                "name": "Mrs. James Mraz",
                "tel": "1-779-690-5934 x87529",
                "address": "00735 Wyatt Throughway",
                "openingHours": "08:00",
                "description": "Quod qui autem corporis provident nemo ratione sequi. Est in beatae quaerat qui. Quo perspiciatis aut aliquid accusamus nisi voluptas odio repudiandae aspernatur.",
                "image": "https://loremflickr.com/320/240/restaurant,food/?random=51.194115498452234",
                "viewCounts": 0,
                "createdAt": "2022-07-13T15:56:53.000Z",
                "updatedAt": "2022-07-13T15:56:53.000Z",
                "categoryId": 5
            }
        }
    ]
}
```
Failure Response | code : 401
```
{
    "status": "error",
    "message": "unauthorized"
}
```
