Already using TourCMS? Log in

home > support > API > Marketplace API > API: tour search

Search Tours

PurposeCreate a search results page, a page listing all tours or a category page
NotesCan be used as a keyword search OR as a geographic search (with results ordered by proximity to a geocode) or a combination of both. No paramaters are mandatory
 
Only returns a subset of the information TourCMS holds on each tour, intended to be enough for a listing page. To get the full details on a specific tour (i.e. once a customer has made a selection) call Show Tour.
 
If you are importing tours into your own database you should use List Tours instead.
CachingIf you are calling the API directly from your website (i.e. rather than populating your own database with tour data) we would recommend caching this API for around an 30 minutes. This helps you keep within API limits and to keep your site running fast. More on API caching.
REST info Call/p/tours/search
/c/tours/search
FormatsXML
Example/p/tours/search.xml?lat=56.82127&long=-6.09139&k=walking
VerbGET
Code

PHP examples use the PHP Client Library with SimpleXML

Description

object search_tours ( [ string $params = "" [, int $channel = 0 ]] )

Parameters

$params
	Search querystring, see possible values in the table below
$channel
	Channel to search, 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 search all
$channel = 3;

// Define search parameters
$params = "lat=56.82127&long=-6.09139&k=walking";

// Query the TourCMS API
$result = $tourcms->search_tours($params, $channel);

// Loop through each Tour and output the Tour name and distance
foreach($result->tour as $tour) {
	print $tour->tour_name.' ('.round($tour->distance).' miles)
'; }
Knoydart Peninsula Walking Adventure (16 miles)
Inner Hebrides Sailing & Walking Adventure (37 miles)

C# examples use the .Net Client Library

Overload list

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

Parameters

queryString
	Search querystring, see possible values in the table below
channelId
	Channel to search, 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 search all
int channelId = 0;

// Build Search querystring (see table below)
string queryString = "lat=56.82127&long=-6.09139&k=walking";

// Call the API
XmlDocument doc = myTourCMS.SearchTours(queryString, channelId);

// Display Tour list
XmlNodeList tourList = doc.GetElementsByTagName("tour");
foreach (XmlNode tour in tourList)
{
	string tourName = tour.SelectSingleNode("tour_name").InnerText;
	string tourDist = tour.SelectSingleNode("distance").InnerText;
    Console.WriteLine(tourName + " (" + tourDist + " miles)");
}
Knoydart Peninsula Walking Adventure (16 miles)
Inner Hebrides Sailing & Walking Adventure (37 miles)

VB examples use the .Net Client Library

Overload list

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

Parameters

queryString
	Search querystring, see possible values in the table below
channelId
	Channel to search, 0/blank for all connected channels

Example

' Set the Channel ID
' For Operators this can be found in the API settings page
' For Agentss this can be a specific Channel or 0 to search all
Dim channelId As Integer = 0

' Build Search querystring (see table below)
Dim queryString As String = "lat=56.82127&long=-6.09139&k=walking"

' Call the API
Dim doc As XmlDocument = myTourCMS.SearchTours(queryString, channelId)

' Display Tour list
Dim tourList As XmlNodeList = doc.GetElementsByTagName("tour")
For Each tour As XmlNode In tourList
	Dim tourName As String = tour.SelectSingleNode("tour_name").InnerText
	Dim tourDist As String = tour.SelectSingleNode("distance").InnerText
	Console.WriteLine(tourName & " (" & tourDist & " miles)")
Next
Knoydart Peninsula Walking Adventure (16 miles)
Inner Hebrides Sailing & Walking Adventure (37 miles)

Querystring parameters

Querystring parameters
ParameterNotes
tour_id
not_tour_id
Limit the results to a set list of Tours by passing in a list of IDs (or exclude by using not_tour_id). Perhaps useful if presenting a list of the alternative tours returned by Tour Show with more detail than returned directly by that API.
 
tour_id=10 (Tour ID 10 only)
tour_id=10,12,15 (Tour IDs 10, 12 and 15 only)
 
NB: Only works if searching in a specific Channel (e.g. an Operator/Supplier on their own site, or an Agent listing Tours from a certain Channel).
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)
kKeyword - matches against Tour name, Location, Short description, Summary, Tour code
k2Keyword #2 (When used with k will be OR)
k3Keyword #3 (When used with k and k2 will be OR)
k_typeSet k_type=AND to make k, k2, k3 work as an AND (default is OR)
locationSearch by "Primary location" text field (Part matches permitted)
latLatitude of search point
longLongitude of search point
geo_typeSet to end to search tour end point. By default will search tour start point
geo_unitSet to km to set unit for proximity search to kilometres. By default will be miles
geo_distanceDefine distance for proximity search. Default 50
has_saleBy default will only return tours that have at least one bookable date in the future. Set to all to return all tours
has_offerSet to 1 to return just tours with special offers / deals available.
 
