Strategies for Managing API Calls and Booking Logic in Xano

The State Changers in this meeting covered the challenge of handling API post requests in certain scenarios, with Xano being the main tool used. One member, James, was tasked with creating a booking system, in which he needed to check the availability of a booking before making a post call to avoid double bookings. It was established that the problem was logical, not data-centric.


Firstly, it was suggested to James to pull the availability before booking through an API endpoint and return an error if the resource is already booked. Additionally, a post request should be made for the user wishing to join a waitlist if the initial booking failed due to unavailable resources. In the Xano system, before adding a record, the first step should be to get the availability record. The API endpoint's main purpose should be clarified, for instance, whether it's creating bookings or availabilities. If a booking is being made, a property's availability check should occur before the booking record is added. For managing waitlists in the booking system, it was suggested to create a separate endpoint which performs a reverse check - only adding to the waitlist if the resource is already booked. Also, it was suggested to create a table for the waitlist. In case a booking gets cancelled, the next person on the waitlist would get that availability. The meeting concluded with mentioning that although Xano automatically creates single-line actions, the user is not constrained to them and could add logic before and after these lines to tailor the actions according to the specific requirements.


(Source: Office Hours 10/31 )

State Change Members Can View The Video Here
chris-montgomery-smgTvepind4-unsplash.jpg

View This Video Now

Join State Change Risk-Free