BatchAvailabilityLookup のサンプルと定義

リクエストの構造

BatchAvailabilityLookup リクエストは、同じ販売者の複数のサービスにまたがることができ、リクエストされたスロットは複数のリソースと複数の日にまたがることができます。統合を簡素化するため、販売者間で単一のサービス ID を使用することをおすすめします。

回答までの時間

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 リクエストが送信されます。予約サーバーは、スロットの実際の現在の空き状況を含むレスポンスを返します。そのスロットが別の Google ユーザーによって予約されている場合、システム内で予約されている場合、またはページの読み込みとスロットのクリック リクエストの間で予約されている場合、想定されるレスポンスは可用性に対して False です。

スロットのクリック リクエスト

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