请求结构
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 点击响应
{
"slot_time_availability" : [
{
"available" : true,
"slot_time" : {
"duration_sec" : "1800",
"resource_ids" : {
"party_size" : 2
},
"service_id" : "1000",
"start_sec" : "1606467600"
}
}
]
}