您將透過 Google Cloud 專案存取 Actions Center 的 Maps Booking API,並透過該 API 提交 RTU。您必須在 Google 開發人員控制台中使用 Google 帳戶,並在新手上路計畫的「設定」里程碑中提供 Cloud 專案編號。如要進一步瞭解如何啟用 Cloud API,請參閱「啟用 Cloud API」。
使用符合 REST 樣式的呼叫或下載用戶端程式庫
建議您使用 JSON 酬載直接對 Maps Booking API 執行
符合 REST 樣式的呼叫。詳情請參閱 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"]],["上次更新時間: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()"]]