commit | c9b6477ba4cd0985d4a3713633f67ea4efa9480b | [log] [tgz] |
---|---|---|
author | Christopher Cawdrey <ccawdrey@google.com> | Fri Jan 19 15:35:41 2018 -0800 |
committer | Christopher Cawdrey <ccawdrey@google.com> | Fri Jan 19 15:35:41 2018 -0800 |
tree | ca5edd6fc7be63e070d6a100f1e8b6df85afee77 |
Initial commit of java client example for maps booking api
Have your service account created, download your private key.
Download the Java client library , unzip the file to get the ‘mapsbooking’ package.
Create a java project in your IDE, download the sample codes (InventoryUpdate.java & BookingNotification.java), import them into your java project under src directory.
Make a copy of your private key (JSON file) to the src directory.
Add the Java Client Library to the dependencies of your project
In both java files, follow the TODOs to complete your implementations
More detail about the REST API can be found here.
Create a merchant/service with existing merchantId/serviceId, your will get following error message: 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” }
Update/Delete with wrong merchantId/serviceId (update with wrong bookingId), your will get following error message: 404 Not Found { “code” : 404, “errors” : [ { “domain” : “global”, “message” : “Requested entity was not found.”, “reason” : “notFound”, “debugInfo” : “detail: "[ORIGINAL ERROR] spanner::Row not found:..."\n” } ], “message” : “Requested entity was not found.”, “status” : “NOT_FOUND” }
In all update functions, the parameter ‘updateMask’ must be in 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.
Since an Availability Slot is not associated with a merchant_id/service_id, if you make the replace availability calls with invalid merchant_id/service_id, you will be able to make the REST call without any issue, but your request will not be served in the production due to the invalid merchant_id/service_id.
Any field that has a zero value is not shown in the response.