Add Booking

Example on how to Add a Booking

Post Request data

Name Type Description
villa_id Integer Id of the Villas you want to retrieve info on.
first_name String First Name of the Guest.
last_name String Last name of the Guest.
email String Email of the Guest.
phone String Phone Number of the Guest.
arrival_date String Arrival Date.
departure_date String Departure Date.
num_adults String Number of Adults.
num_children String Number of Children.
message String Message from the Guest.

This sample code is written in PHP:


      $url = 'https://api.wthvillas.com/api/v1/addbooking';
      $data = array('villa_id' => "123");
      $data_string = $data;

      $curl = curl_init();
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($curl, CURLOPT_TIMEOUT, 30);
      curl_setopt($curl, CURLOPT_HTTPHEADER, array(
        'Authorization: Bearer YourTokenGoesHere'
      );
      curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
      curl_setopt($curl, CURLOPT_URL, $url);
      curl_setopt($curl, CURLOPT_POST,count($data));
      curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);

      $response = curl_exec($curl);

      curl_close($curl);
      $returnData = json_decode($response, true);
      print_r($returnData);
  

Response example data


      {
        "response": "success"
      }