تعديل قوائم الطعام

عند إضافة قوائم الطعام إلى بيانات نشاطك التجاري، يتعرّف العملاء على خيارات قائمة الطعام في مطعمك وي يمكنهم الحصول على معلومات إضافية عن أصناف القائمة.

لتعديل قوائم الطعام الخاصة بأحد البيانات، اتصل أولاً بالرقم accounts.locations.getFoodMenus. في ما يلي مثال على طلب:

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

يحتوي الردّ على تمثيل JSON للقيمة الراهنة لملف التعريف FoodMenus. عدِّل عنصر FoodMenus حسب الحاجة واتصل بـ accounts.locations.updateFoodMenus. لمزيد من المعلومات، يُرجى الاطّلاع على مقالة تحميل قوائم الطعام أو استبدالها.

يمكنك استخدام واجهة برمجة التطبيقات "نشاطي التجاري على Google" لتعديل الحقول التالية:

الحقول
الاسم

مطلوب

اسم الطعام، مثل 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 Pad Thai مقابل veggie Pad Thai

صورة صنف الطعام

اختياريّ

صورة لطعام معيّن

تحميل قوائم الطعام أو استبدالها

ليست كل المواقع الجغرافية مؤهّلة لتحميل قوائم الطعام.

لتحديد أهلية موقع جغرافي، يُرجى الاتصال برقم locations.get للتحقّق من Metadata. إذا تم ضبط canHaveFoodMenus على true، يعني ذلك أنّك مؤهَّل لتحميل ملف canHaveFoodMenus.

إذا كان موقعك الجغرافي مؤهلاً، يمكنك إجراء مكالمة PATCH إلى accounts.locations.updateFoodMenus.

في ما يلي مثال على طلب يتضمّن جميع الحقول الاختيارية:

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 متعددة. لمزيد من المعلومات، يُرجى الاطّلاع على مقالة تحميل قوائم الطعام أو استبدالها.