更新餐飲菜單

餐點菜單加入商家資訊後,顧客就能瞭解餐廳的菜單選擇,並取得菜單項目的其他資訊。

如要更新商家資訊的餐飲菜單,請先呼叫 accounts.locations.getFoodMenus。以下是要求範例:

GET
https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/foodMenus

回應會包含刊登項目目前 FoodMenus 的 JSON 表示法。視需要修改 FoodMenus 物件,然後呼叫 accounts.locations.updateFoodMenus。詳情請參閱「上傳或取代餐飲菜單」。

您可以使用 Google My Business API 更新下列欄位:

欄位
名稱

必要

食物名稱,例如 Hamburger

價格

必要

餐點價格。

價格幣別

必要

餐點價格的幣別,例如 U.S. dollar

Item description

選用

食物項目的簡短說明。

選單專區

選用

餐點的邏輯群組,例如 BreakfastHamburger-Fries combo.

營養

選用 (建議)

營養資訊,例如 Total Fat=3g

放送對象人數

選用

食物可供幾人食用。

份量

選用

食物數量。例如:8-piece of nuggets

準備方法

選用

食物可採用的特定烹調方法。

美食

選用 (建議)

食物的特定料理類型。

辣度

選用

食物的辣度,例如 nonemildmediumhot

過敏原

選用 (建議)

食品中的過敏原,例如 dairyeggfishpeanutshellfishsoytree nutwheat

飲食

選用 (建議)

食物的飲食限制,例如 halalkosherorganicveganvegetariangluten free

選項

選用

食物選項類型,例如 chicken 泰式炒河粉和 veggie 泰式炒河粉。

食物相片

選用

特定食物的相片。

上傳或取代餐飲菜單

並非所有地點都能上傳餐飲菜單。

如要判斷地點是否符合資格,請呼叫 locations.get 來查看 Metadata。如果 canHaveFoodMenus 設為 true,您就可以上傳餐飲菜單。

如果您的位置符合資格,請對 accounts.locations.updateFoodMenus 執行 PATCH 呼叫。

以下是包含所有選填欄位的示例要求:

PATCH
https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/foodMenus

{
   "menus": [
       {
           "cuisines": [
                "AMERICAN"
            ],
           "labels": [
               {
                   "displayName": "Menu",
                   "description": "Main Menu of my Restaurant",
                   "languageCode": "en"
               }
           ],
           "sections": [
               {
                   "labels": {
                       "displayName": "Main Dishes",
                       "languageCode": "en"
                   },
                   "items": [
                       {
                           "labels": {
                               "displayName": "Dish1",
                               "description": "Dish1 - our original dish!",
                               "languageCode": "en"
                           },
                           "attributes": {
                               "price": {
                                   "currencyCode": "USD",
                                   "units": 20
                               },
                               "dietaryRestriction": "ORGANIC",
                               "nutritionFacts": {
                                   "calories": {
                                       "lowerAmount": 400,
                                       "upperAmount": 500,
                                       "unit": "CALORIE"
                                   },
                                   "totalFat": {
                                       "lowerAmount": 95,
                                       "upperAmount": 110,
                                       "unit": "GRAM"
                                   },
                                   "cholesterol": {
                                       "lowerAmount": 100,
                                       "upperAmount": 120,
                                       "unit": "MILLIGRAM"
                                   },
                                   "sodium": {
                                       "lowerAmount": 30,
                                       "upperAmount": 45,
                                       "unit": "MILLIGRAM"
                                   },
                                   "totalCarbohydrate": {
                                       "lowerAmount": 78,
                                       "upperAmount": 92,
                                       "unit": "MILLIGRAM"
                                   },
                                   "protein": {
                                       "lowerAmount": 25,
                                       "upperAmount": 35,
                                       "unit":"MILLIGRAM"
                                   }
                               },
                               "ingredients": [
                                   {
                                       "labels": [
                                           {
                                               "displayName": "Ingredient 1",
                                               "description": "Description for ingredient 1",
                                               "languageCode": "en"
                                           },
                                           {
                                               "displayName": "Ingredient 2",
                                               "languageCode": "en"
                                           }
                                       ]
                                   }
                               ],
                               "servesNumPeople": 1,
                               "preparationMethods": [
                                   "BAKED",
                                   "BOILED",
                                   "FRIED"
                               ],
                               "portionSize": {
                                   "quantity": 2,
                                   "unit": {
                                       "displayName": "Pieces",
                                       "languageCode": "en"
                                   }
                               },
                               "mediaKeys": [
                                   "AF1QipP_VOlJzXs2aOJ31234565cb2KPrvN"
                               ]
                           },
                           "options": [
                               {
                                   "labels":
                                       {
                                           "displayName": "Dish1 - spicy",
                                           "description": "Dish1 - a spicy version of our dish!",
                                           "languageCode": "en"
                                       },
                                   "attributes": {
                                       "price": {
                                           "currencyCode": "USD",
                                           "units": 20
                                       }
                                   }
                               },
                               {
                                   "labels":
                                       {
                                           "displayName": "Dish1 - mild",
                                           "description": "Dish1 - a mild spiciness version of our dish!",
                                           "languageCode": "en"
                                       },
                                   "attributes": {
                                       "price": {
                                           "currencyCode": "USD",
                                           "units": 20
                                       }
                                   }
                               }
                           ]
                       }
                   ]
               },
               {
                   "labels": {
                       "displayName": "Desserts",
                       "languageCode": "en"
                   },
                   "items": [
                       {
                           "labels": {
                               "displayName": "Ice Cream",
                               "description": "2 scoops of delicious ice cream!",
                               "languageCode": "en"
                           },
                           "attributes": {
                               "price": {
                                   "currencyCode": "USD",
                                   "units": 20
                               }
                           }
                       }
                   ]
               }
           ]
       }
   ]
}

將相片與食物項目建立關聯

如要將相片與餐點建立關聯,請先上傳相片至商家檔案位置。

如要擷取相片,請呼叫 accounts.locations.media.list。以下是要求範例:

GET
https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/media/

回應會包含清單中每張圖片的 MediaKey,如以下範例所示:

{
 "mediaItems": [
   {
     "name": "accounts/{accountId}/locations/{locationId}/media/{mediaKey}",
     "mediaFormat": "PHOTO",
     "locationAssociation": {
       "category": "FOOD_AND_MENU"
     },
 …
}

如要將相片與食物項目建立關聯,請取得相片的 mediaKey,並在 FoodMenuItemAttributes 物件中提供該值。您可以提供多個 mediaKeys。詳情請參閱「上傳或取代餐飲菜單」。