Timeout Handling
Keep it synchronized
We recommend implementing a timeout duration of 60 seconds due to dependencies on external supplier systems that are beyond our direct control. While most booking requests are processed promptly, there are rare instances where response times may exceed this duration.
It is important to note that even if the Confirm Booking endpoint encounters a timeout or returns an HTTP 500 error, the booking may still be successfully created. To ensure system resilience and maintain consistency, we strongly recommend implementing the following methods.
Idempotency
The Prio API supports idempotency, allowing multiple retries of the same request while ensuring the action is performed only once.
This mechanism prevents duplicate bookings in case of failures or retries.
Idempotency is supported for POST requests, whereas GET, DELETE, and PUT requests are inherently idempotent.
Webhooks for Asynchronous Order Confirmation
The Distributor API supports webhooks to track state changes efficiently.
Subscribers receive notifications whenever there is a change in order status.
While the booking status remains uncertain, the order is marked as "PROCESSING."
Webhooks serve as a reliable means of reconciling the booking state. In the event of a timeout, they provide updates once the order has been successfully processed or failed.
If no webhook notification is received, it is likely that the request was not received or processed successfully. In such cases, we recommend contacting our API support team for further investigation.
Alternative Poll-Based Solution
If webhooks or idempotency cannot be implemented, an alternative poll-based approach can be used to reconcile the booking state. This involves making periodic requests to the GET Order Details endpoint at fixed intervals until a final order state (such as confirmed or failed) is received.
Recommended Polling Strategy:
Perform 1 call per minute for the first 5 minutes (5 calls in total).
If no response is received, continue polling once every 15 minutes for the next hour (4 additional calls).
If no final status is received after this period, abandon further attempts.
Ensuring Booking Consistency
To fully prevent duplicate bookings, we recommend implementing a combination of these methods. The use of idempotency tokens, webhooks, and polling mechanisms will significantly enhance the reliability and consistency of the booking process.
For further assistance or troubleshooting, please reach out to our API support team.
Last updated
Was this helpful?