home > support > API > Marketplace API > create a new customer / enquiry

Create Customer/Enquiry

Create a new customer / enquiry with a Channel


Notes

Currently available to Marketplace Partner accounts only (if you have a standard Tour Operator account you can post forms directly to your TourCMS account)

Enquiries are non date/product specific communications with the Tour Operator. Use if you are selling or sending through leads to suppliers.

REST info

Call/c/enquiry/new
FormatsXML
ExampleURL: /c/enquiry/new.xml
 
POST data:
<?xml version="1.0"?>
<enquiry>
  <title>Mr</title>
  <firstname>Joe</firstname>
  <surname>Bloggs</surname>
  <enquiry_type>General Enquiry</enquiry_type>
  <enquiry_detail>Customer text goes here</enquiry_detail>
</enquiry>
VerbPOST

Code samples

PHP examples use the PHP Client Library with SimpleXML

Description

object create_enquiry ( SimpleXMLElement $enquiry_data, int $channel )


Parameters

$enquiry_data
SimpleXMLElement containing all of the customer/enquiry information
$channel
ID for the channel (supplier) we want the details

Example

// ID for the channel (supplier) we want to log the Enquiry with
$channel = 3;

// Create a new SimpleXMLElement to hold the enquiry details
$enquiry = new SimpleXMLElement('<enquiry />');

// Add customer/enquiry details (could be using data from a form $_POST)
$enquiry->addChild('title', 'Mr');
$enquiry->addChild('firstname', 'Joe');
$enquiry->addChild('surname', 'Bloggs');
$enquiry->addChild('enquiry_type', 'General Enquiry');
$enquiry->addChild('enquiry_detail', 'Customer text goes here');

// Send the enquiry to the TourCMS API
$result = $tourcms->create_enquiry($enquiry, $channel);

// Check it was received ok
if($result->error == "OK")
	print 'Thanks, your enquiry has been sent.';
Thanks, your enquiry has been sent.

C# examples use the .Net Client Library

Overload list

XmlDocument CreateEnquiry (XmlDocument enquiryDetails, int channelId)


Parameters

enquiryDetails
XmlDocument containing the Customer/Enquiry POST data (See table below)
channelId
ID number for the channel to lodge the Customer/Enquiry with

Example

// ID for the channel (supplier) we want to log the Enquiry with
int channelId = 3;

// Create an XMLDocument to hold the customer details
XmlDocument enquiry = new XmlDocument();

// Create the XML Declaration, append it to XML document
XmlDeclaration dec = enquiry.CreateXmlDeclaration("1.0", null, null);
enquiry.AppendChild(dec);

// Create the root element, append it to the XML document
XmlElement root = enquiry.CreateElement("enquiry");
enquiry.AppendChild(root);

// Either add an existing customer_id or enter some contact
// details and a new customer will be created
// Here we'll pass in an email address and name, creating a new customer
XmlElement email = enquiry.CreateElement("email");
email.InnerText = "joe.bloggs@example.com";
root.AppendChild(email);

XmlElement firstname = enquiry.CreateElement("firstname");
firstname.InnerText = "Joe";
root.AppendChild(firstname);

// Add the details of the enquiry
XmlElement enquiryDetails = enquiry.CreateElement("enquiry_details");
enquiryDetails.InnerText = "Test message";
root.AppendChild(enquiryDetails);

// Call the API
XmlDocument doc = myTourCMS.CreateEnquiry(enquiry, channelId);

// Get the response status, will be "OK" if there's no problem
string status = doc.SelectSingleNode("//error").InnerText;
Console.WriteLine(status);
OK

VB examples use the .Net Client Library

Overload list

XmlDocument CreateEnquiry (XmlDocument enquiryDetails, Integer channelId)


Parameters

enquiryDetails
XmlDocument containing the Customer/Enquiry POST data (See table below)
channelId
ID number for the channel to lodge the Customer/Enquiry with

Example

' ID for the channel (supplier) we want to log the Enquiry with
Dim channelId As Integer = 3

' Build an XMLDocument to hold the customer details
Dim enquiry As XmlDocument = new XmlDocument()

' Create the XML Declaration, append it to XML document
Dim dec As XmlDeclaration = enquiry.CreateXmlDeclaration("1.0", null, null)
enquiry.AppendChild(dec)

