Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Per completare l'attività CreateBooking Ready milestone, devi creare e distribuire correttamente il metodo CreateBooking. Questo metodo viene chiamato quando un utente
tenta di creare una prenotazione. Se viene creata una prenotazione riuscita, la risposta
include un booking_id univoco per fare riferimento alla prenotazione per richieste o
aggiornamenti futuri.
Requisiti dell'attività CreateBooking
10 risposte CreateBooking riuscite con un tasso di errore inferiore al 10%.
Nozioni di base su CreateBooking
Quando un utente avvia una prenotazione, viene inviata una richiesta CreateBooking al
server di prenotazione del partner. La risposta alla richiesta indica una
prenotazione riuscita o non riuscita. Se si verifica un errore di prenotazione, la
risposta deve includere l'errore di logica di business. Ad esempio, lo
slot non è più disponibile o è già stato prenotato dallo stesso
utente.
Quando un utente crea una prenotazione, Google ti invia il nome, il cognome,
il numero di telefono e l'indirizzo email dell'utente. Per ulteriori informazioni, consulta le
norme sulla corrispondenza e la creazione degli account.
Idempotenza
La comunicazione sulla rete non è sempre affidabile e Google può riprovare a inviare richieste HTTP se non riceve risposta. Per questo motivo, tutti i metodi che modificano
lo stato devono essere idempotenti:
CreateBooking
UpdateBooking
Per ogni messaggio di richiesta, ad eccezione di UpdateBooking, vengono inclusi token di idempotenza per identificare in modo univoco la richiesta. In questo modo puoi distinguere tra un
tentativo di chiamata REST, con l'intenzione di creare una singola richiesta e due richieste
separate. I rispettivi ID voce di prenotazione di UpdateBooking aiutano a
identificarli in modo univoco, quindi nelle richieste non è incluso alcun token di idempotenza.
Di seguito sono riportati alcuni esempi di come i server di prenotazione gestiscono l'idempotenza:
Una risposta HTTP
CreateBooking
riuscita include la prenotazione creata. In alcuni casi, il pagamento viene elaborato
nell'ambito del flusso di prenotazione. Se lo stesso CreateBookingRequest viene ricevuto una
seconda volta con lo stesso idempotency_token, deve essere restituito lo stesso CreateBookingResponse. Non viene creata una seconda prenotazione e
all'utente viene addebitato l'importo esattamente una volta, se applicabile.
Il requisito di idempotenza si applica a tutti i metodi che modificano lo stato.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-07-26 UTC."],[],[],null,["# CreateBooking Ready\n\nTo complete the `CreateBooking` Ready milestone task, you need to successfully\nbuild and deliver the `CreateBooking` method. This method is called when a user\nattempts to create a booking. If a successful booking is created, the response\nincludes a unique `booking_id` to refer to the booking for future requests or\nupdates.\n\nCreateBooking task requirements\n-------------------------------\n\n- 10 successful `CreateBooking` responses with an error rate less than 10%.\n\nCreateBooking basics\n--------------------\n\nWhen a user initiates a booking, a `CreateBooking` request is sent to the\npartner Booking Server. The response to the request indicates either a\nsuccessful booking or booking failure. If there is a booking failure, the\nresponse needs to include the business logic error for failure. For example, the\nslot has become unavailable or the slot has been already booked by the same\nuser.\n\nWhen a user creates a booking, Google sends you the user's given name, surname,\nphone number, and email. For more information, see\n[Account matching and creation policy](/actions-center/verticals/reservations/e2e/policies/platform-policies#account_matching_and_creation_policy).\n| **Note:** Business logic errors must be returned in the `CreateBookingResponse.booking_failure` field, rather than through a non-200 HTTP response code.\n| **Warning:** Booking failures because of the unavailability of the slot are considered `CreateBooking` errors. Your integration can be disabled when there are many `CreateBooking` errors. High error rate for `CreateBooking` availability errors indicate that your `BatchAvailabilityLookup` slot click response doesn't accurately reflect real-time inventory.\n\n### Idempotency\n\nCommunication over the network isn't always reliable, and Google can retry HTTP\nrequests if no response is received. For this reason, all methods that mutate\nstate must be idempotent:\n\n- `CreateBooking`\n- `UpdateBooking`\n\nFor every request message, except `UpdateBooking`, idempotency tokens are\nincluded to uniquely identify the request. This lets you distinguish between a\nretried REST call, with the intent to create a single request and two separate\nrequests. The respective booking entry IDs of the `UpdateBooking` help to\nuniquely identify them, so no idempotency token is included in their requests.\n\nThe following are some examples of how Booking Servers handle idempotency:\n\n- A successful\n [`CreateBooking`](/actions-center/verticals/reservations/e2e/reference/booking-server-api-rest/e2e-methods/createbooking-method)\n HTTP response includes the created booking. In some cases, payment is processed\n as part of the booking flow. If the same `CreateBookingRequest` is received a\n second time with the same `idempotency_token`, the same `CreateBookingResponse`\n must be returned. A second booking isn't created, and\n the user is charged exactly once, if applicable.\n\n | **Note:** If a `CreateBooking` attempt fails and the same request is re-sent, your backend must retry the `CreateBooking` request.\n\nThe idempotency requirement applies to all methods that mutate state."]]