home > support > API > Marketplace API > hotel search > by specific date
Create a hotel/chalet/villa search results page based on availability for specific dates
Extends the standard Tour Search Method to allow searching for hotels available to be booked for a specific date for a specific duration (and optionally a specific number of people). Includes a list of rooms alongside each Hotel.
You can append the following to the book link (returned in the XML):
Further informtion about linking to the booking engine with default values
Endpoint | /p/hotels/search_avail /c/hotels/search_avail |
Formats | XML |
Example | /p/hotels/search_avail.xml?startdate_yyyymmdd=2011-07-16&hdur=7 |
Verb | GET |
PHP examples use the PHP Client Library with SimpleXML
object search_hotels_specific([string $params="" [,string $tour="" [,int $channel=0]]])
// Define channel
$channel = 3;
// Define the Tour IDs
// Passing an empty string to search all
$tour = "";
// Define search parameters (2 adults, 2 children, 1st July 2011 for 7 nights)
$parameters = "startdate_yyyymmdd=2011-07-01&hdur=7&ad=2&ch=0";
// Query the TourCMS API
$result = $tourcms->search_hotels_specific($parameters, $tour, $channel);
// Loop through each Hotel and output the name
foreach($result->tour as $hotel) {
print $hotel->tour_name.'<br />';
}
The Hilton
Travel Lodge
C# examples use the .Net Client Library
XmlDocument SearchHotelsBySpecific ()
XmlDocument SearchHotelsBySpecific (string queryString)
XmlDocument SearchHotelsBySpecific (string queryString, string tour)
XmlDocument SearchHotelsBySpecific (string queryString, string tour, int channelId)
// Set the Channel ID
// For Suppliers this can be found in the API settings page
// For Partners this can be a specific Channel or 0 to search all
int channelId = 0;
// Define the Tour IDs
// Passing an empty string to search all
string tour = "";
// Define search parameters (2 adults, 2 children, 1st July 2011 for 7 nights)
string queryString = "startdate_yyyymmdd=2011-07-01&hdur=7&ad=2&ch=0";
// Call the API
XmlDocument doc = myTourCMS.SearchHotelsByRange(queryString, tour, channelId);
// Loop through each Hotel and output the name
XmlNodeList tourList = doc.GetElementsByTagName("tour");
foreach (XmlNode tour in tourList)
{
string tourName = tour.SelectSingleNode("tour_name").InnerText;
Console.WriteLine(tourName);
}
The Hilton
Travel Lodge
VB examples use the .Net Client Library
XmlDocument SearchHotelsBySpecific ()
XmlDocument SearchHotelsBySpecific (string queryString)
XmlDocument SearchHotelsBySpecific (string queryString, string tour)
XmlDocument SearchHotelsBySpecific (string queryString, string tour, int channelId)
' Set the Channel ID
' For Suppliers this can be found in the API settings page
' For Partners this can be a specific Channel or 0 to search all
Dim channelId As Integer = 0
' Define the Tour IDs
' Passing an empty string to search all
Dim tour As String = ""
' Define search parameters (2 adults, 2 children, 1st July 2011 for 7 nights)
Dim queryString As String = "startdate_yyyymmdd=2011-07-01&hdur=7&ad=2&ch=0"
' Call the API
Dim doc As XmlDocument =
myTourCMS.SearchHotelsByRange(queryString, tour, channelId)
' Loop through each Hotel and output the name
Dim tourList As XmlNodeList = doc.GetElementsByTagName("tour")
For Each tour As XmlNode In tourList
Dim tourName As String = tour.SelectSingleNode("tour_name").InnerText
Console.WriteLine(tourName)
Next
The Hilton
Travel Lodge
Enter your TourCMS API credentials below to call the Search Hotels by Specific Availability endpoint.
Supports all of the querystring parameters (apart from paging) from the Tour Search Method plus:
Parameter | Notes |
---|---|
startdate_yyyymmdd | (YYYY-MM-DD) - Start (check in) date |
hdur | Duration (days / nights) |
ad | Adults (non mandatory) |
ch | Children (non mandatory) |
single_tour_id | This will just check that product. Useful if you have a single product page and want to show some live price data. Bear in mind that the tour id is unique per TourCMS account so if you are using this API in a mutli account environment you could get a couple of products back in the XML. (non mandatory) |
Returns the same data as the standard Tour Search Method plus each tour node has a new availability node which contains the following data:
XML Node | Notes | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
room_rate |
There will be one room_rate node for each Room or Rate that is available for that tour. Each room_rate node contains the following child nodes.
|