BatchAvailabilityLookup-Beispiele und ‑Definitionen

Anfragestruktur

BatchAvailabilityLookup -Anfragen können sich auf mehrere Dienste für denselben Händler beziehen. Die angefragten Slots können sich auf mehrere Ressourcen und Tage erstrecken. Wir empfehlen, für alle Händler dieselbe Dienst-ID zu verwenden, um die Integration zu vereinfachen.

Antwortzeiten

Bei BatchAvailabilityLookup-Anfragen liegt der Latenzschwellenwert bei 1,5 Sekunden.Danach wird die Antwort als Fehler betrachtet. Achten Sie darauf, dass Ihre interne Netzwerk- und DNS-Weiterleitung synchronisiert sind, um Verzögerungen bei der Anfrage zu minimieren, die Ihre Infrastruktur erreicht. Wenn es zu erheblichen Zeitüberschreitungsfehlern kommt, wird Ihre Integration möglicherweise offline genommen, bis Sie die Fehler beheben können.

Jede Antwort auf eine Anfrage muss den tatsächlichen Status Ihres Inventars zu diesem Zeitpunkt zurückgeben und nicht den Status, als der Buchungsablauf gestartet wurde. Wenn ein Slot ausgebucht ist, muss dies in den aktuellen Antworten berücksichtigt werden.

Definitionen

Mit der Methode BatchAvailabilityLookup wird überprüft, dass Nutzern während des Reservierungsprozesses nur aktuelle Zeitblöcke präsentiert werden.

BatchAvailabilityLookup-Anfrage

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

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

Wenn keine Slots gefunden werden, geben Sie eine leere Antwort zurück. Geben Sie keinen 400-Fehler zurück, sondern stattdessen 204 oder einen anderen 2xx-Code. Dadurch wird überprüft, ob die Antwort korrekt empfangen wurde.

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

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

BatchAvailabilityLookup-Beispiele

Seitenaufbau

Wenn ein Nutzer auf Online buchen klickt, um den Buchungsablauf zu starten, wird eine BatchAvailabilityLookup-Anfrage mit den bekannten verfügbaren Slots für den Händler gesendet. Für jeden in der Anfrage gesendeten Zeitblock gibt Ihr Buchungsserver eine Antwort mit der tatsächlichen, aktuellen Verfügbarkeit des Zeitblocks zurück. Dem Nutzer werden im Frontend nur verfügbare Slots präsentiert.

Wenn ein Nutzer die Anzahl der Personen ändert oder ein anderes Datum auswählt, kann eine weitere Anfrage zum Seitenaufbau gesendet werden.

Anfrage zum Seitenaufbau

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

Antwort zum Seitenaufbau

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

Klick auf einen Slot

Wenn ein Nutzer einen buchbaren Slot auswählt, wird eine BatchAvailabilityLookup-Anfrage für den jeweiligen Slot gesendet. Ihr Buchungsserver gibt eine Antwort mit der tatsächlichen, aktuellen Verfügbarkeit des Slots zurück. Die erwartete Antwort für die Verfügbarkeit ist False , wenn dieser Zeitblock von einem anderen Google-Nutzer, intern in Ihrem System oder zwischen den Anfragen zum Seitenaufbau und zum Klicken auf den Zeitblock gebucht wurde.

Anfrage zum Klicken auf einen Slot

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

Antwort zum Klicken auf einen Slot

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