Java Booking API क्लाइंट
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
रीयल टाइम अपडेट लागू करने के लिए, Java रीयल टाइम अपडेट एपीआई क्लाइंट डाउनलोड किया जा सकता है.
पूर्वापेक्षा:
अपना सेवा खाता बनाएं और निजी पासकोड डाउनलोड करें.
शुरू करें:
- Java क्लाइंट लाइब्रेरी डाउनलोड करें और 'mapsbooking' पैकेज पाने के लिए, फ़ाइल को अनज़िप करें.
-
अपने आईडीई में एक Java प्रोजेक्ट बनाएं. इसके बाद, इस रिपॉज़िटरी से सैंपल कोड InventoryUpdate.java और BookingNotification.java डाउनलोड करें:
git clone https://maps-booking.googlesource.com/java-maps-booking-api-example
और उन्हें src डायरेक्ट्री में अपने Java प्रोजेक्ट में इंपोर्ट करें.
- src डायरेक्ट्री में अपनी निजी कुंजी (JSON फ़ाइल) की कॉपी बनाएं.
- अपने प्रोजेक्ट की डिपेंडेंसी में Java क्लाइंट लाइब्रेरी जोड़ें
(mapsbooking और libs-sources डायरेक्ट्री में jar फ़ाइलें शामिल करें).
- दोनों Java फ़ाइलों में, लागू करने की प्रक्रिया पूरी करने के लिए, 'अभी नहीं' निर्देशों का पालन करें
REST API के बारे में ज़्यादा जानकारी यहां देखी जा सकती है.
समस्या निवारण:
-
किसी मौजूदा merchantId या
serviceId का इस्तेमाल करके नया व्यापारी/कंपनी/कारोबारी या सेवा बनाते समय, आपको गड़बड़ी का यह मैसेज दिखेगा:
409 Conflict
{
“code” : 409,
“errors” :
[{
“domain” : “global”,
“message” : “Requested entity already exists”,
“reason” : “alreadyExists”,
“debugInfo” : “detail: "[ORIGINAL ERROR] generic::already_exists: ...”\n"
}],
“message” : “Requested entity already exists”,
“status” : “ALREADY_EXISTS”
}
- अगर उपलब्धता की जानकारी बदलने के लिए, अमान्य merchantId या
ServiceId का इस्तेमाल किया जाता है, तो कॉल में गड़बड़ी का मैसेज नहीं दिखेगा. ऐसा इसलिए है, क्योंकि
आरटीयू के ज़रिए उपलब्धता स्लॉट में किए गए बदलाव, क्रम से लागू नहीं होते. इसलिए, ये बदलाव किसी merchantId या serviceId से नहीं जुड़े होते. हालांकि, अमान्य merchantId या serviceId की वजह से, अनुरोध में मौजूद स्लॉट, प्रोडक्शन में नहीं दिखाए जाएंगे. स्लॉट को दिखाने के लिए, कृपया आरटीयू या फ़ीड के ज़रिए,
जो व्यापारी/कंपनी/कारोबारी या सेवा मौजूद नहीं है उसे जोड़ें.
- अपडेट करने के सभी फ़ंक्शन में, पैरामीटर 'updateMask' को FieldMask फ़ॉर्मैट में होना चाहिए, ताकि अपडेट किए जाने वाले फ़ील्ड की जानकारी दी जा सके. एपीआई को सिर्फ़ मास्क में बताई गई वैल्यू बदलनी चाहिए और बाकी वैल्यू को बदलना नहीं चाहिए. अगर आपने गलत updateMask स्ट्रिंग दी है, तो अपडेट लागू नहीं होगा. अगर अपडेट करने के दौरान कोई फ़ील्ड मास्क मौजूद नहीं है, तो यह कार्रवाई सभी फ़ील्ड पर लागू होती है. ऐसा तब होता है, जब सभी फ़ील्ड के लिए कोई फ़ील्ड मास्क तय किया गया हो. इसलिए, अगर आपको सभी फ़ील्ड अपडेट करने हैं, तो updateMask को खाली सेट करें.
- जिस फ़ील्ड की वैल्यू शून्य है उसे रिस्पॉन्स में नहीं दिखाया जाता.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eDownload the Java real-time update API client and sample code to get started with implementing real-time updates for your booking services.\u003c/p\u003e\n"],["\u003cp\u003eYou will need a service account with a downloaded private key to use the client.\u003c/p\u003e\n"],["\u003cp\u003eThe client library allows you to manage inventory and booking notifications, and more details on the REST API are available in the documentation.\u003c/p\u003e\n"],["\u003cp\u003eTroubleshooting information is provided for common issues such as entity conflicts, invalid IDs, and update mask usage.\u003c/p\u003e\n"],["\u003cp\u003eRemember that zero-valued fields are not displayed in responses from the API.\u003c/p\u003e\n"]]],["Download the Java real-time update API client and library. Create a Java project, import the sample code files, `InventoryUpdate.java` and `BookingNotification.java`, and copy your private key to the `src` directory. Add the Java Client Library to your project dependencies. Follow the TODOs in the Java files to complete implementation. Be aware of 409 errors with existing IDs. Replace availability calls won't throw errors with invalid IDs. Ensure the 'updateMask' parameter is in FieldMask format in update functions.\n"],null,["# Java Booking API client\n\nYou can download our\n[Java real time update API client](https://maps-booking.googlesource.com/java-maps-booking-api-example/) to help get started implementing\nthe real time updates.\n\nPrerequisite:\n-------------\n\nHave your service account created, download your private key.\n\nGet started:\n------------\n\n1. Download the [Java client library](https://dl.google.com/mapsbooking/apiclients/v1alpha/mapsbooking_java_public.zip) unzip the file to get the 'mapsbooking' package.\n2. Create a java project in your IDE, download the sample codes\n [InventoryUpdate.java](https://maps-booking.googlesource.com/java-maps-booking-api-example/+/master/InventoryUpdate.java) and\n [BookingNotification.java](https://maps-booking.googlesource.com/java-maps-booking-api-example/+/master/BookingNotification.java) from this repo:\n\n ```java\n git clone https://maps-booking.googlesource.com/java-maps-booking-api-example\n ```\n\n and import them into your java project under src directory.\n3. Make a copy of your private key (JSON file) to the src directory.\n4. Add the Java Client Library to the dependencies of your project (include jar files under mapsbooking and libs-sources directory).\n5. In both java files, follow the TODOs to complete your implementations\n\nMore detail about the REST API can be\n[found here](/maps-booking/reference/maps-booking-api/rest).\n\nTroubleshooting:\n----------------\n\n1. When trying to create a new merchant/service with an existing merchantId or\n serviceId, you will get the following error message:\n\n ```java\n 409 Conflict\n {\n \"code\" : 409,\n \"errors\" :\n [{\n \"domain\" : \"global\",\n \"message\" : \"Requested entity already exists\",\n \"reason\" : \"alreadyExists\",\n \"debugInfo\" : \"detail: \"[ORIGINAL ERROR] generic::already_exists: ...\"\\n\"\n }],\n \"message\" : \"Requested entity already exists\",\n \"status\" : \"ALREADY_EXISTS\"\n }\n ```\n2. When making a replace availaiblity call with an invalid merchantId or serviceId, the call will **not** throw an error message. This is because changes to availability slots via RTUs support out-of-order execution and thus is not associated with a merchantId or serviceId. However, the slots in the request will not be served in the production due to the invalid merchantId or serviceId. To make the slots servable, please add the missing merchant or service via RTUs or feeds.\n3. In all update functions, the parameter 'updateMask' must be in [FieldMask](/protocol-buffers/docs/reference/google.protobuf#fieldmask) format to specify the fields to update. The API is required to only change the values of the fields as specified in the mask and leave the others untouched. If you pass the wrong updateMask string, the update will not take effect. If a field mask is not present on update, the operation applies to all fields (as if a field mask of all fields has been specified). So if you want to update all fields, just set the updateMask empty.\n4. Any field that has a zero value is not shown in the response."]]