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