Combine with start_date_start and start_date_end to return tours with special offers available during a certain range of start dates, e.g. Christmas offers or School holiday offers.
has_sale_monthe.g. has_sale_month=1,2 to return products with something on sale EITHER in January OR February. Can be multiple or just a single month. Use this to create a basic availability search
404_tour_urlTourCMS checks the Product page URLs stored for each tour accessible via the API, by default only products with working Product page URLs will be returned.
 
Set this parameter to override that behaviour:
 
error - Return just those tours that are returning errors, handy if you are a tour operator / supplier and want to fix your URLs.
all - Return all tours, regardless of whether their Product page URL is returning an error or not. Handy if you are building an entirely API driven website, or perhaps a mobile app, and have no need to link through to the supplier website for full details.
start_dateCheck availability on a specific date, date format YYYY-MM-DD
start_date_start
start_date_end
Check availability on a range of start dates, date format YYYY-MM-DD
between_date_start
between_date_end
Check availability where start date is after between_date_start and end date is before between_date_end, date format YYYY-MM-DD.
 
Only use this when dealing with searches for multi-day product that starts and ends between a pair of dates, otherwise use start_date_start and start_date_end
duration_min
duration_max
Search by tour duration (Days)
price_range_minMinimum "From" price. Defaults to USD, use price_range_currency to specify a different currency to base ranged search on.
price_range_maxMaximum "From" price. Defaults to USD, use price_range_currency to specify a different currency to base ranged search on.
price_range_currencyCurrency to base min/max price range searches on, defaults to USD.
 
TourCMS will return prices in their original currency, however internally all prices plus the min/max range are converted to USD (using exchange rates from multiple sources) for range and ordering purposes. Due to this conversion, actual ranges may vary slightly
min_priorityMinimum commercial priority. Set to medium to return either Medium or High priority tours, set to high to return only High priority tours only - perhaps to build a "Featured Tours".
countrySearch by country - two letter ISO country code
not_countryEXCLUDE results featuring this country - two letter ISO country code
not_accomSet to 1 to EXCLUDE tour that include accommodation (Product types 1 & 3)
Handy if you are featuring tours / activities on a hotel website
accomSet to 1 to ONLY RETURN products that include accommodation (Product types 1 & 3)
Handy if you are featuring hotels on a tour/activity website
accomratingSearch by accommodation rating - comma separated list e.g. to just search for comfortable/basic products search for accomrating=4,5
product_typeSearch by product type - comma separated list e.g. to just search for products with accommodation search for product_type=1,3
gradeSearch by grade - comma separated list e.g. to just search for extreme/challenging products search for grade=4,5
suitable_for_solo ¶Find Tours suitable for solo travellers (by setting to 1) or NOT suitable for solo travellers (by setting to 0)
suitable_for_couples ¶Find Tours suitable for couples (by setting to 1) or NOT suitable for couples (by setting to 0)
suitable_for_children ¶Find Tours suitable for children (by setting to 1) or NOT suitable for children (by setting to 0)
suitable_for_groups ¶Find Tours suitable for groups (by setting to 1) or NOT suitable for solo travellers (by setting to 0)
suitable_for_students ¶Find Tours suitable for students (by setting to 1) or NOT suitable for students (by setting to 0)
suitable_for_business ¶Find Tours suitable for business travellers (by setting to 1) or NOT suitable for business travellers (by setting to 0)
suitable_for_wheelchairs ¶Find Tours suitable for wheelchairs (by setting to 1) or NOT suitable for wheelchairs (by setting to 0)
 
