เมื่อคุณเพิ่มเมนูอาหารลงในข้อมูล ลูกค้าจะทราบตัวเลือกเมนูของร้านอาหารและดูข้อมูลเพิ่มเติมเกี่ยวกับรายการในเมนูได้
หากต้องการอัปเดตเมนูอาหารของข้อมูล ให้เรียกใช้ 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
ได้หลายรายการ
ดูข้อมูลเพิ่มเติมได้ที่อัปโหลดหรือแทนที่เมนูอาหาร