home > support > API > Marketplace API > create a new customer / enquiry
Create a new customer / enquiry with a Channel
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.
Call | /c/enquiry/new |
Formats | XML |
Example | URL: /c/enquiry/new.xml POST data:
|
Verb | POST |
PHP examples use the PHP Client Library with SimpleXML
object create_enquiry ( SimpleXMLElement $enquiry_data, int $channel )
// 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
XmlDocument CreateEnquiry (XmlDocument enquiryDetails, int channelId)
// 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
XmlDocument CreateEnquiry (XmlDocument enquiryDetails, Integer channelId)
' 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
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
Enter your TourCMS API credentials below to call the Create Customer/Enquiry endpoint.
Take care, submitting this form will modify live data!
There are no querystring parameters supported by this method.
The following fields can be posted as XML when calling the API.
XML Node | Notes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
enquiry |
The root XML element, can contain any of the following child nodes.
|
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 a new enquiry is created the enquiry node will contain the following child nodes.
|