The seven suitable_for_ fields are new to TourCMS and may not be fully populated by all Channels (Tour Operators) yet, thus they may not be reliable currently. They will be made mandatory shortly at which point they can be relied on.
currencySearch by currency - three letter upper case currency code (USD / EUR / GBP etc) (Only bring back products selling in a particular currency. This is a filter to reduce products shown not an application of an exchange rate)
langLanguage that the tour description is loaded in. By default will return all products. If you just want tours loaded in the English language set to en
lang_spokenLanguages spoken on the tour. Most commonly loaded for attractions that have audio guides or operate specific language groups.
 
This is a relatively new field and not all tours will have it configured. Generally speaking we would not rely on using this search parameter currently, instead you may wish to just display the languages spoken where returned.
video_serviceOptionally search for only tours that have a video, or have a video hosted by a particular service.
 
By default TourCMS will return all tours regardless of whether they have video or not, override this by passing:
 
all - Just tours with videos (hosted anywhere)
vimeo - Just tours with videos hosted by Vimeo
youtube - Just tours with videos hosted by YouTube
order
Default order
By default the results are returned in descending commercial priority followed by tour performance order, next bookable date order, "display points" value and finally alphabetically by tour name.
 
If carrying out a proximity search the default ordering will by distance to the search point, closest first.

Overriding the default order
Alphabetical: Set order=tour_name
 
Commercial priority: Set order=comm
 
Departure date: Set order=date_soonest to order by nearest bookable date (ideal if you have a list of events and you want to show in date order). Please note that if you are searching for tours available within a date range that this is the overall next bookable date and NOT the next bookable date within a supplied date range
 
Display points: Set order=display_points_up or order=display_points_down to order by the "Display points" field in the Tour setup page. Possibly useful for Tour Operators use on their own website, likely of little use to Agents.
 
Duration: Set order=duration_up or order=duration_down
 
Price: Set order=price_up or order=price_down. For Agents searching across multiple Channels the currencies in use may vary, TourCMS internally converts all prices to USD for ordering purposes (but does not expose the calculated USD price anywhere).
 
Special offer: To order by the most recently created special offers set to order=offer_recent, for tours with offers starting soonest then set to order=offer_soonest (use this for a "Late deals" type page).
 
Tour creation date: Set order=created_recent to order by most recently created first (similar to a blog posting style where on a blog tend to show most recent blog posts first)
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.
per_pageNumber of results to return per page. Default is 75. Max is 200
pageInteger for which page number to return. Default is page 1
If API called by Tour Operator (not Marketplace Agent)
category
ANDcategory
ORcategory
NOTcategory
Tour Operators / Suppliers can define product Categories to aid grouping their products into Product filters (collections) for internal use in reporting, or for grouping products on their website. Learn more.
 
Example Categories might include "Activity type" (with possible values of "Rafting", "Mountain Biking", "Hiking") or for Hotel type products you might have "Accommodation rating" (with possible values of "5 Star", "3 Star" or "Boutique").
 
There are three parameters that can be used to search these. If searching just a single category then any of the parameters can be used, however the most logical would be category, e.g to search for Rafting use the following...
 
category=Rafting
 
...to search for either Rafting OR Hiking...
 
ORcategory=Rafting|Hiking
 
