ส่วนนี้จะอธิบายวิธีส่งการอัปเดตฟีดที่ขึ้นอยู่กับเวลาไปยัง Google Incremental Updates API ช่วยให้คุณอัปเดตและลบเอนทิตีในฟีดได้แบบเกือบเรียลไทม์
ฟังก์ชันการทำงานนี้มีไว้สำหรับข้อมูลอัปเดตที่คุณไม่สามารถคาดการณ์ได้เป็นหลัก เช่น การปิดร้านฉุกเฉิน โดยทั่วไปแล้ว การเปลี่ยนแปลงที่ส่งผ่าน Incremental Updates API ควรเป็นการเปลี่ยนแปลงที่เผยแพร่ภายในไม่เกิน 1 สัปดาห์ หากไม่ต้องการให้การเปลี่ยนแปลงมีผลทันที คุณสามารถใช้การอัปเดตแบบเป็นกลุ่มแทนได้ การอัปเดตแบบเพิ่มจะดำเนินการไม่เกิน 5 นาที
ตั้งค่า
หากต้องการใช้การอัปเดตแบบเพิ่ม ให้ทำดังนี้
- ทําตามขั้นตอนที่ระบุไว้ในส่วนสร้างและตั้งค่าโปรเจ็กต์เพื่อสร้างโปรเจ็กต์
- ทําตามขั้นตอนที่ระบุไว้ในตั้งค่าบัญชีบริการเพื่อสร้างบัญชีบริการ โปรดทราบว่าคุณต้องเป็น "เจ้าของ" ของโปรเจ็กต์จึงจะเพิ่มบทบาท "ผู้แก้ไข" ให้กับบัญชีบริการได้
- (ไม่บังคับแต่แนะนำ) ติดตั้งไลบรารีไคลเอ็นต์ Google ในภาษาที่ต้องการเพื่ออำนวยความสะดวกในการใช้ OAuth 2.0 เมื่อเรียกใช้ API ตัวอย่างโค้ดที่รวมไว้ด้านล่างใช้ไลบรารีเหล่านี้ มิเช่นนั้น คุณจะต้องจัดการการแลกเปลี่ยนโทเค็นด้วยตนเองตามที่อธิบายไว้ในการใช้ OAuth 2.0 เพื่อเข้าถึง Google API
ปลายทาง
หากต้องการแจ้งให้ Google ทราบเกี่ยวกับการอัปเดต ให้ส่งคำขอ HTTP POST ไปยัง Incremental Updates API และใส่เพย์โหลดของการอัปเดตและการเพิ่ม สคีมาพื้นที่โฆษณาที่คุณใช้จะเป็นตัวกำหนดปลายทางที่จะส่งคำขอ
พื้นที่โฆษณาเวอร์ชัน 2
https://actions.googleapis.com/v2/apps/PROJECT_ID/entities/TYPE/ENTITY_ID:push
พื้นที่โฆษณา v1
https://actions.googleapis.com/v2/apps/PROJECT_ID/entities/ENTITY_ID:push
หากต้องการนําเอนทิตีออก ให้ส่งคําขอ HTTP DELETE ไปยังปลายทางต่อไปนี้ซึ่งสอดคล้องกับสคีมาพื้นที่โฆษณาที่คุณใช้
พื้นที่โฆษณาเวอร์ชัน 2
https://actions.googleapis.com/v2/apps/PROJECT_ID/entities/TYPE/ENTITY_ID?entity.vertical=FOODORDERING&delete_time=DELETE_TIME
พื้นที่โฆษณา v1
https://actions.googleapis.com/v2/apps/PROJECT_ID/entities/ENTITY_ID?entity.vertical=FOODORDERING&delete_time=DELETE_TIME
ในคำขอข้างต้น ให้แทนที่ข้อมูลต่อไปนี้
- PROJECT_ID: รหัสโปรเจ็กต์ Google Cloud ที่เชื่อมโยงกับโปรเจ็กต์ที่คุณสร้างขึ้นในส่วนสร้างและตั้งค่าโปรเจ็กต์
- TYPE (สคีมาสินค้าคงคลัง v2 เท่านั้น): ประเภทเอนทิตี (พร็อพเพอร์ตี้
@type
) ของออบเจ็กต์ในฟีดข้อมูลที่ต้องการอัปเดต - ENTITY_ID: รหัสของเอนทิตีที่รวมอยู่ในเพย์โหลด อย่าลืมแปลงรหัส URL ของรหัสเอนทิตี
- DELETE_TIME (ปลายทางการลบเท่านั้น): ช่องที่ไม่บังคับเพื่อระบุเวลาที่ลบเอนทิตีในระบบ (ค่าเริ่มต้นคือเมื่อได้รับคําขอ) ค่าเวลาต้องไม่เป็นเวลาในอนาคต เมื่อส่งเอนทิตีผ่านคอลที่เพิ่มขึ้น การกำหนดเวอร์ชันเอนทิตีจะใช้ช่อง
delete_time
ในกรณีที่มีการเรียกใช้การลบด้วย จัดรูปแบบค่านี้เป็นyyyy-mm-ddTHH:mm:ssZ
ตัวอย่างเช่น คุณมีโปรเจ็กต์ที่มีรหัส "delivery-provider-id" ที่ใช้สคีมาพื้นที่โฆษณา v2 คุณต้องการทําการเปลี่ยนแปลงร้านอาหารที่มีประเภทเอนทิตีร้านอาหารเป็น "MenuSection" และรหัสเอนทิตีเป็น "menuSection_122" ปลายทางสำหรับการอัปเดตข้อมูลของคุณจะเป็นดังนี้
https://actions.googleapis.com/v2/apps/delivery-provider-id/entities/MenuSection/menuSection_122:push
หากต้องการนําเอนทิตีเดียวกันนี้ออก คุณจะต้องทําการเรียก HTTP DELETE API ดังนี้
https://actions.googleapis.com/v2/apps/delivery-provider-id/entities/MenuSection/menuSection_122?entity.vertical=FOODORDERING
คำขอแซนด์บ็อกซ์
สำหรับคำขอที่ใช้แซนด์บ็อกซ์ ให้ทำตามคำแนะนำในปลายทางด้านบน แต่ส่งคำขอไปยัง /v2/sandbox/apps/
แทน /v2/apps/
ตัวอย่างเช่น คำขอให้ลบแซนด์บ็อกซ์สำหรับสคีมาพื้นที่โฆษณา v2 มีโครงสร้างดังนี้
https://actions.googleapis.com/v2/sandbox/apps/PROJECT_ID/entities/TYPE/ENTITY_ID?entity.vertical=FOODORDERING&delete_time=DELETE_TIME
การอัปเดตและการเพิ่ม
ฟีดกลุ่มรายวันควรมีการเปลี่ยนแปลงที่ส่งผ่าน API นี้ด้วย มิเช่นนั้น การอัปเดตแบบเป็นกลุ่มจะเขียนทับการเปลี่ยนแปลงที่เพิ่มขึ้น
เพย์โหลด
คำขอ POST แต่ละรายการต้องมีพารามิเตอร์คำขอพร้อมกับเพย์โหลด JSON ที่มี Structured Data ของประเภทเอนทิตีที่แสดงอยู่ในสคีมาสินค้าคงคลัง
JSON ควรปรากฏเหมือนกันกับในฟีดกลุ่ม โดยมีความแตกต่างดังต่อไปนี้
- เนื้อหาของเพย์โหลดต้องมีขนาดไม่เกิน 5 MB ในทำนองเดียวกับฟีดกลุ่ม เราขอแนะนำให้คุณลบเว้นวรรคเพื่อใส่ข้อมูลได้มากขึ้น
- โดยที่โฟลเดอร์มีดังนี้
{ "entity": { "data":"ENTITY_DATA", "vertical":"FOODORDERING" }, "update_time":"UPDATE_TIMESTAMP" }
ในเพย์โหลดด้านบน ให้แทนที่ข้อมูลต่อไปนี้
- ENTITY_DATA: เอนทิตีในรูปแบบ JSON ที่แปลงเป็นสตริง ต้องส่งเอนทิตี JSON-LD เป็นสตริงในช่อง
data
- UPDATE_TIMESTAMP (ไม่บังคับ): การประทับเวลาเมื่อมีการอัปเดตเอนทิตีในระบบของคุณ ค่าเวลาต้องไม่เป็นเวลาในอนาคต การประทับเวลาเริ่มต้นคือเวลาที่ Google ได้รับคำขอ เมื่อส่งเอนทิตีผ่านคำขอแบบเพิ่ม การกำหนดเวอร์ชันเอนทิตีจะใช้ช่อง
update_time
ในกรณีที่มีคำขอเพิ่ม/อัปเดตด้วย
อัปเดตเอนทิตี
ตัวอย่างที่ 1: การอัปเดตร้านอาหาร
สมมติว่าคุณต้องอัปเดตหมายเลขโทรศัพท์ของร้านอาหารอย่างเร่งด่วน การอัปเดตของคุณมี JSON ของทั้งร้านอาหาร
ลองดูฟีดกลุ่มที่มีลักษณะดังต่อไปนี้
{ "@type": "Restaurant", "@id": "restaurant12345", "name": "Some Restaurant", "url": "https://www.provider.com/somerestaurant", "telephone": "+16501234567", "streetAddress": "345 Spear St", "addressLocality": "San Francisco", "addressRegion": "CA", "postalCode": "94105", "addressCountry": "US", "latitude": 37.472842, "longitude": -122.217144 }
จากนั้นการอัปเดตแบบเพิ่มทีละรายการด้วย HTTP POST จะมีลักษณะดังนี้
POST v2/apps/provider-project/entities/Restaurant/restaurant12345:push Host: actions.googleapis.com Content-Type: application/ld+json { "entity": { "data": { "@type": "Restaurant", "@id": "restaurant12345", "name": "Some Restaurant", "url": "https://www.provider.com/somerestaurant", "telephone": "+16501235555", "streetAddress": "345 Spear St", "addressLocality": "San Francisco", "addressRegion": "CA", "postalCode": "94105", "addressCountry": "US", "latitude": 37.472842, "longitude": -122.217144 }, "vertical": "FOODORDERING" } }
ตัวอย่างที่ 2: การอัปเดตราคาของรายการเมนู
สมมติว่าคุณต้องเปลี่ยนราคาของรายการในเมนู เช่นเดียวกับตัวอย่างที่ 1 การอัปเดตต้องมี JSON สำหรับเอนทิตีระดับบนสุดทั้งหมด (เมนู) และฟีดใช้สคีมาพื้นที่โฆษณา v1
ลองดูฟีดกลุ่มที่มีลักษณะดังต่อไปนี้
{ "@type": "MenuItemOffer", "@id": "menuitemoffer6680262", "sku": "offer-cola", "menuItemId": "menuitem896532", "price": 3.00, "priceCurrency": "USD" }
การอัปเดตที่เพิ่มขึ้นผ่าน POST จะมีลักษณะดังนี้
POST v2/apps/provider-project/entities/MenuItemOffer/menuitemoffer6680262:push Host: actions.googleapis.com Content-Type: application/ld+json { "entity": { "data": { "@type": "MenuItemOffer", "@id": "menuitemoffer6680262", "sku": "offer-cola", "menuItemId": "menuitem896532", "price": 1.00, "priceCurrency": "USD" }, "vertical": "FOODORDERING" } }
การเพิ่มเอนทิตี
หากต้องการเพิ่มเอนทิตี ให้หลีกเลี่ยงการใช้การอัปเดตสินค้าคงคลัง แต่ให้ใช้กระบวนการฟีดกลุ่มตามที่อธิบายไว้สำหรับสคีมาสินค้าคงคลัง v2 แทน
การนำเอนทิตีออก
หากต้องการนําเอนทิตีระดับบนสุดออก ให้ใช้ปลายทางที่แก้ไขเล็กน้อย และ HTTP DELETE แทน HTTP POST ในคําขอ
อย่าใช้ HTTP DELETE เพื่อนำเอนทิตีย่อยภายในเอนทิตีระดับบนสุดออก เช่น รายการเมนูภายในเมนู แต่ให้ถือว่าการนำเอนทิตีย่อยออกเป็นการอัปเดตเอนทิตีระดับบนสุดซึ่งนำเอนทิตีย่อยออกจากรายการหรือพารามิเตอร์ที่เกี่ยวข้อง
ตัวอย่างที่ 1: การลบเอนทิตีระดับบนสุด
ลองนึกถึงกรณีที่คุณต้องการลบร้านอาหารในฟีดที่ใช้สคีมาสินค้าคงคลัง v1 คุณต้องลบบริการและเมนูของช่องด้วย
ตัวอย่างปลายทางสำหรับเอนทิตีเมนูที่มีรหัส "https://www.provider.com/restaurant/menu/nr"
DELETE v2/apps/delivery-provider-id/entities/https%3A%2F%2Fwww.provider.com%2Frestaurant%2Fmenu%2Fnr?entity.vertical=FOODORDERING
Host: actions.googleapis.com
ตัวอย่างปลายทางสำหรับเอนทิตีร้านอาหารที่มีรหัส "https://www.provider.com/restaurant/nr"
DELETE v2/apps/delivery-provider-id/entities/https%3A%2F%2Fwww.provider.com%2Frestaurant%2Fnr?entity.vertical=FOODORDERING
Host: actions.googleapis.com
ตัวอย่างปลายทางสำหรับเอนทิตีบริการที่มีรหัส "https://www.provider.com/restaurant/service/nr"
DELETE v2/apps/delivery-provider-id/entities/https%3A%2F%2Fwww.provider.com%2Frestaurant%2Fservice%2Fnr?entity.vertical=FOODORDERING
Host: actions.googleapis.com
}
ตัวอย่างที่ 2: การนำเอนทิตีย่อยออก
หากต้องการนําเอนทิตีย่อยออกจากภายในเอนทิตีระดับบนสุด ให้ส่งเอนทิตีระดับบนสุดโดยนําเอนทิตีย่อยออกจากช่องที่เกี่ยวข้อง ตัวอย่างต่อไปนี้จะสมมติว่าฟีดใช้สคีมาสินค้าคงคลัง v1
เช่น หากต้องการนำพื้นที่ให้บริการออก ให้อัปเดตบริการที่มีการนำพื้นที่ให้บริการออกจากรายการ areaServed
POST v2/apps/delivery-provider-id/entities/https%3A%2F%2Fwww.provider.com%2Frestaurant%2Fservice%2Fnr:push
Host: actions.googleapis.com
Content-Type: application/ld+json
{
"entity": {
// Note: "data" is not serialized as a string in our example for readability.
"data": {
"@type": "Service",
"provider": {
"@type": "Restaurant",
"@id": "https://www.provider.com/restaurant/nr"
},
"areaServed": [
{
"@type": "GeoCircle",
"geoMidpoint": {
"@type": "GeoCoordinates",
"latitude": "42.362757",
"longitude": "-71.087109"
},
"geoRadius": "10000"
}
// area2 is removed.
]
...
},
"vertical": "FOODORDERING"
}
}
รหัสการตอบกลับของ API
การเรียกใช้ที่สำเร็จไม่ได้หมายความว่าฟีดถูกต้องหรือถูกต้อง เพียงแต่แสดงว่ามีการทำ API Call เท่านั้น การเรียกที่สำเร็จจะได้รับรหัสการตอบกลับ HTTP 200 พร้อมกับเนื้อหาการตอบกลับที่ว่างเปล่า
{}
หากดำเนินการไม่สำเร็จ โค้ดตอบกลับ HTTP จะไม่เท่ากับ 200 และเนื้อหาการตอบกลับจะระบุสิ่งที่ผิดพลาด
เช่น หากผู้ใช้ตั้งค่า "vertical" ในซองจดหมายเป็น FAKE_VERTICAL
คุณจะได้รับข้อความด้านล่างนี้
{
"error": {
"code": 400,
"message": "Invalid value at 'entity.vertical' (TYPE_ENUM), \"FAKE_VERTICAL\"",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "entity.vertical",
"description": "Invalid value at 'entity.vertical' (TYPE_ENUM), \"FAKE_VERTICAL\""
}
]
}
]
}
}
ตัวอย่างโค้ด
ด้านล่างนี้คือตัวอย่างวิธีใช้ Incremental Updates API ในภาษาต่างๆ ตัวอย่างเหล่านี้ใช้ไลบรารีการตรวจสอบสิทธิ์ของ Google และสมมติว่าฟีดใช้สคีมาพื้นที่โฆษณา v1 ดูวิธีแก้ปัญหาอื่นๆ ได้ที่การใช้ OAuth 2.0 สำหรับแอปพลิเคชันที่มีการโต้ตอบระหว่างเซิร์ฟเวอร์กับเซิร์ฟเวอร์
การอัปเดตเอนทิตี
Node.js
โค้ดนี้ใช้ไลบรารีการให้สิทธิ์ของ Google สําหรับ Node.js
const {auth} = require('google-auth-library') const request = require('request'); // The service account client secret file downloaded from the Google Cloud Console const serviceAccountJson = require('./service-account.json') // entity.json is a file that contains the entity data in json format const entity = require('./entity.json') const ENTITY_ID = 'restaurant/http://www.provider.com/somerestaurant' const PROJECT_ID = 'your-project-id' /** * Get the authorization token using a service account. */ async function getAuthToken() { let client = auth.fromJSON(serviceAccountJson) client.scopes = ['https://www.googleapis.com/auth/assistant'] const tokens = await client.authorize() return tokens.access_token; } /** * Send an incremental update to update or add an entity */ async function updateEntity(entityId, entity) { const token = await getAuthToken() request.post({ headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` }, url: `https://actions.googleapis.com/v2/apps/${PROJECT_ID}/entities/${encodeURIComponent(entityId)}:push`, body: { entity: { data: JSON.stringify(entity), vertical: 'FOODORDERING', } }, json: true }, (err, res, body) => { if (err) { return console.log(err); } console.log(`Response: ${JSON.stringify(res)}`) }) } updateEntity(ENTITY_ID, entity)
Python
โค้ดนี้ใช้ไลบรารีการให้สิทธิ์ของ Google สําหรับ Python
from google.oauth2 import service_account from google.auth.transport.requests import AuthorizedSession import json import urllib PROJECT_ID = 'your-project-id' ENTITY_ID = 'restaurant/http://www.provider.com/somerestaurant' ENDPOINT = 'https://actions.googleapis.com/v2/apps/%s/entities/%s:push' % ( PROJECT_ID, urllib.quote(ENTITY_ID, '')) # service-account.json is the service account client secret file downloaded from the # Google Cloud Console credentials = service_account.Credentials.from_service_account_file( 'service-account.json') scoped_credentials = credentials.with_scopes( ['https://www.googleapis.com/auth/assistant']) authed_session = AuthorizedSession(scoped_credentials) # Retrieving the entity update_file = open("entity.json") #JSON file containing entity data in json format. data = update_file.read() # Populating the entity with wrapper entity = {} entity['data'] = data #entity JSON-LD serialized as string entity['vertical'] = 'FOODORDERING' request = {} request['entity'] = entity response = authed_session.post(ENDPOINT, json=request) print(response.text) #if successful, will be '{}'
Java
โค้ดนี้ใช้ไลบรารีการให้สิทธิ์ของ Google สําหรับ Java
private static final String PROJECT_ID = "your-project-id"; private static final String ENTITY_ID = "http://www.provider.com/somerestaurant"; /** * Get the authorization token using a service account. */ private static String getAuthToken() { InputStream serviceAccountFile = Example.class.getClassLoader().getResourceAsStream("service-account.json"); ServiceAccountCredentials.Builder credentialsSimpleBuilder = ServiceAccountCredentials.fromStream(serviceAccountFile).toBuilder(); credentialsSimpleBuilder.setScopes(ImmutableList.of("https://www.googleapis.com/auth/assistant")); AccessToken accessToken = credentialsSimpleBuilder.build().refreshAccessToken(); return accessToken.getTokenValue(); } /** * Send an incremental update to update or add an entity. * @param entityId The id of the entity to update. * @param entity the json of the entity to be updated. */ public void updateEntity(String entityId, JSONObject entity) { String authToken = getAuthToken(); String endpoint = String.format( "https://actions.googleapis.com/v2/apps/%s/entities/%s:push", PROJECT_ID, URLEncoder.encode(entityId, "UTF-8")); JSONObject data = new JSONObject(); data.put("data", entity.toString()); data.put("vertical", "FOODORDERING"); JSONObject jsonBody = new JSONObject(); jsonBody.put("entity", data); // Execute POST request executePostRequest(endpoint, authToken, jsonBody); }
การนำเอนทิตีออก
Node.js
โค้ดนี้ใช้ไลบรารีการให้สิทธิ์ของ Google สําหรับ Node.js
const {auth} = require('google-auth-library') const request = require('request'); // The service account client secret file downloaded from the Google Cloud Console const serviceAccountJson = require('./service-account.json') // entity.json is a file that contains the entity data in json format const entity = require('./entity.json') const ENTITY_ID = 'restaurant/http://www.provider.com/somerestaurant' const PROJECT_ID = 'your-project-id' /** * Get the authorization token using a service account. */ async function getAuthToken() { let client = auth.fromJSON(serviceAccountJson) client.scopes = ['https://www.googleapis.com/auth/assistant'] const tokens = await client.authorize() return tokens.access_token; } /** * Send an incremental update to delete an entity */ async function deleteEntity(entityId) { const token = await getAuthToken() request.delete({ headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` }, url: `https://actions.googleapis.com/v2/apps/${PROJECT_ID}/entities/${encodeURIComponent(entityId)}?entity.vertical=FOODORDERING`, body: {}, json: true }, (err, res, body) => { if (err) { return console.log(err); } console.log(`Response: ${JSON.stringify(res)}`) }) } deleteEntity(ENTITY_ID)
Python
โค้ดนี้ใช้ไลบรารีการให้สิทธิ์ของ Google สำหรับ Python
from google.oauth2 import service_account from google.auth.transport.requests import AuthorizedSession import json import urllib # Service config PROJECT_ID = 'your-project-id' ENTITY_ID = 'restaurant/http://www.provider.com/somerestaurant' DELETE_TIME = '2018-04-07T14:30:00-07:00' ENDPOINT = 'https://actions.googleapis.com/v2/apps/%s/entities/%s?entity.vertical=FOODORDERING&delete_time=%s' % ( PROJECT_ID, urllib.quote(ENTITY_ID, ''), urllib.quote(DELETE_TIME, '')) # service-account.json is the service account client secret file downloaded from the # Google Cloud Console credentials = service_account.Credentials.from_service_account_file( 'service-account.json') scoped_credentials = credentials.with_scopes( ['https://www.googleapis.com/auth/assistant']) authed_session = AuthorizedSession(scoped_credentials) response = authed_session.delete(ENDPOINT) print(response.text) #if successful, will be '{}'
Java
โค้ดนี้ใช้ไลบรารีการให้สิทธิ์ของ Google สําหรับ Java
private static final String PROJECT_ID = "your-project-id"; private static final String ENTITY_ID = "restaurant/http://www.provider.com/somerestaurant"; /** * Get the authorization token using a service account. */ private static String getAuthToken() { InputStream serviceAccountFile = Example.class.getClassLoader().getResourceAsStream("service-account.json"); ServiceAccountCredentials.Builder credentialsSimpleBuilder = ServiceAccountCredentials.fromStream(serviceAccountFile).toBuilder(); credentialsSimpleBuilder.setScopes(ImmutableList.of("https://www.googleapis.com/auth/assistant")); AccessToken accessToken = credentialsSimpleBuilder.build().refreshAccessToken(); return accessToken.getTokenValue(); } /** * Send an incremental update to delete an entity. * @param entityId The id of the entity to delete. */ public void deleteEntity(String entityId) { String authToken = getAuthToken(); String endpoint = String.format( "https://actions.googleapis.com/v2/apps/%s/entities/%s?entity.vertical=FOODORDERING", PROJECT_ID, URLEncoder.encode(entityId, "UTF-8")); // Execute DELETE request System.out.println(executeDeleteRequest(endpoint, authToken)); }
กรณีการใช้งาน
ตัวอย่างกรณีการใช้งานต่อไปนี้เป็นการอัปเดตที่เพิ่มขึ้น การอัปเดตฟีดทั้งหมด และเนื้อหาในระดับสูงในการเรียก API
สถานการณ์ | เอนทิตีระดับบนสุด | คำอธิบายและผล |
---|---|---|
การปิดใช้บริการ | DisabledService |
คุณต้องปิดใช้บริการเนื่องจากเหตุผลที่ไม่คาดคิด การอัปเดตแบบเพิ่ม: ส่งเอนทิตี ฟีดแบบสมบูรณ์: โปรดอัปเดตเอนทิตีจากฟีดแบบสมบูรณ์เพื่อตั้งค่า |
สินค้าบางรายการหมด | Menu |
การอัปเดตแบบเพิ่ม: ส่งเอนทิตี Menu ที่รวมไว้โดยตั้งค่า offer.inventoryLevel เป็น 0 สำหรับ MenuItem ที่ระบุ และข้อมูลอื่นๆ ทั้งหมดไม่มีการเปลี่ยนแปลง |
การเปลี่ยนแปลงราคารายการในเมนู | Menu |
การอัปเดตเพิ่มเติม: ส่งเอนทิตี Menu ที่รวมไว้โดยตั้งค่า offer.price เป็นราคาที่อัปเดตแล้วสำหรับ MenuItem ที่ระบุ และข้อมูลอื่นๆ ทั้งหมดไม่มีการเปลี่ยนแปลง |
เพิ่มเอนทิตีระดับบนสุดใหม่ ใช้กับเอนทิตีประเภท |
Menu , Restaurant , Service |
เช่น คุณต้องเพิ่มเมนูใหม่ลงในร้านอาหาร การอัปเดตเพิ่มเติม: ส่งเอนทิตีเมนูใหม่พร้อมกับเอนทิตีร้านอาหารที่มีช่อง |
ลบเอนทิตีระดับบนสุดอย่างถาวร ใช้กับเอนทิตีประเภท |
Menu , Restaurant , Service |
การอัปเดตแบบเพิ่ม: ส่งการลบอย่างชัดแจ้ง ฟีดแบบสมบูรณ์: โปรดนำเอนทิตีออกจากฟีดแบบสมบูรณ์ก่อนการดึงข้อมูลครั้งถัดไปของ Google มิเช่นนั้นระบบจะเพิ่มเอนทิตีนั้นอีกครั้ง |
เพิ่มพื้นที่นำส่งใหม่ในService ที่เฉพาะเจาะจง |
Service |
ฟีดที่เพิ่มขึ้น: ส่งเอนทิตี Service ที่เป็นปัญหาโดยเก็บฟิลด์ทั้งหมดไว้เหมือนเดิม เช่นเดียวกับที่คุณทำในฟีดแบบสมบูรณ์ โดยมีพื้นที่โฆษณาใหม่ระบุไว้ภายใน areaServed ของ Service |
อัปเดตเวลาถึงโดยประมาณของการนำส่งใน Service |
Service |
ฟีดที่เพิ่มขึ้น: ส่ง Service เหมือนกับในฟีด ยกเว้น hoursAvailable.deliveryHours ที่จะอัปเดตตาม |
อัปเดตราคาการนำส่งใน Service |
Service |
ฟีดที่เพิ่มขึ้น: ส่ง Service แบบเต็มโดยอัปเดต offers.priceSpecification.price |
อัปเดตเวลานำส่งหรือเวลาให้บริการอาหารสำหรับซื้อกลับบ้านใน Service |
Service |
ฟีดที่เพิ่มขึ้น: ส่ง Service เหมือนกับในฟีด ยกเว้น hoursAvailable ที่จะอัปเดตตาม |
Service (เปลี่ยนจำนวนเงินขั้นต่ำในการสั่งซื้อ) |
Service |
ฟีดที่เพิ่มขึ้น: ส่ง Service แบบสมบูรณ์ที่มี Service.offers.priceSpecification.eligibleTransactionVolume อัปเดต |
ลบ MenuItem ถาวร |
Menu |
ฟีดที่เพิ่มขึ้น: ส่ง Menu เหมือนกับในฟีด แต่นำ MenuItem นี้ออกจากรายการ hasMenuItems |
SLO เกี่ยวกับเวลาในการประมวลผลสำหรับงานเป็นกลุ่มและการอัปเดตแบบเพิ่ม
ระบบจะประมวลผลเอนทิตีที่เพิ่มผ่านการอัปเดตแบบเป็นกลุ่มหรือแบบเพิ่มทีละรายการภายใน 1-2 วัน เอนทิตีที่อัปเดตหรือลบผ่านกลุ่มจะได้รับการประมวลผลภายใน 2 ชั่วโมง ส่วนเอนทิตีที่อัปเดตผ่านการอัปเดตแบบเพิ่มทีละรายการจะได้รับการประมวลผลภายใน 5 นาที ระบบจะลบเอนทิตีที่ล้าสมัยใน 7 วัน
คุณส่งข้อมูลต่อไปนี้ให้ Google ได้
- งานกลุ่มหลายรายการต่อวันเพื่อให้สินค้าคงคลังเป็นข้อมูลล่าสุด หรือ
- งานแบบเป็นกลุ่ม 1 งานต่อวันและ API แบบเพิ่มเพื่ออัปเดตสินค้าคงคลังให้เป็นปัจจุบันอยู่เสมอ