home > support > API > List Tours

List Tours

List of tours


Notes

Most useful if you are taking all API data into a local database and you want to quickly find out which tours you are connected to. This call will give you a good list of tours to then run Tour Show against.
 
If you are using the API for live search, or if you want to display a detailed list of Tours on a web page use the Tour Search call instead.
 
Includes tours with no future bookable dates - indicated by "has_sale" being set to "0".

REST info

Endpoint/c/tours/list
/p/tours/list
FormatsXML
Example/c/tours/list.xml
VerbGET

Code samples

PHP examples use the PHP Client Library with SimpleXML

Description

object list_tours ( [ int $channel = 0 [, string $queryString = ""] ] ) 


Parameters

$channel
ID for a Channel (supplier) to list products from
queryString
Search query string, see possible values in the table below

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

Overload list

XmlDocument ListTours ()
XmlDocument ListTours (int channelId)
XmlDocument ListTours (string queryString)
XmlDocument ListTours (string queryString, int channelId)


Parameters

queryString
Search query string, see possible values in the table below
channelId
Channel to list Tours from, 0/blank for all connected channels

Example

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

Overload list

XmlDocument ListTours ()
XmlDocument ListTours (int channelId)
XmlDocument ListTours (string queryString)
XmlDocument ListTours (string queryString, int channelId)


Parameters

queryString
Search query string, see possible values in the table below
channelId
Channel to list Tours from, 0/blank for all connected channels

Example

' 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


Example

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

Querystring parameters

Querystring parameters
XML NodeNotes
booking_styleSet 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)
qcEnable/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

Response fields

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

XML NodeNotes
channel_idChannel ID
account_idAccount ID
tour_idTour ID
has_sale1 - Future product on sale
0 - No future product on sale
has_d1 - Has a tour departure loaded
0 - No tour departure loaded
has_f1 - Has a tour freesale loaded
0 - No tour freesale loaded
has_h1 - Has a hotel product type loaded
0 - No hotel product type loaded
descriptions_last_updatedWhen the tour text descriptions were last updated
tour_nameTour name
supplier_idIf a Tour Operator is using the API call directly then supplier_id will contain the internal reference number for the supplier. Not returned when a Marketplace Agent is using the API.
supplier_tour_codeIf a Tour Operator is using the API call directly then supplier_tour_code will contain the supplier set tour code. This field is ideal if you are syncronising TourCMS with an external reservation system as this could be the external reservation system tour ID. Not returned when a Marketplace Agent is using the API.

More information