Phương thức CheckAvailability
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Bước đầu tiên khi tạo yêu cầu đặt chỗ là kiểm tra tình trạng còn chỗ của một khung giờ được yêu cầu. Phần phụ trợ của đối tác xác minh rằng khung giờ nhận đặt hẹn được yêu cầu là hợp lệ và có sẵn. Sau đó, ứng dụng khách yêu cầu tạo một lượt đặt trước cho khung giờ đó sau khi nhận được thông tin về tình trạng còn chỗ.
Yêu cầu
CheckAvailabilityRequest
Giá trị trả về
CheckAvailabilityResponse
Mã lỗi gRPC chuẩn
INVALID_ARGUMENT
(mã người bán, mã dịch vụ hoặc thông số kỹ thuật về thời gian của khung giờ không hợp lệ)
// Request to check availability for a [ext.maps.booking.partner.v2.Slot]
message CheckAvailabilityRequest {
// The appointment slot that is being checked (required)
Slot slot = 1;
}
// Response for the [ext.maps.booking.partner.v2.CheckAvailability] RPC with the
// availability of the appointment slot
message CheckAvailabilityResponse {
// The requested slot. (required)
Slot slot = 1;
// Number of available spots.
// 0 indicates that the appointment slot is not available. (required)
int32 count_available = 2;
// If set, the last time (in seconds since the Unix epoch) that this specific
// appointment slot can be cancelled through Reserve with Google. This field
// will override any service-level cancellation rules. (optional)
//
// Deprecated: Use scheduling_rule_overrides.last_online_cancellable_sec
// in the Availability feed instead.
int64 last_online_cancellable_sec = 5 [deprecated = true];
// This enum indicates what requirements exist for the user to acknowledge or
// view the requested slots duration/end time.
enum DurationRequirement {
// The handling of the end time is not specified. This is the default.
DURATION_REQUIREMENT_UNSPECIFIED = 0;
// The end time is not shown to the user.
DO_NOT_SHOW_DURATION = 1;
// The end time has to be shown to the user before an appointment can be
// made.
MUST_SHOW_DURATION = 2;
}
// The requirement to show the slots duration and/or endtime. This field will
// be ignored if the slot is unavailable. (optional)
//
// Deprecated: Use duration_requirement in the Availability feed instead.
DurationRequirement duration_requirement = 3 [deprecated = true];
// Optionally, the partner can return additional updated information about the
// availability for this merchant if this information is present when
// responding to the CheckAvailabilityRequest and if there is no negative
// impact on the CheckAvailability request latency.
// For instance an entire day of merchant availability for a superset of
// resources can be returned here.
AvailabilityUpdate availability_update = 4;
}
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003eBooking creation starts with checking the requested slot's availability via \u003ccode\u003eCheckAvailabilityRequest\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe partner's system validates the slot and responds with a \u003ccode\u003eCheckAvailabilityResponse\u003c/code\u003e indicating availability.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eCheckAvailabilityResponse\u003c/code\u003e includes details like available spots, slot details, and potential duration display requirements.\u003c/p\u003e\n"],["\u003cp\u003eIf available, the client proceeds to create a booking for the confirmed slot.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eINVALID_ARGUMENT\u003c/code\u003e error is returned for invalid inputs like merchant ID, service ID, or incorrect slot time.\u003c/p\u003e\n"]]],["The process starts by sending a `CheckAvailabilityRequest` to verify a requested appointment slot's validity and availability. The partner backend processes this request. The `CheckAvailabilityResponse` includes the requested `Slot` and `count_available`. A `count_available` of 0 means the slot is unavailable. The response may include optional information such as `last_online_cancellable_sec`, and `duration_requirement`. `AvailabilityUpdate` is for updated information for a superset of resources. `INVALID_ARGUMENT` error can occur.\n"],null,["# CheckAvailability method\n\nCheck availability for a requested slot is the first step when creating a\nbooking directly from a Slot. The partner backend verifies that the requested\nappointment slot is valid and available. Then the client requests to create a\nbooking for the slot after receiving availability information.\n\n**Request**\n\nCheckAvailabilityRequest\n\n**Return value**\n\nCheckAvailabilityResponse\n\n**Canonical gRPC error codes**\n\n- `INVALID_ARGUMENT` (invalid merchant ID, service ID, or slot time specification)\n\n```gdscript\n// Request to check availability for a [ext.maps.booking.partner.v2.Slot]\nmessage CheckAvailabilityRequest {\n // The appointment slot that is being checked (required)\n Slot slot = 1;\n}\n\n// Response for the [ext.maps.booking.partner.v2.CheckAvailability] RPC with the\n// availability of the appointment slot\nmessage CheckAvailabilityResponse {\n // The requested slot. (required)\n Slot slot = 1;\n\n // Number of available spots.\n // 0 indicates that the appointment slot is not available. (required)\n int32 count_available = 2;\n\n // If set, the last time (in seconds since the Unix epoch) that this specific\n // appointment slot can be cancelled through Reserve with Google. This field\n // will override any service-level cancellation rules. (optional)\n //\n // Deprecated: Use scheduling_rule_overrides.last_online_cancellable_sec\n // in the Availability feed instead.\n int64 last_online_cancellable_sec = 5 [deprecated = true];\n\n // This enum indicates what requirements exist for the user to acknowledge or\n // view the requested slots duration/end time.\n enum DurationRequirement {\n // The handling of the end time is not specified. This is the default.\n DURATION_REQUIREMENT_UNSPECIFIED = 0;\n\n // The end time is not shown to the user.\n DO_NOT_SHOW_DURATION = 1;\n\n // The end time has to be shown to the user before an appointment can be\n // made.\n MUST_SHOW_DURATION = 2;\n }\n\n // The requirement to show the slots duration and/or endtime. This field will\n // be ignored if the slot is unavailable. (optional)\n //\n // Deprecated: Use duration_requirement in the Availability feed instead.\n DurationRequirement duration_requirement = 3 [deprecated = true];\n\n // Optionally, the partner can return additional updated information about the\n // availability for this merchant if this information is present when\n // responding to the CheckAvailabilityRequest and if there is no negative\n // impact on the CheckAvailability request latency.\n // For instance an entire day of merchant availability for a superset of\n // resources can be returned here.\n AvailabilityUpdate availability_update = 4;\n}\n```"]]