Integrate API for Restaurants Booking : Book A Table

Bookatable API for booking Restaurants

Book a table is a third-party api with soap request/response. That is basically used for restaurant booking. Before booking a restaurant, booking a table api is checking the availability of the restaurant by providing the time and session of the user. Book a table and provide all details of a restaurant with special offers.

There are the following steps for integrating with the complete restaurant booking process in cakePHP.

Book A Table API Integration:

For integrating Book a table api with php, create a class for WSDL request /response with Languages, Partner Code.

$SoapClient = new SoapClient("https://book.livebookings.net/webservices/external/service.asmx?WSDL", array("trace" => 1, "exception" => 0,
"Languages"=>”en-GB” ,"PartnerCode"=>”YOUR PARTNER CODE”,"CountryCode"=>"GBR"));

Listing of Restaurants:

For getting list of all restaurant bookatable provides getRestaurants api.

$requestObject = array(

"RegionCode " => “GBR”,

"MaximumResults " => “1000”


$SoapClient ->GetRestaurants($requestObject);

Getting Details

For Getting detailed information of a single restaurant bookatable provide GetRestaurantDetail.

$requestObject = array(

“Id” =>”BookTableId”


$SoapClient ->GetRestaurantDetail( $requestObject);

Restaurant Booking

Before booking any restaurant, book a table check the table availability of the table with the given details (number of people, date, time and session).

a) Search Availability

To check the table availability, we use Search Availability API.

$requestObject = array(

"SessionId" => Session,

"DiningDateAndTime" => DateTime,

"Size" => PartySize,

"RestaurantInternalIds" => BookTableID,

"ReturnPromotions" => true,


$SoapClient -> SearchAvailability( $requestObject);

Search availability api provides two types of responses one is called non – Promotions, and the second is Promotions.

Non – Promotions: – Non – Promotions are normal availability of a restaurant.

Promotions:- Restaurant availability with special offers. We get an available time by the given promotion id.

b) Prepare Book Reservation

Make a reservation for an available time returned by SearchAvailability and prepare by calling PrepareBookReservation. Before BookReservation, PrepareBookReservation should be called to validate that the selected time is still valid.

$prepareBookRequest = array(

"SessionId" => Session,

"DiningDateAndTime" => DateTime,

"Size" => (int) PartySize,

"RestaurantLocationId" => (int) BookTableID,

"CorrelationData" => cdata,


$SoapClient ->PrepareBookReservation( $prepareBookRequest);

If the User checks PrepareBookReservation for any promotional offers, then we pass PromotionId in the request array.

C) Book Reservation

Book reservation is the final step for booking any restaurant using the Book a table api. This is a request array that is used to book a restaurant.

$bookReservationRequest = array(

"SessionId" =>Session,

"DiningDateAndTime" =>DateTime,

"Size" => (int) PartySize,

"RestaurantLocationId" => (int) $ BookTableID,

"CorrelationData" => Date,

"Booker" => $booker,

"CancelLink" => "cancel-reservation",

"SuppressCustomerConfirmations" => false,

"SuppressRestaurantConfirmations" => true,

// "SpecialRequests"=> if restaurant allows special requests, seen when preparing booking, this can be added here

"GuestAcceptsEmailMarketingFromRestaurant" => false,


Array $booker is hold all information about the use likes as:

$booker = array(

"UserWithoutALogin" => array(

"FirstName" => “FirstName”,

"LastName" =>”LastName”,

"EMail" => “example@gmail.com”,

"MobilePhoneNumber" =>” MobilePhoneNumber”,

"Title" =>” Title”,



$SoapClient ->BookReservation ($bookReservationRequest);

After completing the booking, book a table and provide ReservationId, transaction_id and AllowedToCancelOnline.

D) Cancel Reservation

For cancelling any restaurant booking, we user the Cancel Reservation API.

$requestObject = array(

"ReservationId" => “ReservationId”

"SuppressCustomerConfirmations" => false,

"SuppressRestaurantConfirmations" => true,


$SoapClient ->CancelReservation($bookReservationRequest);

That’s all about a complete reservation system by bookatable API in cakePHP 3.0. Contact us if you want to implement a restaurant booking api in your application.

How to Execute Database Query in MongoDB

How to Execute Database Query in MongoDB

Get your Mobile App Development for Tourism

Get your Mobile App Development for Tourism


Memberships / Affiliations