home > support > API > Marketplace API > list tour images
List of tours including their image URLs. Like List Tours, except use this one if you want all the URLs for all tour images. Handy if you are serving images from your own hosting and wish to quickly know what images you need to synchronise.
Endpoint | /c/tours/images/list /p/tours/images/list |
Formats | XML |
Example | /c/tours/images/list.xml |
Verb | GET |
PHP examples use the PHP Client Library with SimpleXML
object list_tour_images ( [ 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 = 5;
// Query the TourCMS API, passing in our channel id
$result = $tourcms->list_tour_images($channel);
// Loop through each tour
foreach($result as $tour) {
// Print out the tour id
print '<strong>Tour id '.$tour->tour_id.':</strong> ';
// Loop through each image and print out the url
foreach($tour->images->image as $image) {
print $image->url.', ';
}
print '<br />';
}
Tour id 161: https://cdn.tourcms.com/a/5/161/1.jpg,
https://cdn.tourcms.com/a/5/161/2.jpg,
https://cdn.tourcms.com/a/5/161/3.jpg,
Tour id 172: https://cdn.tourcms.com/a/5/172/1.jpg,
https://cdn.tourcms.com/a/5/172/2.jpg,
https://cdn.tourcms.com/a/5/172/3.jpg,
https://cdn.tourcms.com/a/5/172/4.jpg
C# examples use the .Net Client Library
XmlDocument ListTourImages ()
XmlDocument ListTourImages (int channelId)
XmlDocument ListTourImages (string queryString)
XmlDocument ListTourImages (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.ListTourImages(queryString, channelId);
// Display Tour Image list
XmlNodeList tourList = doc.GetElementsByTagName("tour");
foreach (XmlNode tour in tourList)
{
string tourId = tour.SelectSingleNode("tour_id").InnerText;
Console.WriteLine("Tour id " + tourId);
XmlNodeList imageList = tour.GetElementsByTagName("image");
foreach(XmlNode image in imageList) {
string imageUrl = image.SelectSingleNode("url").InnerText;
Console.WriteLine(imageUrl);
}
}
Tour id 161
https://cdn.tourcms.com/a/5/161/1.jpg
https://cdn.tourcms.com/a/5/161/2.jpg
https://cdn.tourcms.com/a/5/161/3.jpg
Tour id 172
https://cdn.tourcms.com/a/5/172/1.jpg
https://cdn.tourcms.com/a/5/172/2.jpg
https://cdn.tourcms.com/a/5/172/3.jpg
https://cdn.tourcms.com/a/5/172/4.jpg
VB examples use the .Net Client Library
XmlDocument ListTourImages ()
XmlDocument ListTourImages (int channelId)
XmlDocument ListTourImages (string queryString)
XmlDocument ListTourImages (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.ListTourImages(queryString, channelId)
' Display Tour Image 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("Tour id " & tourId)
Dim imageList As XmlNodeList = tour.GetElementsByTagName("image")
For Each image As XmlNode in imageList
Dim imageUrl As String = image.SelectSingleNode("url").InnerText
Console.WriteLine(imageUrl)
Next
Next
Tour id 161
https://cdn.tourcms.com/a/5/161/1.jpg
https://cdn.tourcms.com/a/5/161/2.jpg
https://cdn.tourcms.com/a/5/161/3.jpg
Tour id 172
https://cdn.tourcms.com/a/5/172/1.jpg
https://cdn.tourcms.com/a/5/172/2.jpg
https://cdn.tourcms.com/a/5/172/3.jpg
https://cdn.tourcms.com/a/5/172/4.jpg
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 Tour Images 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 a separate 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.
|