home > support > API > Marketplace API > hotel search > by specific date

Hotel(s) by specific availability

Create a hotel/chalet/villa search results page based on availability for specific dates


Notes

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.

Linking to the booking engine

You can append the following to the book link (returned in the XML):

  • startdate_yyyymmdd - e.g. 2010-12-12 - start date
  • hdur - e.g. 1 - duration
  • ad - e.g. 2 - adults
  • ch - e.g. 0 - children

Further informtion about linking to the booking engine with default values

REST info

Endpoint/p/hotels/search_avail
/c/hotels/search_avail
FormatsXML
Example/p/hotels/search_avail.xml?startdate_yyyymmdd=2011-07-16&hdur=7
VerbGET

Code samples

PHP examples use the PHP Client Library with SimpleXML

Description

object search_hotels_specific([string $params="" [,string $tour="" [,int $channel=0]]]) 


Parameters

$params
Querystring, see "Querystring parameters" section below
$tour
Restrict the Search to a specific hotel ID
$channel
ID for a Channel (supplier) to list products from. Set as 0 for all.

Example

// 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

Overload list

XmlDocument SearchHotelsBySpecific ()
XmlDocument SearchHotelsBySpecific (string queryString)
XmlDocument SearchHotelsBySpecific (string queryString, string tour)
XmlDocument SearchHotelsBySpecific (string queryString, string tour, int channelId)


Parameters

queryString
Search query string, see possible values in the table below
tour
Comma separated list of Tours to include in the search, empty string/blank for all
channelId
Channel to search, 0/blank for all connected channels

Example

// 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

Overload list

XmlDocument SearchHotelsBySpecific ()
XmlDocument SearchHotelsBySpecific (string queryString)
XmlDocument SearchHotelsBySpecific (string queryString, string tour)
XmlDocument SearchHotelsBySpecific (string queryString, string tour, int channelId)


Parameters

queryString
Search query string, see possible values in the table below
tour
Comma separated list of Tours to include in the search, empty string/blank for all
channelId
Channel to search, 0/blank for all connected channels

Example

' 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

Querystring parameters

Supports all of the querystring parameters (apart from paging) from the Tour Search Method plus:

Request parameters
ParameterNotes
startdate_yyyymmdd(YYYY-MM-DD) - Start (check in) date
hdurDuration (days / nights)
adAdults (non mandatory)
chChildren (non mandatory)
single_tour_idThis 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)

Response fields

Returns the same data as the standard Tour Search Method plus each tour node has a new availability node which contains the following data:

Response fields
XML NodeNotes
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.

XML NodeNotes
label Room/Rate name
ror Room or rate. Rooms have availability control on, rates don't
request_start_date Start date for request
request_end_date End date for request (bear in mind that some hotels count days and some count nights hence a duration of 2 may return a different request end date for each hotel)
request_duration Duration (days / nights) in request. Makes it easy to add to the book link
request_adults Adults requested (or the defaults used if not originally supplied in the request)
request_children Children requested (or the defaults used if not originally supplied in the request)
whole_chalet 1 if booking an entire ski chalet, 0 if not (and booking an individual room in a chalet)
max_adults Capacity
max_children Capacity
rooms_remaining Number of rooms of the same type that remain available
board_basis

Each room_rate will have one or more board_basis (e.g. "All Inclusive", "Half Board" etc) nodes.

Each room_rate node contains the following child nodes.

XML NodeNotes
codeBoard Basis code
nameBoard Basis name
pricePrice
price_displayPrice with currency symbol / description

More information