home > support > API > Marketplace API > search enquiries

Search Enquiries

Generate a list of previously created Enquiries


Notes

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.

REST info

Call/p/enquiries/search
/c/enquiries/search
FormatsXML
Example/c/enquiries/search.xml
VerbGET

Code samples

PHP examples use the PHP Client Library with SimpleXML

Description

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


Parameters

$params
Search query string, see possible values in the table below
$channel
Channel to search, Partners can set to 0/blank for all connected

Example

// 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

Overload list

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


Parameters

queryString
Search query string, see possible values in the table below
channelId
Channel to search, Partners can set to 0/blank for all connected

Example

// 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

Overload list

XmlDocument SearchEnquiries ()
XmlDocument SearchEnquiries (String queryString)
XmlDocument SearchEnquiries (String queryString, Integer channelId)


Parameters

queryString
Search query string, see possible values in the table below
channelId
Channel to search, Partners can set to 0/blank for all connected

Example

' 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


Example

// 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

Querystring parameters

All are Optional

Querystring parameters
ParameterNotes
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
uniqueIF 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_idUse 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_pageNumber of results to return per page. Default is 100. Max is 500
pageInteger for which page number to return. Default is page 1

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
enquiry

If any enquiries are returned there will be an enquiry node containing the following child nodes.

XML NodeNotes
channel_idChannel ID
account_idAccount ID
enquiry_idID number for the Enquiry
customer_idID number for the Customer record
made_date_timeDate/Time when the enquiry was stored, this will be returned based on the Channels local time (i.e. varies accross Channels). Format: YYYY-MM-DD HH:MM:SS E.g 2011-08-18 18:52:01
statusInteger representation of the current status of the enquiry.
0 = "Triage" (default initial status)
1 = "Open (Staff)"
2 = "Open (Customer)"
3 = "Open (Agent)"
4 = "Open (Supplier)"
5 = "Closed / Solved (Success / Booked)"
6 = "Solved (Failure / Not Booked)"
status_textEnglish language text version of the above status, e.g. "Triage"
typeFree text. "Brochure", "Tailor-made tour" request, contact us form etc.
categorySub-category for type (e.g. if for a brochure, the brochure name)
detailThe main note for the enquiry (can be multi-line)
valueValue (e.g. financial value) (May not be money/numeric)
outcomeText description of the outcome of the enquiry
followup_dateDate the enquiry is due to be followed up on (YYYY-MM-DD). Only returned if a followup date has been set by a member of staff.
closed_date_timeDate/time the enquiry was closed. Only returned if the Enquiry is closed (Status of 5 or 6). Format: YYYY-MM-DD HH:MM:SS E.g 2011-08-18 18:52:01
total_enquiries_countThe total number of enquiries returned by the search

More information