フードメニューを更新する

リスティングにフードメニューを追加することで、メニューの内容や個々の料理を詳しく顧客に伝えることができます。

リスティングのフードメニューを更新するには、まず 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 など)。

料理の説明

省略可

料理の簡単な説明。

メニュー セクション

省略可

料理の抽象的カテゴリ(Breakfast や Hamburger-Fries combo. など)

栄養

省略可(推奨)

Total Fat=3g などの栄養情報。

対象人数

省略可

料理の対象人数。

数量

省略可

料理の数量。8-piece of nuggets など。

調理方法

省略可

料理の調理方法。

料理のジャンル

省略可(推奨)

料理のジャンル。

辛さ

省略可

none、mild、medium、hot といった料理の辛さ。

アレルゲン

省略可(推奨)

料理に含まれるアレルゲン(dairy、egg、fish、peanut、shellfish、soy、tree nut、wheat など)

食べ物の制限

省略可(推奨)

halal、kosher、organic、vegan、vegetarian、gluten 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 は、複数渡すことができます。詳しくは、フードメニューのアップロードまたは置き換えをご覧ください。