您的 Google Cloud 项目就是您访问 Actions Center 的 Maps Booking API 的方式,您可以通过该 API 提交 RTU。您必须在 Google 开发者控制台中使用 Google 账号,并在您的初始配置计划的“设置”里程碑中提供您的 Cloud 项目编号。如需详细了解如何启用 Cloud API,请参阅启用 Cloud API。
使用 RESTful 调用或者下载客户端库
我们建议您使用 JSON 载荷直接对 Maps Booking API 进行 RESTful 调用。如需了解详情,请参阅 REST API 文档。
// This block of code is for OAuth and is the same for prod and sandbox.GoogleCredential.fromStream(newFileInputStream(...)).createScoped(Collections.singleton("https://www.googleapis.com/auth/mapsbooking"))// This block of code sets the endpoint. This is what you'd change to connect to the sandbox.newGoogleMapsBookingAPI.Builder(...).setApplicationName(...).setRootUrl("https://partnerdev-mapsbooking.googleapis.com/")// you add this to change the endpoint to use partnerdev..build()
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-26。"],[],[],null,["# Real-Time Updates Ready\n\nInventory in your system changes because of new bookings, cancelations, and\nschedule changes from your merchants. The Real-Time Update (RTU) API is a\nmechanism to notify Google about these changes, and the changes made to existing\nbookings.\n\nRTUs are required in the following cases:\n\n- When a user cancels a reservation on your system, and the slot becomes available.\n- When a user books a reservation through the Actions Center, and the slot is no longer available.\n- When a reservation made through the Actions Center is canceled on your side. An example situation includes a cancelation by the merchant directly. You need to update the booking and the availability, because the original slot is now available.\n\nComplete the following RTU milestone task before you move to Sandbox review:\n\n- [BookingNotification Ready](/actions-center/verticals/reservations/e2e/integration-steps/real-time-updates-ready/booking-notification)\n\nEach task is marked completed and turns green when the last 20 requests have no\nerrors for a period of 14 days. Continue to send successful requests to ensure\nthat the milestone remains green.\n\nAPI RTU and Feeds\n-----------------\n\nAPI RTUs notify Google about incremental changes to inventory availability and\nbookings in real-time. In addition to RTUs, send complete Availability Feeds\ndaily. This ensures that Google has the most accurate and latest availability\ninformation as it exists in your system. Complete Feeds act as a snapshot of the\nlatest state of inventory availability in your system.\n\nFor more information, see the following resources:\n\n- [Structure RTUs](/actions-center/verticals/reservations/e2e/reference/real-time-updates-rest/rtu)\n\n- [Java client example for RTUs using RESTful calls](https://maps-booking.googlesource.com/java-maps-booking-api-example/)\n\n- [Inventory update API](/maps-booking/reference/maps-booking-api/rpc#google.maps.booking.v1alpha.inventoryupdate)\n\nAccess the API\n--------------\n\nYour [Google Cloud](https://cloud.google.com/) project is how you access the\nActions Center's Maps Booking API, which is how you submit RTUs.\nYou must use a Google Account within the\n[Google Developers console](https://console.developers.google.com/) and provide\nyour Cloud Project Number in the Setup milestone of your onboarding plan. For\nmore information on how to enable Cloud APIs, see\n[Enable CloudAPIs](/actions-center/verticals/reservations/e2e/integration-steps/setup).\n\n### Use RESTful calls or download the client library\n\nWe recommend that you make RESTful calls directly to the Maps Booking API with\nJSON payloads. For more information, see [REST API documentation](/maps-booking/reference/maps-booking-api/rest).\n\nYou can also use client libraries to connect to the API.\n\n| Language | Download link |\n|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Java | [Java client library](https://dl.google.com/mapsbooking/apiclients/v1alpha/mapsbooking_java_public.zip). For more information, see [Java client instructions](/actions-center/verticals/reservations/e2e/reference/real-time-updates-rest/java-rest) |\n\nAdditional [support libraries](/api-client-library)\nthat handle authorization and other aspects of calls to Google APIs are\navailable to download. For more information, see [Code Samples](/actions-center/verticals/reservations/e2e/reference/real-time-updates-rest/code-samples).\n\n### Fetch the Discovery document\n\nFor some client libraries, such as Ruby, it's necessary to fetch the Discovery\ndocument for the API that describes its methods and parameters.\n\nTo fetch the Discovery document, use the following command:\n\n`curl -s -o mapsbooking_rest`\n\n`https://mapsbooking.googleapis.com/$discovery/rest?version=v1alpha`\n\nFor more information on how to access the API from Ruby, see\n[Ruby API Client](https://github.com/google/google-api-ruby-client) and\n[Ruby Auth Library](https://github.com/google/google-auth-library-ruby).\n\n### Make authorized calls to the API\n\nWhen you make calls to the API, refer to [Preparing to make a delegated API call](/identity/protocols/OAuth2ServiceAccount#authorizingrequests)\nto authorize your service account with your private key and the following OAuth\nscope:\n\n`https://www.googleapis.com/auth/mapsbooking`\n\nSandbox and Production endpoints\n--------------------------------\n\nYou can make calls to both the Sandbox and Production environments through the\nAPI. Make sure that you enable both APIs in your Google Cloud project. Both APIs\nuse the same scope, but they have different endpoints.\n\n**Production endpoint** : `https://mapsbooking.googleapis.com/`\n\n**Sandbox endpoint** : `https://partnerdev-mapsbooking.googleapis.com/`\n\nThe following is an example in Java of how to switch endpoints: \n\n // This block of code is for OAuth and is the same for prod and sandbox.\n GoogleCredential\n .fromStream(new FileInputStream(...))\n .createScoped(Collections.singleton(\"https://www.googleapis.com/auth/mapsbooking\"))\n\n // This block of code sets the endpoint. This is what you'd change to connect to the sandbox.\n new GoogleMapsBookingAPI.Builder(...)\n .setApplicationName(...)\n .setRootUrl(\"https://partnerdev-mapsbooking.googleapis.com/\") // you add this to change the endpoint to use partnerdev.\n .build()"]]