home > support > API > List Tours
Often used when pulling tour data into an external database / system as it provides a basic list of the tours available to you in the API. You can then run Tour Show against each tour to get the full details.
Alternatively you are using the displaying a list of tours to a customer then the Tour Search endpoint is better.
Includes tours with no future bookable dates - indicated by "has_sale" being set to "0".
Endpoint | /c/tours/list /p/tours/list |
Formats | XML |
Example | /c/tours/list.xml |
Verb | GET |
PHP examples use the PHP Client Library with SimpleXML
object list_tours ( [ int $channel = 0 [, string $queryString = ""] ] )
// 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 list from all
$channel = 3;
// Query the TourCMS API
$result = $tourcms->list_tours($channel);
// Loop through each Tour and print out the Tour ID
foreach($result as $tour) {
print $tour->tour_id.'
';
}
42
99
104
C# examples use the .Net Client Library
XmlDocument ListTours ()
XmlDocument ListTours (int channelId)
XmlDocument ListTours (string queryString)
XmlDocument ListTours (string queryString, int channelId)
// Set the Channel ID
// For Operators this can be found in the API settings page
// For Agents this can be a specific Channel or 0 to list tours from all
int channelId = 0;
// Build Search querystring (see table below)
string queryString = "";
// Call the API
XmlDocument doc = myTourCMS.ListTours(queryString, channelId);
// Display Tour ID list
XmlNodeList tourList = doc.GetElementsByTagName("tour");
foreach (XmlNode tour in tourList)
{
string tourId = tour.SelectSingleNode("tour_id").InnerText;
Console.WriteLine(tourId);
}
42
99
104
VB examples use the .Net Client Library
XmlDocument ListTours ()
XmlDocument ListTours (int channelId)
XmlDocument ListTours (string queryString)
XmlDocument ListTours (string queryString, int channelId)
' Set the Channel ID
' For Operators this can be found in the API settings page
' For Agents this can be a specific Channel or 0 to list tours from all
Dim channelId As Integer = 0
' Build Search querystring (see table below)
Dim queryString As String = ""
' Call the API
Dim doc As XmlDocument = myTourCMS.ListTours(queryString, channelId)
' Display Tour ID list
Dim tourList As XmlNodeList = doc.GetElementsByTagName("tour")
For Each tour As XmlNode in tourList
Dim tourId As String = tour.SelectSingleNode("tour_id").InnerText
Console.WriteLine(tourId)
Next
42
99
104
NodeJS examples use the NodeJS Wrapper
//List all Tours on Channel 3930
TourCMS.listTours({
channelId: 3930,
callback: function(response) {
response.tour.forEach(function(tour) {
console.log(tour.tour_name_long);
})
}
});
Knoydart Peninsula Walking Adventure
Inner Hebrides Sailing & Walking Adventure
Looking for sample code in a different language? TourCMS and community provided API libraries
Implementing yourself? Check the REST info for this endpoint.
Enter your TourCMS API credentials below to call the List Tours endpoint.
XML Node | Notes |
---|---|
booking_style | Set to booking to only return Tours from Channels (Operators) that take confirmed online bookings (e.g. will ignore Tours from any Channels who take online "bookings" as an Enquiry or Quotation stage of the process) |
qc | Enable/disable "Quality control". Quality control can be switched on/off (default is off) within the Agent control panel and also overriden using this querystring parameter. Note: This setting has no impact when a tour operator uses this API method on their own website. Quality control explanation: If you are a web affiliate sending traffic through to the suppliers website then turn qc=on to only return tours where TourCMS is confident web tracking of bookings is in place. If - rather than sending traffic to the suppliers website - you are using the API to input web bookings or enquiries then you don't need to worry about leakage via insufficient web tracking, hence can leave the quality control off. Also ensures tours meet certain image and description length criteria. |
A Channel ID can also be passed in the request header, if using an API wrapper the Channel ID is passed as the first parameter
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 | tour |
There will be one tour node for each tour returned Each tour node contains the following child nodes.
|