' Create the root element, append it to XML document
Dim root As XmlElement = enquiry.CreateElement("enquiry")
enquiry.AppendChild(root);

' Either add an existing customer_id or enter some contact
' details and a new customer will be created
' Here we'll pass in an email address and name, creating a new customer
Dim email As XmlElement = enquiry.CreateElement("email")
email.InnerText = "joe.bloggs@example.com"
root.AppendChild(email)

Dim firstname As XmlElement = enquiry.CreateElement("firstname")
firstname.InnerText = "Joe"
root.AppendChild(firstname)

' Add the details of the enquiry
Dim enquiryDetails As XmlElement = enquiry.CreateElement("enquiry_details")
enquiryDetails.InnerText = "Test message"
root.AppendChild(enquiryDetails)

' Call the API
Dim doc As XmlDocument = myTourCMS.CreateEnquiry(enquiry, channelId)

' Get the response status, will be "OK" if there's no problem
Dim status As String = doc.SelectSingleNode("//error").InnerText
Console.WriteLine(status)
OK

NodeJS examples use the NodeJS Wrapper


Example

TourCMS.createEnquiry({
  channelId: 3930,
  enquiry: {
    firstname: "Joe",
    surname: "Bloggs",
    email: "test@example.com",
    enquiry_type: "General enquiry",
    enquiry_detail: "Enquiry text goes here"
  },
  callback: function(response) {
    console.log(response.error);
  }
});
OK

Looking for sample code in a different language? TourCMS and community provided API libraries

Querystring parameters

There are no querystring parameters supported by this method.

Post fields

The following fields can be posted as XML when calling the API.

Post fields
XML NodeNotes
enquiry

The root XML element, can contain any of the following child nodes.

XML NodeNotes
Commonly used fields
customer_idTourCMS Internal ID number for the Customer record, if supplied (perhaps retrieved during a previous enquiry submission) then an existing record will be updated rather than creating a new one
titleCustomer title e.g. Mr, Mrs etc
firstnameFirst name
surnameSurname
emailEmail address
tel_homeTel home / evening (other phone number fields are listed in the "Not so commonly used fields" section below, however if only taking one phone number then use this field)
addressAddress (can be multi-line)
cityCity
countyCounty / State
postcodePostcode / Zipcode
country2 digit country code (uppercase). Here's a HTML snippet containing all countries in a select box
enquiry_detailThe main note for the enquiry (can be multi-line)
Less commonly used fields
enquiry_type"Brochure", "Tailor-made tour" request, contact us form etc. By default this will be set to indicate that it is an enquiry via your Agent record.
enquiry_categorySub-category for type (e.g. if for a brochure, the brochure name)
enquiry_assigntoTourCMS staff user enquiry should be assigned to
enquiry_valueValue (e.g. financial value) (Doesn't have to be numeric)
enquiry_outcomeText description of the outcome of the enquiry
enquiry_followup_dateFollowup date (YYYY-MM-DD)
middlenameMiddle name (or initial)
nationality2 digit country code (uppercase). Here's a HTML snippet containing all countries in a select box
genderThe customers gender.
 
Leave blank if gender is unknown, otherwise supply one of the following digits:
m = Male
f = Female
x = Indeterminate
dobDate of Birth (YYYY-MM-DD)
agecatAge category - 1 digit code (i-Infant, c-Child, a-Adult, s-Senior).
Alternatively if you know the customers DOB then pass that instead and TourCMS will calculate the agecat automatically.
pass_numPassport number
pass_issuePassport place of issue
pass_issue_datePassport issue date (YYYY-MM-DD)
pass_expiry_datePassport expiry date (YYYY-MM-DD)
wherehearWhere did the customer hear about us (doesn't have to be pre-configured)
faxFax number
tel_workTel work / day
tel_mobileTel mobile
tel_smsTel sms
contact_noteContact note (e.g. don't call before 8pm)
dietDietary requirements
medicalMedical conditions
nok_nameEmergency contact name
nok_relationshipEmergency contact relationship
nok_telEmergency contact telephone number
nok_contactEmergency contact other note (can be multi-line)

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 a new enquiry is created the enquiry node will contain 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

More information