...to search for Tours that contain both Rafting AND Hiking...
 
ANDcategory=Rafting|Hiking
 
NOTcategory, can be used to tell TourCMS which products to exclude from the results,for example to search for all products that feature Rafting but not Hiking....
 
category=Rafting&NOTcategory=Hiking
IF you are using tour search API to export tours into a 3rd party system AND the page limit of 200 is a problem (i.e. you are exporting more than 200 products) then please contact TourCMS support. We have an API parameter to remove the limit! But nope, we are not documenting it here :)

Searching by Keyword

As described in the table above there are two parameters (k and k2) that can be used to search Tours by keyword, here are a few examples of their use:

k=Rafting
Returns all Tours containing the text "Rafting"
k=Rafting&k2=Kayaking
Returns all Tours containing the text "Rafting" and/or the text "Kayaking"
k=White+water+rafting
Returns all Tours containing the text "White water rafting"

Keyword searching is NOT case-sensitive.

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
total_tour_count Total number of tours returned by the search (i.e. not just the number on this page)
tour

There will be one tour node for each result on this page.

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
next_bookable_dateFirst date the tour is bookable, date format YYYY-MM-DD
IF a date based availability search then next_bookable_date will be the first date in the range that is bookable
has_sale_jan
has_sale_feb
has_sale_mar
has_sale_apr
has_sale_may
has_sale_jun
has_sale_jul
has_sale_aug
has_sale_sep
has_sale_oct
has_sale_nov
has_sale_dec
1 - Future product on sale (by the month)
0 - No future product on sale (by the month
tour_codeTour code (only returned if set)
from_priceLead in price
from_price_displayLead in price - display version (Includes HTML entity currency code and no decimals)
from_price_jan
from_price_feb
from_price_mar
from_price_apr
from_price_may
from_price_jun
from_price_jul
from_price_aug
from_price_sep
from_price_oct
from_price_nov
from_price_dec
Lead in price by the month
Use to create a nice seasonal price chart

There are also _display versions that work the same way as from_price_display
sale_currencySale currency (for the lead in price). Currency is set by channel
priorityHIGH, MEDIUM, LOW - Commercial priority
thumbnail_imageThe URL for an image to display for this Tour. Will be based on the first image for the Tour, resized to maximum 342px wide.
video

If there are videos associated with the tour then the first one will be returned, containing:

XML NodeNotes
video_service Video service used to host the video. Currently will be either vimeo or youtube.
 
If embedding use this combined with the video_id to determine if/how to embed the video. Or use this handy PHP script.
video_id Service-specific ID for the video (if any)
video_url URL to a web page containing the video
geocode_startLat,Long geocode for start point
geocode_endLat,Long geocode for end point
distanceIF a proximity search, the distance from the search point. Default is miles
Field not returned if not a proximity search
tour_nameTour name - Short
tour_name_longTour name - Long
start_timeStart time for the Tour.
 
May be a 24 hour time value in local time (e.g. "09:00").
 
If there are multiple start times per day or the start time varies by day then the value will be "MULTI".
 
Alternatively if start time is unknown / irrelevent then this field may be blank (although the start time may be explained elsewhere in the Tour description, e.g. in the pickup points section).
 
If any special offers have been found for the Tour they may have their own start and end times.
end_timeEnd time for the Tour.
 
Possible values as per start_time above.
countryList of countries the tour takes place - 2 digit ISO code format, comma separated
durationDuration (Days)
 
Automatically calculated based on the dates and prices loaded
duration_descText description for duration (e.g. 1 week)
 
Free text field edited by tour operator staff users. Human readable but not necessarily consistent across accounts.
locationPrimary location - Perhaps a city name, national park name or region
summarySummary - Includes primary activity if not clear from tour name
shortdescShort description (NO HTML)
availableText description for when available (e.g. March to September)
tour_urlURL for the tour detail page
tour_url_trackedURL for the tour detail page - via agent tracking mechanism
Not returned for /c/tours/search
book_urlURL to booking engine / live availability display (can be iframed onto your site)
tourleader_type 1 - Tour guide / driver
2 - Independent / self drive
3 - Not applicable (e.g. accommodation / event)
grade 1 - All ages / Not applicable
2 - Moderate
3 - Fit
4 - Challenging
5 - Extreme
accomrating 1 - No accommodation / Not applicable
2 - Luxury
3 - Moderate
4 - Comfortable
5 - Basic
6 - Various levels
product_type 1 - Accommodation (hotel/campsite/villa/ski chalet/lodge)
2 - Transport/Transfer
3 - Tour/cruise including overnight stay
4 - Day tour/trip/activity/attraction (No overnight stay)
5 - Tailor made
6 - Event
7 - Training/education
8 - Other
 

In the case of "2" (Transport/Transfer) there will be an attribute on the XML element indicating the direction of travel.
 
0 - Other / not set
1 - Airport to City
2 - City to Airport
3 - Two way return
 
E.g. for a return transfer <product_type direction="3">2<product_type>
suitable_for_solo ¶Tour is suitable for solo travellers (1 - Yes, 0 - No)
suitable_for_couples ¶Tour is suitable for couples (1 - Yes, 0 - No)
suitable_for_children ¶Tour is suitable for children (1 - Yes, 0 - No)
suitable_for_groups ¶Tour is suitable for groups (1 - Yes, 0 - No)
suitable_for_students ¶Tour is suitable for students (1 - Yes, 0 - No)
suitable_for_business ¶Tour is suitable as a business trip extension for business travellers (1 - Yes, 0 - No)
suitable_for_wheelchairs ¶Tour is suitable for wheelchair users (1 - Yes, 0 - No)
 
The seven suitable_for_ fields are new to TourCMS and may not be fully populated by all Channels (Tour Operators) yet. They will be made mandatory shortly.
languages_spokenLanguages spoken on the tour. Comma separated list. E.g. "en,pt" for English & Portuguese
supplier_idIf a Tour Operator is using the API call directly then supplier_id will contain the internal reference number for the supplier on the main Tour on the booking. Not returned when a Marketplace Agent is using the API.
channel

The channel node contains the following child nodes.

XML NodeNotes
channel_name Channel name (Company name)
logo_url Channel logo URL
lang Channel language.
 
Additional languages may be spoken on the tour, see "languages_spoken".
home_url URL website homepage
home_url_tracked URL website homepage (with agent tracking)
soonest_special_offer

If any special offers / deals are loaded for this Tour then a soonest_special_offer node will be returned containing the soonest (i.e. closest to start/departure date) special offer via the below child nodes. If you are ordering the results by offer_soonest then this is probably the offer you want to display.

XML NodeNotes
start_dateStart date for this date
end_dateEnd date for this date
start_timeStart time for the Tour on this particular offer in 24 hour local time format (e.g. "09:00").
 
If the start time is not known or is irrelevant for the item type then this field will be blank
end_timeEnd time for the Tour on this particular offer in 24 hour local time format (e.g. "17:00").
 
If the start time is not known or is irrelevant for the item type then this field will be blank
date_codeThis is the "Departure code" from a Tour Operators perspective, may be empty
noteProduct note
min_booking_sizeMinimum number of people required per booking, e.g. 1
spaces_remainingNumber of people that can still book for this date. Generally numeric however could contain the text UNLIMITED
special_offer_typeType of special offer / deal on this date
 
1 - Date specific special price
2 - Late booking discount
3 - Early booking discount
4 - Duration specific discount
price_1Price for 1 person. E.g 100.00
price_1_displayDisplay version of the price for 1 person including currency symbol / code. E.g €100.00
price_2Price for 2 people. E.g. 180.00 (It can often be cheaper and so preferable to show a per person price based on the price for 2 people sharing).
price_2_displayDisplay version of the price for 2 people including currency symbol / code. E.g €180.00 (It can often be cheaper and so preferable to show a per person price based on the price for 2 people sharing).
special_offer_datetimeDate and tine the special offer was created. Format YYYY-MM-DD HH:MM:SS
special_offer_noteText note on the special offer, e.g. "20% off early bookings"
original_price_1The original price for 1 person (before the discount was applied). E.g. 120.00
original_price_1_displayDisplay version of the original price for 1 person (before the discount was applied). Includes currency symbol / code. E.g. €120.00
original_price_2The original price for 2 people (before the discount was applied). E.g. 200.00
original_price_2_displayDisplay version of the original price for 2 people (before the discount was applied). Includes currency symbol / code. E.g. €200.00
recent_special_offer

If any special offers / deals are loaded for this Tour then a recent_special_offer node will be returned featuring the most recently created special offer via the below child nodes. If you are ordering the results by offer_recent then this is probably the offer you want to display.

XML NodeNotes
start_dateStart date for this date
end_dateEnd date for this date
start_timeStart time for the Tour on this particular offer in 24 hour local time format (e.g. "09:00").
 
If the start time is not known or is irrelevant for the item type then this field will be blank
end_timeEnd time for the Tour on this particular offer in 24 hour local time format (e.g. "17:00").
 
If the start time is not known or is irrelevant for the item type then this field will be blank
date_codeThis is the "Departure code" from a Tour Operators perspective, may be empty
noteProduct note
min_booking_sizeMinimum number of people required per booking, e.g. 1
spaces_remainingNumber of people that can still book for this date. Generally numeric however could contain the text UNLIMITED
special_offer_typeType of special offer / deal on this date
 
1 - Date specific special price
2 - Late booking discount
3 - Early booking discount
4 - Duration specific discount
price_1Price for 1 person. E.g 100.00
price_1_displayDisplay version of the price for 1 person including currency symbol / code. E.g €100.00
price_2Price for 2 people. E.g. 180.00 (It can often be cheaper and so preferable to show a per person price based on the price for 2 people sharing).
price_2_displayDisplay version of the price for 2 people including currency symbol / code. E.g €180.00 (It can often be cheaper and so preferable to show a per person price based on the price for 2 people sharing).
special_offer_datetimeDate and tine the special offer was created. Format YYYY-MM-DD HH:MM:SS
special_offer_noteText note on the special offer, e.g. "20% off early bookings"
original_price_1The original price for 1 person (before the discount was applied). E.g. 120.00
original_price_1_displayDisplay version of the original price for 1 person (before the discount was applied). Includes currency symbol / code. E.g. €120.00
original_price_2The original price for 2 people (before the discount was applied). E.g. 200.00
original_price_2_displayDisplay version of the original price for 2 people (before the discount was applied). Includes currency symbol / code. E.g. €200.00
If API called by Tour Operator (not Marketplace Agent)
custom1If any single line "Extra tour data fields" have been configured in TourCMS, this field will contain the value of the first one (ordered alphabetically).
 
Useful for displaying custom information or indicators against particular products, such as loading icons for particular activity types
custom2If any single line "Extra tour data fields" have been configured in TourCMS, this field will contain the value of the second one (ordered alphabetically).
 
Useful for displaying custom information or indicators against particular products, such as loading icons for particular activity types

Sample XML response

Search near a geographic point (in Scotland) filtering by keyword (Walking) This returns walking tours in Scotland, ordered by distance to the search point (Miles) Look at the distance field to see how far away from the point the tour starts from

/p/tours/search.xml?lat=57.19437&long=-3.828825&k=walking

Widgets

Access the same tour search API method via a JavaScript widget. Information about widgets

1 tour

Compact version including page navigation

More information

© 2003-2014 Travel UCD Limited. All rights reserved. TourCMS® is a registered trademark of Travel UCD Limited, United Kingdom. View Privacy policy.