home > support > API > Marketplace API > search enquiries
Generate a list of previously created Enquiries
Marketplace partners can search for enquiries they have generated from any channel that have granted them permission level 2 or above when connecting, Enquiries will not be listed from Channels who have only granted level 1 permission. You can check permissions on your channels via the Your connections section of your control panel or by calling the Show Channel API call.
Returns newest first, however that is based on each individual channels local time when the enquiry was entered.
Call | /p/enquiries/search /c/enquiries/search |
Formats | XML |
Example | /c/enquiries/search.xml |
Verb | GET |
PHP examples use the PHP Client Library with SimpleXML
object search_enquiries ( [ string $params = "" [, int $channel = 0 ]] )
// Set the channel we want the enquiries from
// For tour operators this will be their channel ID
// For Marketplace Partners this can be set to return just enquiries
// from a particular channel or 0 to search all channels
$channel = 3;
// Optionally define search parameters
// Here we're searching for Enquiries made in April 2011
$params = "made_date_start=2011-04-01&made_date_end=2011-04-30";
// Query the TourCMS API
$result = $tourcms->search_enquiries($params, $channel);
// Loop through each Enquiry and output the Enquiry ID and Status text
foreach($result->enquiry as $enquiry)
print $enquiry->enquiry_id . " - ". $enquiry->status_text . "<br />";
12345 - Triage
12344 - Open
C# examples use the .Net Client Library
XmlDocument SearchEnquiries ()
XmlDocument SearchEnquiries (string queryString)
XmlDocument SearchEnquiries (string queryString, int channelId)
// Set the channel we want the enquiries from
// For tour operators this will be their channel ID
// For Marketplace Partners this can be set to return just enquiries
// from a particular channel or 0 to search all channels
int channel = 3;
// Optionally define search parameters
// Here we're searching for Enquiries made since 1st April 2011
string queryString = "made_date_start=2011-04-01";
// Call the API
XmlDocument doc = myTourCMS.SearchEnquiries(queryString, channelId);
// Check the response status
string status = doc.SelectSingleNode("//error").InnerText;
if ( status == "OK" )
{
// Loop through each Enquiry and output the Enquiry ID and Status text
XmlNodeList enquiryList = doc.GetElementsByTagName("enquiry");
foreach ( XmlNode enquiry in enquiryList )
{
string enquiryId = enquiry.SelectSingleNode("enquiry_id").InnerText;
string enquiryStatus = enquiry.SelectSingleNode("status_text").InnerText;
Console.WriteLine(enquiryId " - " enquiryStatus);
}
} else {
Console.WriteLine("Error: " status);
}
12345 - Triage
12344 - Open
VB examples use the .Net Client Library
XmlDocument SearchEnquiries ()
XmlDocument SearchEnquiries (String queryString)
XmlDocument SearchEnquiries (String queryString, Integer channelId)
' Set the channel we want the enquiries from
' For tour operators this will be their channel ID
' For Marketplace Partners this can be set to return just enquiries
' from a particular channel or 0 to search all channels
Dim channel As Integer = 3
' Optionally define search parameters
' Here we're searching for Enquiries made since 1st April 2011
Dim queryString As String = "made_date_start=2011-04-01"
' Call the API
Dim doc As XmlDocument = myTourCMS.SearchEnquiries(queryString, channelId)
' Check the response status
Dim status As String = doc.SelectSingleNode("//error").InnerText
If status = "OK" Then
' Display Some information on each Enquiry
Dim enquiryList As XmlNodeList = doc.GetElementsByTagName("enquiry")
For Each enquiry As XmlNode In enquiryList
Dim enqId As string = enquiry.SelectSingleNode("enquiry_id").InnerText
Dim enqStat As string = enquiry.SelectSingleNode("status_text").InnerText
Console.WriteLine(enqId & " - " & enqStat)
Next
Else
Console.WriteLine("Error: " status)
End If
12345 - Triage
12344 - Open
NodeJS examples use the NodeJS Wrapper
// Search for all enquiries made in the first two weeks of Jan 2016
TourCMS.searchEnquiries({
channelId: 3930,
qs: {
made_date_start: "2016-01-01",
made_date_end: "2016-01-14"
},
callback: function(response) {
console.log("Found " + response.enquiry.length + " enquiries");
}
});
Found 2 enquiries
Looking for sample code in a different language? TourCMS and community provided API libraries
Enter your TourCMS API credentials below to call the Search Enquiries endpoint.
All are Optional
Parameter | Notes |
---|---|
made_date_start made_date_end | YYYY-MM-DD. Use these two dates to restrict results to just those enquiries created during a certain date period |
unique | IF you are connected to multiple channels in the same account_id you may get the enquiry back multiple times! (unless you set unique =1) if you set unique =1 - you will get back just one XML entry per enquiry - but bear in mind that the channel ID listed there may not be the channel that it as actually submitted under (but will be a channel from the company) |
customer_id | Use to search for enquiries made by a specific customer, only works if the channel ID is also supplied (channel id is passed in the header if calling the API directly or as the second parameter if using the PHP/.Net API wrappers) |
per_page | Number of results to return per page. Default is 100. Max is 500 |
page | Integer for which page number to return. Default is page 1 |
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 | enquiry |
If any enquiries are returned there will be an enquiry node containing the following child nodes.
|
total_enquiries_count | The total number of enquiries returned by the search |