我们的预订 API 为租借提供可选支持。如果启用了租借支持,则在创建预订时,首先需要为请求的空档创建租借。
// Temporary lease for an inventory slotmessageLease{// ID of the lease.// Not populated in CreateLeaseRequest. The value is chosen by the partner and// has to be returned in the response of CreateLease. (required)stringlease_id=1;// The appointment slot that the lease is created for. (required)Slotslot=2;// Unique identifier for this lease, chosen by Reserve with Google. Serves as// an idempotency token for [ext.maps.booking.partner.v2.CreateLease]// requests. (required)stringuser_reference=3;// Expiration time of the lease in UTC Timestamp (required)google.protobuf.Timestamplease_expiration_time=4;}// Reference to a [ext.maps.booking.partner.v2.Lease] that has been created via// [ext.maps.booking.partner.v2.CreateLease]messageLeaseReference{// Lease ID (required)stringlease_id=1;}
与租借相关的其他信息
您可以选择是否支持租借。它适用于有兴趣实现支持的合作伙伴。在开始之前,请与 Google 的 Action Center 联系,以确定您是否符合资格要求。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eA Lease is a temporary hold on a requested appointment slot, allowing users to secure it before booking.\u003c/p\u003e\n"],["\u003cp\u003eLease support is optional for partners using the booking API v2 and requires implementing CreateLease and CreateBooking methods.\u003c/p\u003e\n"],["\u003cp\u003eCreateBooking with a Lease reference consumes the Lease, making it invalid for other bookings; partners must verify the booking against the requested slot.\u003c/p\u003e\n"],["\u003cp\u003ePartners must obtain eligibility for Lease support through the Actions Center before implementation.\u003c/p\u003e\n"],["\u003cp\u003eLease functionality includes a unique Lease ID, user reference for idempotency, an associated Slot, and an expiration time.\u003c/p\u003e\n"]]],["A Lease temporarily holds a requested Slot's ownership. The partner's backend validates the slot, creates a temporary lease with an expiration time (`lease_expiration_time`), and returns the lease to the client. The `lease_expiration_time` can be modified by the backend. The booking API has optional lease support. `CreateLease` and `CreateBooking` methods are necessary when implementing it, with `CreateBooking` expected to use a lease reference that consumes the lease, rendering it invalid for further bookings.\n"],null,["# Lease specification\n\nA Lease temporarily holds the ownership of a requested Slot.\n\nThe partner's backend verifies that the requested appointment slot is valid and\nstill available. Internally, the partner creates a temporary hold for the\nrequested Slot, which is set up to expire automatically at\n`lease_expiration_time`. The backend is allowed to modify\n`lease_expiration_time`, e.g. if the requested lease time is excessively long.\nThe created lease is returned to the client.\n\nOur booking API provides optional support for Lease. With lease support,\ncreating a Lease for the requested Slot is the first step when creating a\nBooking. \n\n```scilab\n// Temporary lease for an inventory slot\nmessage Lease {\n // ID of the lease.\n // Not populated in CreateLeaseRequest. The value is chosen by the partner and\n // has to be returned in the response of CreateLease. (required)\n string lease_id = 1;\n\n // The appointment slot that the lease is created for. (required)\n Slot slot = 2;\n\n // Unique identifier for this lease, chosen by Reserve with Google. Serves as\n // an idempotency token for [ext.maps.booking.partner.v2.CreateLease]\n // requests. (required)\n string user_reference = 3;\n\n // Expiration time of the lease in UTC Timestamp (required)\n google.protobuf.Timestamp lease_expiration_time = 4;\n}\n\n// Reference to a [ext.maps.booking.partner.v2.Lease] that has been created via\n// [ext.maps.booking.partner.v2.CreateLease]\nmessage LeaseReference {\n // Lease ID (required)\n string lease_id = 1;\n}\n```\n\nAdditional information about leases\n-----------------------------------\n\nSupport for lease is **optional**. It applies to partners that are interested in\nimplementing the support. Please contact the Actions Center to determine\neligibility before you start.\n\nTo support lease, the recommended set of API v2 must be implemented; in\naddition,\n\n- [CreateLease](/actions-center/reference/grpc-api-v2/createlease-method) is required to be implemented.\n- [CreateBooking](/actions-center/reference/grpc-api-v2/createbooking-method) is required to be implemented and expected to use lease reference. Partner backend makes a booking with the provided lease reference.\n\nRequirements of API v2 also apply to support for lease; in addition,\n\n- [CreateBooking](/actions-center/reference/grpc-api-v2/createbooking-method) is expected to use lease reference. When making a booking with the provided lease reference, partner consumes the lease and renders it invalid for any further bookings. Partner is also responsible for verfiying the created booking using slot in the request message.\n- As an additional gRPC error code, NOT_FOUND is used if lease ref is provided and the lease ID is unknown to the partner.\n\nFigure: Create a Booking for a Lease"]]