เมื่อคุณเพิ่มเมนูอาหารลงในข้อมูล ลูกค้าจะทราบตัวเลือกเมนูของร้านอาหารและสามารถดูข้อมูลเพิ่มเติมเกี่ยวกับรายการในเมนูได้
หากต้องการอัปเดตเมนูอาหารของข้อมูล ให้เรียกใช้
accounts.locations.getFoodMenus ก่อน
ตัวอย่างคำขอมีดังนี้
GET
https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/foodMenus
การตอบกลับมีการแสดงผล JSON ของFoodMenusปัจจุบันของข้อมูล
แก้ไขFoodMenusออบเจ็กต์ตามต้องการ แล้วเรียกใช้
accounts.locations.updateFoodMenus
ดูข้อมูลเพิ่มเติมได้ที่อัปโหลดหรือแทนที่เมนูอาหาร
คุณใช้ Google My Business API เพื่ออัปเดตฟิลด์ต่อไปนี้ได้
| ช่อง | |
|---|---|
| ชื่อ | จำเป็น ชื่อของรายการอาหาร เช่น |
| ราคา | จำเป็น ราคาของรายการอาหาร |
| สกุลเงินของราคา | จำเป็น สกุลเงินของราคาอาหาร เช่น |
| คำอธิบายสินค้า | ไม่บังคับ คำอธิบายสั้นๆ เกี่ยวกับรายการอาหาร |
| ส่วนเมนู | ไม่บังคับ กลุ่มรายการอาหารที่มีตรรกะ เช่น |
| โภชนาการ | ไม่บังคับ (แนะนำ) ข้อมูลทางโภชนาการ เช่น |
| จำนวนผู้ที่ต้องให้บริการ | ไม่บังคับ จำนวนคนที่รับประทานอาหารได้ |
| ปริมาณอาหาร | ไม่บังคับ จำนวนรายการอาหาร เช่น
|
| วิธีการเตรียม | ไม่บังคับ วิธีการเฉพาะที่ใช้ในการเตรียมอาหาร |
| อาหารประจำชาติ | ไม่บังคับ (แนะนำ) ประเภทอาหารที่เฉพาะเจาะจงของรายการอาหาร |
| ความเผ็ด | ไม่บังคับ ความเผ็ดของรายการอาหาร เช่น |
| สารก่อภูมิแพ้ | ไม่บังคับ (แนะนำ) สารก่อภูมิแพ้อาหารในรายการอาหาร เช่น |
| อาหาร | ไม่บังคับ (แนะนำ) ข้อจำกัดด้านอาหารของรายการอาหาร เช่น |
| ตัวเลือก | ไม่บังคับ ประเภทตัวเลือกอาหาร เช่น |
| รูปภาพรายการอาหาร | ไม่บังคับ รูปภาพของรายการอาหารที่เฉพาะเจาะจง |
อัปโหลดหรือแทนที่เมนูอาหาร
สถานที่บางแห่งไม่มีสิทธิ์อัปโหลดเมนูอาหาร
หากต้องการตรวจสอบสิทธิ์ของสถานที่ ให้โทรไปที่
locations.get
เพื่อตรวจสอบ
Metadata
หากตั้งค่า canHaveFoodMenus เป็น true คุณจะมีสิทธิ์อัปโหลด
เมนูอาหาร
หากสถานที่ตั้งของคุณมีสิทธิ์ ให้โทรหา 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
}
}
}
]
}
]
}
]
}
เชื่อมโยงรูปภาพกับรายการอาหาร
หากต้องการเชื่อมโยงรูปภาพกับรายการอาหาร คุณต้องอัปโหลดรูปภาพไปยังสถานที่ตั้งของ Business Profile ก่อน
หากต้องการเรียกรูปภาพ ให้โทรหา
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 ได้หลายรายการ
ดูข้อมูลเพิ่มเติมได้ที่อัปโหลดหรือแทนที่เมนูอาหาร