home > support > API > Marketplace API > API: search bookings
Allows searching by several criteria, returns just a basic overview of each booking. For more detail on a particular booking see Show booking.
Important: A newer, faster endpoint List Bookings may be a better fit. This endpoint may be deprecated in future.
Endpoint | /p/bookings/search /c/bookings/search |
Formats | XML |
Example | /p/bookings/search.xml?page=2&per_page=20 |
Verb | GET |
PHP examples use the PHP Client Library with SimpleXML
object search_bookings ( [ string $params = "" [, int $channel = 0 ]] )
// Tour Operators set their channel here
// Marketplace Partners can optionally set the Channel ID
// Here we set to 0 for all connected channels
$channel = 0;
// Optionally define search parameters
// Here we are just returning active (not cancelled / expired) bookings
$params = "active=1";
// Query the TourCMS API
$result = $tourcms->search_bookings($params, $channel);
// Loop through each booking
foreach($results->booking as $booking) {
// Print out the booking ID and channel name
print $booking->booking_id." - ".$booking->channel_name." > ";
// Print out the booking name and revenue
print $booking->booking_name." (".$booking->sales_revenue_display.")";
print "<br />";
}
12345 - Example Tours > Highland Walk (£599.00)
99281 - Adventure Co > Half day rafting (£99.00)
C# examples use the .Net Client Library
XmlDocument SearchBookings ()
XmlDocument SearchBookings (string queryString)
XmlDocument SearchBookings (string queryString, int channelId)
// Optionally set the Channel ID
// Here we set to 0 for all connected channels
int channelId = 0;
// Optionally define search parameters
// Here we are just returning active (not cancelled / expired) bookings
string queryString = "active=1";
// Query the TourCMS API
XmlDocument doc = myTourCMS.SearchBookings(queryString, channelId);
// Display Booking list
XmlNodeList bookingList = doc.GetElementsByTagName("booking");
foreach (XmlNode booking in bookingList)
{
// Booking ID
string bId = booking.SelectSingleNode("booking_id").InnerText;
// Channel Name
string cName = booking.SelectSingleNode("channel_name").InnerText
// Booking Name
string bName = booking.SelectSingleNode("booking_name").InnerText
// Booking Revenue
string bRev = booking.SelectSingleNode("sales_revenue_display").InnerText
Console.WriteLine(bId + " " + cName + " - " + bName + "(" + bRev + ")");
}
12345 Example Tours - Highland Walk (£599.00)
99281 Adventure Co - Half day rafting (£99.00)
VB examples use the .Net Client Library
XmlDocument SearchBookings ()
XmlDocument SearchBookings (String queryString)
XmlDocument SearchBookings (String queryString, Integer channelId)
' Optionally set the Channel ID
' Here we set to 0 for all connected channels
Dim channelId As Integer = 0
' Optionally define search parameters
' Here we are just returning active (not cancelled / expired) bookings
Dim queryString As String = "active=1"
' Query the TourCMS API
Dim doc As XmlDocument = myTourCMS.SearchBookings(queryString, channelId)
' Display Booking list
Dim bookingList As XmlNodeList = doc.GetElementsByTagName("booking")
For Each booking As XmlNode In bookingList
{
' Booking ID
Dim bId As String = booking.SelectSingleNode("booking_id").InnerText
' Channel Name
Dim cName As String = booking.SelectSingleNode("channel_name").InnerText
' Booking Name
Dim bName As String = booking.SelectSingleNode("booking_name").InnerText
' Booking Revenue
Dim bRev As String = booking.SelectSingleNode("sales_revenue_display").InnerText
Console.WriteLine(bId & " " & cName & " - " & bName & "(" & bRev & ")")
}
12345 Example Tours - Highland Walk (£599.00)
99281 Adventure Co - Half day rafting (£99.00)
NodeJS examples use the NodeJS Wrapper
// Search for bookings made in the first two weeks of January 2016.
TourCMS.searchBookings({
channelId: 3930,
qs: {
made_date_start: "2016-01-01",
made_date_end: "2016-01-14"
},
callback: function(response) {
response.booking.forEach(function(booking) {
console.log(booking.booking_id)
})
}
});
1234
1235
Looking for sample code in a different language? TourCMS and community provided API libraries
Parameter | Notes |
---|---|
made_date_start made_date_end | Use these two parameters to specify a range of booking dates to search, so for example you could search for just the bookings made in the last 24 hours. Note this is the date the booking was created and not the date of travel. YYYY-MM-DD If used these MUST be used as a pair |
start_date_start start_date_end | Use these two parameters to specify a range of booking dates to search, so for example you could search for just the bookings arriving today. NOTE that if the booking has tours for today AND tours for tomorrow on the same booking, the start date (for the booking) will be TODAY. YYYY-MM-DD If used these MUST be used as a pair |
end_date_start end_date_end | Use these two parameters to specify a range of booking dates to search, so for example you could search for just the bookings ending today. NOTE that if the booking has tours for today AND tours for tomorrow on the same booking, the end date (for the booking) will be TOMORROW. YYYY-MM-DD If used these MUST be used as a pair |
component_start_date | Find bookings with a tour/transfer on a particular date YYYY-MM-DD |
active | Pass in a value of 1 to exclude cancelled or expired bookings (bookings may be quotes that weren't taken up by the customer and subsequently expire), 0 to just return cancelled or expired bookings. Leave blank / don't supply to return active & inactive bookings |
final_check | Pass in a value of 1 to only return bookings that HAVE had their final check completed, 0 to return only bookings that HAVE NOT had their final check completed. Leave blank / don't supply to return all bookings regardless of final check status (default). |
lead_customer_surname | Lead customer surname (part matches also checked) |
lead_customer_surname_start | Lead customer surname (part matches ony from the start of the surname, e.g. 'kha' would match 'Khan' but not 'Beckham') |
lead_customer_email | Lead customer email address (part matches also checked) |
lead_customer_tel | Lead customer telephone, matches home, work, sms, mobile (part matches also checked) |
tour_id | Tour ID. Individual or comma separated list. E.g 1,2,3 Combine with List Product Filters to list bookings for tours in a product filter. |
channel_id_tour_id | Channel ID & Tour ID, for use by Agents search over multiple Channels. Individual or comma separated list. E.g 3930_1,3930_2,1234_3 Combine with List Product Filters to list bookings for tours in a product filter. |
booking_name | Booking name (part matches also checked) (Often the main tour name becomes the booking name) |
customer_id | Use to search for bookings by a specific customer, only works if the channel ID is also supplied (channel id is passed in the header if calling the API directly or as the second parameter if using the PHP/.Net API wrappers). Currently searches the lead customer only |
per_page | Number of results to return per page. Max is 500. |
page | Integer for which page number to return. Default is page 1 |
If you send active=0 the results order will be most recently cancelled booking first otherwise the default will be to list most recently received booking first
XML Node | Notes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request | Confirmation of the request that you sent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
error | Any error message returned, if there is no error this will just contain the text OK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
total_bookings_count | Total number of bookings returned by the search (i.e. not just the number on this page) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
total_bookings_quotprov | Total number of bookings that are at the "Quotation" or "Provisional" status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
total_bookings_canc | Total number of bookings that are cancelled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
total_bookings_conf | Total number of confirmed bookings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
booking |
There will be one booking node for each result on this page. Each booking node contains the following child nodes.
|