หากต้องการให้สินค้าคงคลังในร้านแก่ Merchant Center ก่อนอื่นคุณต้องระบุธุรกิจที่ Merchant Center จะรับผิดชอบ คุณดูรายชื่อกลุ่มสถานที่ตั้งธุรกิจที่เป็นไปได้ได้จาก Business Profile ผ่าน Content API แต่ต้องขอสิทธิ์เข้าถึง Business Profile ก่อน
ขอสิทธิ์เข้าถึง Business Profile
หากต้องการขอสิทธิ์เข้าถึง Business Profile ให้ใช้วิธีการ liasettings.requestgmbaccess
ดังนี้
POST https://shoppingcontent.googleapis.com/content/v2.1/12345/liasettings/67890/requestgmbaccess?gmbEmail=admin@example.com
ในตัวอย่างนี้ พารามิเตอร์การค้นหา gmbEmail
จะระบุอีเมลของผู้ดูแลระบบสําหรับ Business Profile
หลังจากที่คุณเรียกใช้เมธอดนี้ ผู้ดูแลระบบที่ระบุจะได้รับอีเมลเพื่อขอให้ยอมรับหรือปฏิเสธคำขอสิทธิ์เข้าถึง คำขอนี้จะหมดอายุภายใน 7 วันหากผู้ดูแลระบบไม่ดำเนินการใดๆ
ระบุกลุ่มสถานที่ตั้งธุรกิจที่ใช้ได้
เมื่ออนุญาตให้เข้าถึงแล้ว คุณจะดูได้ว่าธุรกิจใดบ้างที่พร้อมให้บริการโดยเรียกใช้เมธอด liasettings.getaccessiblegmbaccounts
ดังนี้
GET https://shoppingcontent.googleapis.com/content/v2.1/12345/liasettings/67890/accessiblegmbaccounts
Response:
200 OK
{
"kind": "content#liasettingsGetAccessibleGmbAccountsResponse",
"accountId": 67890,
"gmbAccounts": [{
"type" : "user",
"email" : "admin@example.com",
"name" : "admin@example.com",
"listingCount": 82
},
{
"type" : "business",
"email" : "california@example.com",
"name" : "Golden-State",
"listingCount" : 20
},
{
"type" : "business",
"email" : "florida@example.com",
"name" : "Sunshine-State",
"listingCount" : 15
},
{
"type" : "business",
"email" : "newyork@example.com",
"name" : "Empire-State",
"listingCount" : 25
}]
}
ระบุกลุ่มสถานที่ตั้งธุรกิจสำหรับบัญชี Merchant Center
เมื่อได้รายการกลุ่มสถานที่ตั้งธุรกิจที่เป็นไปได้แล้ว ก็ตั้งค่าช่อง googleMyBusinessLink
ในทรัพยากร Accounts
ที่เชื่อมโยงกับบัญชี Merchant Center เป็นบัญชีที่ต้องการ ตัวอย่างเช่น หาก Merchant
Center 67890 มีผลิตภัณฑ์สำหรับธุรกิจในแคลิฟอร์เนีย คุณจะใช้ Accounts.update
เพื่อตั้งค่าข้อมูลดังกล่าวได้
PUT https://shoppingcontent.googleapis.com/content/v2/12345/accounts/67890
{
"googleMyBusinessLink" : {
"gmbEmail": "california@example.com"
}
}
Response:
200 OK
{
"kind": "content#account",
"id": 67890,
"googleMyBusinessLink" : {
"gmbEmail": "california@example.com",
"status" : "active"
}
}
การตั้งค่าช่อง googleMyBusinessLink
ไม่จำเป็นต้องมีการยืนยันด้วยตนเอง ดังนั้นสถานะของลิงก์จะแสดงทันที
ส่งข้อมูลผลิตภัณฑ์และสินค้าคงคลัง
เมื่อ Merchant Center เชื่อมโยงกับกลุ่มสถานที่ตั้งธุรกิจแล้ว คุณจะระบุข้อมูลผลิตภัณฑ์ในร้านและสินค้าคงคลังของผลิตภัณฑ์ในร้านสำหรับธุรกิจเหล่านั้นได้
สำหรับขั้นตอนนี้ คุณจะใช้วิธีการเดียวกัน เช่น products.insert
ที่ใช้อัปโหลดผลิตภัณฑ์และข้อมูลสินค้าคงคลังออนไลน์
สำหรับ products.insert
คุณจะระบุช่องเป็น local
แทน online