home > support > API > Marketplace API > List Tour Locations

List Tour Locations

Retrieve a list of tour locations.


Notes

Likely useful if building a dropdown / autocomplete location search. Returns the unique "Primary location" fields in TourCMS and returns them alongside their country codes and (if we have them) country names.
 
Only returns tours with a single country configured, tours spanning more than one country will be excluded from the results. Perhaps try building your own list of locations from tour search, either using the locations or from the start/end latitude and longitude.

REST info

Call/c/tours/locations
/p/tours/locations
FormatsXML
Example/p/tours/locations.xml
VerbGET

Code samples

PHP examples use the PHP Client Library with SimpleXML

Description

object list_tour_locations ( [ int $channel_id = 0 [ , string $queryString ] ] )


Parameters

$channel_id
Channel to return locations from, Agents can leave blank / set to 0 for all connected channels
queryString
Search query string, see possible values in the table below

Example

// Get all locations for channel 3930
$result = $tourcms->list_tour_locations(3930);
			
// Loop through each location
foreach($result->unique_location as $location) {
	// Print out the location name and country
	print $location->location.', '.$country_name.'<br />';
}
London, United Kingdom
Paris, France

C# examples use the .Net Client Library

Overload list

XmlDocument ListTourLocations ()
XmlDocument ListTourLocations (int ChannelId)


Parameters

ChannelId
Channel to return locations from, Agents can leave blank / set to 0 for all connected channels

Example

// Get all locations for channel 3930
XmlDocument doc = myTourCMS.ListTourLocations(3930); 
             
// Display Location list
XmlNodeList locationList = doc.GetElementsByTagName("unique_location"); 
foreach (XmlNode location in locationList) 
{ 
    string locationName = location.SelectSingleNode("location").InnerText; 
    string countryName = location.SelectSingleNode("country_name").InnerText;
    Console.WriteLine(locationName + ", " + countryName); 
}
London, United Kingdom
Paris, France

VB examples use the .Net Client Library

Overload list

XmlDocument ListTourLocations ()
XmlDocument ListTourLocations (Integer ChannelId)


Parameters

ChannelId
Channel to return locations from, Agents can leave blank / set to 0 for all connected channels

Example

' Get all locations for channel 3930 
Dim doc As XmlDocument = myTourCMS.ListTourLocations()
             
' Display Location and associated Country list
Dim locationList As XmlNodeList = doc.GetElementsByTagName("unique_location")
For Each location As XmlNode In locationList 
{ 
    Dim locationName As String = location.SelectSingleNode("location").InnerText 
    Dim countryName As String = location.SelectSingleNode("country_name").InnerText 
    Console.WriteLine(locationName & ", " & countryName); 
}
London, United Kingdom
Paris, France

Querystring parameters

Querystring parameters
XML NodeNotes
langRestrict locations to just those on Channels configured with a particular language.
 
Language code, e.g. "fr"
booking_styleSet to booking to only return locations 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 locations for 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
unique_location

There will be one unique_location node for each location returned

Each unique_location node contains the following child nodes.

XML NodeNotes
location"Primary location" text from TourCMS
country_code2 letter ISO country code
country_nameCountry name (if known)

More information