بنية الطلب
يمكن أن تشمل طلبات 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
// 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"
}
}
]
}