リクエストの構造
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"
}
}
]
}