home > support > API > Marketplace API > List Tour Locations
Retrieve a list of tour locations.
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.
Call | /c/tours/locations /p/tours/locations |
Formats | XML |
Example | /p/tours/locations.xml |
Verb | GET |
PHP examples use the PHP Client Library with SimpleXML
object list_tour_locations ( [ int $channel_id = 0 [ , string $queryString ] ] )
// 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
XmlDocument ListTourLocations ()
XmlDocument ListTourLocations (int ChannelId)
// 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
XmlDocument ListTourLocations ()
XmlDocument ListTourLocations (Integer ChannelId)
' 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
Enter your TourCMS API credentials below to call the List Tour Locations endpoint.
XML Node | Notes |
---|---|
lang | Restrict locations to just those on Channels configured with a particular language. Language code, e.g. "fr" |
booking_style | Set 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) |
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 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
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 | unique_location |
There will be one unique_location node for each location returned Each unique_location node contains the following child nodes.
|