BatchAvailabilityLookup örnekleri ve tanımları

İstek yapısı

BatchAvailabilityLookup istekleri, aynı satıcı için birden fazla hizmeti kapsayabilir ve istenen zaman aralıkları birden fazla kaynağı ve günü kapsayabilir. Entegrasyonunuzu basitleştirmek için satıcılar arasında tek bir hizmet kimliği kullanılmasını öneririz.

Yanıt süreleri

BatchAvailabilityLookup isteklerinde, yanıtın başarısız olarak kabul edilmesi için 1,5 saniyelik bir gecikme eşiği vardır. Altyapınıza ulaşan istekteki gecikmeyi en aza indirmek için dahili ağınızın ve DNS yönlendirmenizin senkronize edildiğinden emin olun. Önemli zaman aşımı hataları varsa bu hataları çözene kadar entegrasyonunuz devre dışı bırakılabilir.

İsteğe verilen her yanıtta, rezervasyon akışına girildiği zamanki değil, o anki envanterinizin gerçek durumu döndürülmelidir. Bir yer ayırtılmışsa bunu mevcut yanıtlara yansıt.

Tanımlar

BatchAvailabilityLookup yöntemi, rezervasyon akışı sırasında kullanıcılara yalnızca mevcut yerlerin sunulduğunu doğrular.

BatchAvailabilityLookup isteği

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 yanıtı

// 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

Hiçbir alan bulunamazsa boş bir yanıt döndürün. 400 hatası döndürmeyin. Bunun yerine 204 veya başka bir 2xx kodu döndürebilirsiniz. Yanıtın doğru şekilde alındığını doğrular.

message SlotTimeAvailability {
  // The SlotTime for which availability was checked.
  SlotTime slot_time = 1;

  // Whether the requested SlotTime is available
  bool available = 2;
}

BatchAvailabilityLookup örnekleri

Sayfa yükleme

Kullanıcı, rezervasyon akışını başlatmak için Online Rezervasyon'u tıkladığında satıcının bilinen uygunluk aralıklarıyla birlikte bir BatchAvailabilityLookup isteği gönderilir. Rezervasyon sunucunuz, istekte gönderilen her aralık için aralığın gerçek ve mevcut kullanılabilirliğini içeren bir yanıt döndürür. Kullanıcıya ön uçta yalnızca uygun zaman aralıkları gösterilir.

Bir kullanıcı parti boyutunu değiştirirse veya başka bir tarih seçerse başka bir sayfa yükleme isteği gönderilebilir.

Sayfa yükleme isteği

 {
    "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"
       }
    ]
 }

Sayfa yükleme yanıtı

 { "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" }
       }
    ]
 }

Slot tıklaması

Kullanıcı, rezerve edilebilir bir zaman aralığı seçtiğinde söz konusu zaman aralığı için bir BatchAvailabilityLookup isteği gönderilir. Rezervasyon sunucunuz, yuvanın gerçek ve mevcut müsaitlik durumuyla ilgili bir yanıt döndürür. Bu zaman aralığı başka bir Google kullanıcısı tarafından, sisteminizde dahili olarak veya sayfa yükleme ile zaman aralığı tıklama istekleri arasında rezerve edilmişse kullanılabilirlik için beklenen yanıt Yanlış'tır.

Slot tıklama isteği

 {
    "merchant_id" : "1234",
    "slot_time" : [
       {
          "duration_sec" : "1800",
          "resource_ids" : {
             "party_size" : 2
          },
          "service_id" : "1000",
          "start_sec" : "1606467600"
       }
    ]
 }

Slot tıklama yanıtı

 {
    "slot_time_availability" : [
       {
          "available" : true,
          "slot_time" : {
           "duration_sec" : "1800",
             "resource_ids" : {
                "party_size" : 2
             },
             "service_id" : "1000",
             "start_sec" : "1606467600"
          }
       }
    ]
 }