更新食品菜单

您将食品菜单添加到自己的商家信息后,客户就能知道您餐厅供应的菜品,还可以获得有关菜品的更多信息。

如需更新商家信息中的“食品菜单”,请先调用 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

菜品说明

选填

菜品的简要说明。

菜单部分

选填

菜品的逻辑群组,例如 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。如需了解详情,请参阅上传或更换食品菜单