מבנה הבקשה
בקשות BatchAvailabilityLookup יכולות לכלול כמה שירותים של אותו מוֹכר, והמשבצות שמתבקשות יכולות לכלול כמה משאבים וכמה ימים. מומלץ להשתמש במזהה שירות יחיד אצל כל המוכרים כדי לפשט את ההטמעה.
זמני תגובה
ל-BatchAvailabilityLookup בקשות יש סף זמן אחזור של 1.5 שניות לפני שהתשובה נחשבת ככישלון. כדי לצמצם את העיכובים בבקשה שמגיעה לתשתית שלכם, חשוב לוודא שהניתוב הפנימי ברשת והניתוב של DNS מסונכרנים. אם יש שגיאות משמעותיות של פסק זמן, יכול להיות שהשילוב שלכם יועבר למצב אופליין עד שתצליחו לפתור אותן.
כל תגובה לבקשה חייבת להחזיר את הסטטוס בפועל של מלאי שטחי הפרסום באותו רגע, ולא את הסטטוס שהיה כשנכנסתם לתהליך ההזמנה. אם משבצת זמן מוזמנת, צריך לשקף זאת בתשובות הנוכחיות.
הגדרות
השיטה BatchAvailabilityLookup מוודאת שרק משבצות זמן נוכחיות מוצגות למשתמשים במהלך תהליך ההזמנה.
בקשת BatchAvailabilityLookup
message BatchAvailabilityLookupRequest {
// ID of the merchant.
string merchant_id = 1;
// Multiple slot times to be checked for availability. All queried times apply
// to the same merchant_id and service_id.
repeated SlotTime slot_time = 3;
reserved 2;
}
תשובה של BatchAvailabilityLookup
// Response for the [ext.maps.booking.partner.v3.BatchAvailabilityLookupRequest]
// RPC with the availabilities of the appointment slots.
message BatchAvailabilityLookupResponse {
// The availabilities for the requested SlotTime entries. There must be
// exactly one slot_time_availability for each SlotTime entry in the
// [ext.maps.booking.partner.v3.BatchAvailabilityLookupRequest].
repeated SlotTimeAvailability slot_time_availability = 1;
}
SlotTime
// Identifies a Slot service_id and start time and optionally, the Slot duration
// and resources, for a specific merchant. Note that this differs from the
// definition of Slot, as it does not include merchant_id identifier.
message SlotTime {
// ID of the service. (required)
string service_id = 5;
// Start time of the appointment slot in seconds of UTC time since Unix epoch
// (required)
int64 start_sec = 1;
// Duration of the appointment slot in seconds (optional)
int64 duration_sec = 2;
// Opaque tag that identifies the availability slot and matches the value
// provided in the Availability Feed (optional)
string availability_tag = 3;
// The set of resources that specifies the appointment slot, e.g. by
// indicating the staff member and room selected by the user, or party size
// for dining slots (optional)
ResourceIds resource_ids = 4;
// Indicates whether bookings of this slot will be confirmed
// synchronously or asynchronously. (optional)
// An UNSPECIFIED value will be interpreted as synchronous.
ConfirmationMode confirmation_mode = 6;
}
SlotTimeAvailability
אם לא נמצאו משבצות, מחזירים תגובה ריקה. אל תחזירו שגיאה 400, אבל אתם יכולים להחזיר 204 או קוד אחר מסוג 2xx. הוא מאמת שהתגובה התקבלה בצורה נכונה.
message SlotTimeAvailability {
// The SlotTime for which availability was checked.
SlotTime slot_time = 1;
// Whether the requested SlotTime is available
bool available = 2;
}
דוגמאות ל-BatchAvailabilityLookup
טעינת דף
כשמשתמש לוחץ על הזמנה אונליין כדי להתחיל בתהליך ההזמנה, נשלחת בקשת BatchAvailabilityLookup עם משבצות זמינות ידועות של המוכר. לכל משבצת שנשלחת בבקשה, שרת ההזמנות מחזיר תגובה עם הזמינות הנוכחית של המשבצת. רק משבצות זמן פנויות מוצגות למשתמש בממשק הקצה.
אם המשתמש משנה את מספר הסועדים או בוחר תאריך אחר, אפשר לשלוח בקשה נוספת לטעינת הדף.
בקשה לטעינת דף
{
"merchant_id" : "1234",
"slot_time" : [
{
"duration_sec" : "1800",
"resource_ids" : {
"party_size" : 2
},
"service_id" : "1000",
"start_sec" : "1606467600"
},
{
"duration_sec" : "1800",
"resource_ids" : {
"party_size" : 2
},
"service_id" : "1000",
"start_sec" : "1606469400"
},
{
"duration_sec" : "1800",
"resource_ids" : {
"party_size" : 2
},
"service_id" : "1000",
"start_sec" : "1606471200"
}
]
}
תגובה לטעינת דף
{ "slot_time_availability" :
[
{
"available" : true,
"slot_time" : {
"duration_sec" : "1800",
"resource_ids" : {
"party_size" : 2 },
"service_id" : "1000",
"start_sec" : "1606467600" }
},
{
"available" : true,
"slot_time" : {
"duration_sec" : "1800",
"resource_ids" : {
"party_size" : 2 },
"service_id" : "1000",
"start_sec" : "1606469400" }
},
{
"available" : false,
"slot_time" : {
"duration_sec" : "1800",
"resource_ids" : {
"party_size" : 2 },
"service_id" : "1000",
"start_sec" : "1606471200" }
}
]
}
קליק על משבצת
כשמשתמש בוחר משבצת שאפשר להזמין, נשלחת בקשת BatchAvailabilityLookup לגבי המשבצת הספציפית. השרת של מערכת ההזמנות מחזיר תגובה עם הזמינות בפועל של המשבצת בזמן הנוכחי. התגובה הצפויה היא False לגבי הזמינות אם המשבצת הוזמנה על ידי משתמש אחר ב-Google, באופן פנימי במערכת שלכם או בין טעינת הדף לבין בקשות לחיצה על משבצת.
בקשת קליק על משבצת
{
"merchant_id" : "1234",
"slot_time" : [
{
"duration_sec" : "1800",
"resource_ids" : {
"party_size" : 2
},
"service_id" : "1000",
"start_sec" : "1606467600"
}
]
}
תגובה ללחיצה על משבצת
{
"slot_time_availability" : [
{
"available" : true,
"slot_time" : {
"duration_sec" : "1800",
"resource_ids" : {
"party_size" : 2
},
"service_id" : "1000",
"start_sec" : "1606467600"
}
}
]
}