home > support > API > Marketplace API > update booking
Update Booking
| Purpose | Update some details on an existing booking |
| Notes | Designed to be used by Tour Operators (not for use by Marketplace Partners) Perhaps combine with the Customer Login Search to create a way for customers to log in and add extra detail onto their booking after they have booked. |
| REST info |
Call | /c/booking/update |
| Formats | XML |
| Example | URL: /c/booking/update.xml
POST data:<?xml version="1.0"?>
<booking>
<booking_id>12345</booking_id>
<customer_special_request>Please can we have a ground floor room</customer_special_request>
</booking>
|
| Verb | POST |
| Code |
PHP examples use the PHP Client Library with SimpleXML
Description
object update_booking
( SimpleXmlElement $booking_data, int $channel )
Parameters
$booking_data
SimpleXmlElement containing the booking data (must include booking ID)
$channel
ID number for the channel the booking belongs to
Example
// Set the channel ID
$channel = 3;
// Create a new SimpleXMLElement to hold the booking details
$booking = new SimpleXMLElement('<booking />');
// Must set the Booking ID on the XML, so TourCMS knows which to update
$booking->addChild('booking_id', '12345');
// Provide their special request information
$booking->addChild('customer_special_request', 'Please can we have a ground floor room');
// Call TourCMS API, updating the booking
$result = $tourcms->update_booking($booking, $channel);
// Check the result, will be "OK" if a booking was updated
switch ($result->error) {
case "OK":
// Print a success message
print "Thanks, your booking details have been updated.";
break;
case "NO DATA CHANGED":
// Nothing was changed, old data matched new data
print "Thanks, it looks like we have your request already!";
break;
default:
// Some other problem (could check error to see what)
print "Sorry, unable to update your booking details at this time.";
break;
}
Thanks, your booking details have been updated.
C# examples use the .Net Client Library
Overload list
XmlDocument UpdateBooking
( XmlDocument bookingData, int channelId )
Parameters
bookingData
XmlDocument containing the booking data (must include booking ID). See "Post fields" table below for full list.
channelId
ID number for the channel the booking belongs to
Example
// Set the ID for the channel this booking is made with
int channelId = 3;
// Create an XMLDocument to hold the booking details
XmlDocument bookingData = new XmlDocument();
// Create the XML Declaration, append it to XML document
XmlDeclaration dec = bookingData.CreateXmlDeclaration("1.0", null, null);
bookingData.AppendChild(dec);
// Create the root element, append it to the XML document
XmlElement root = bookingData.CreateElement("booking");
bookingData.AppendChild(root);
// Must set the Booking ID so TourCMS knows which booking to update
XmlElement bookingId = bookingData.CreateElement("booking_id");
bookingId.InnerText = "12345";
root.AppendChild(bookingId);
// Now set any details that need updating
// Here we'll update the "Special request"
XmlElement req = bookingData.CreateElement("customer_special_request");
req.InnerText = "Please can we have a ground floor room";
root.AppendChild(req);
// Send the data to the TourCMS API, updating the Booking
XmlDocument doc = myTourCMS.UpdateBooking(bookingData, channelId);
// Check the status
// Will be "OK" if the booking was updated
// "NO DATA CHANGED" if the new data matched the old, etc
string status = doc.SelectSingleNode("//error").InnerText;
Console.WriteLine(status);
OK
VB examples use the .Net Client Library
Overload list
XmlDocument UpdateBooking
( XmlDocument bookingData, Integer channelId )
Parameters
bookingData
XmlDocument containing the booking data (must include booking ID). See "Post fields" table below for full list.
channelId
ID number for the channel the booking belongs to
Example
' Set the ID for the channel this booking is made with
Dim channelId As Integer = 3
' Create an XMLDocument to hold the booking details
Dim bookingData As XmlDocument = new XmlDocument()
' Create the XML Declaration, append it to XML document
Dim dec As XmlDeclaration = bookingData.CreateXmlDeclaration("1.0", null, null)
bookingData.AppendChild(dec)
' Create the root element, append it to the XML document
Dim root As XmlElement = bookingData.CreateElement("booking")
bookingData.AppendChild(root)
' Must set the Booking ID so TourCMS knows which booking to update
Dim bookingId As XmlElement = bookingData.CreateElement("booking_id")
bookingId.InnerText = "12345"
root.AppendChild(bookingId)
' Now set any details that need updating
' Here we'll update the "Special request"
Dim req As XmlElement = bookingData.CreateElement("customer_special_request")
req.InnerText = "Please can we have a ground floor room"
root.AppendChild(req)
' Send the data to the TourCMS API, updating the Booking
Dim doc As XmlDocument = myTourCMS.UpdateBooking(bookingData, channelId)
' Check the status
' Will be "OK" if the booking was updated
' "NO DATA CHANGED" if the new data matched the old, etc
Dim status As String = doc.SelectSingleNode("//error").InnerText
Console.WriteLine(status)
OK
|
Querystring parameters
There are no querystring parameters.
Post fields
The following fields can be posted as XML when calling the API, the booking_id is the only required field.
Any fields not present in the XML will not be updated, to clear a field you will need to add it to the XML but leave it's contents blank.
Post fields
| XML Node | Notes |
| booking |
The root XML element, can contain any of the following child nodes.
| XML Node | Notes |
| booking_id | TourCMS Internal ID number for the Booking, this must be provided |
| customer_special_request | Update the customer "Special Request" field on the booking |
| important_note | Update the "Pinned note" on the booking |
| workflow_note | Update the "Workflow note" on the booking |
| customers |
TourCMS stores booking specific information about each customer, the customers node allows you to detail any changes. Currently this can be used to update travel insurance details. To update an actual customer record itself (name, contact details etc) you should instead use the Update Customer API method.
| XML Node | Notes |
| customer |
Include a customer node for each Customer that you wish to update, containing the following:
| XML Node | Notes |
| customer_id | The ID number for the Customer, they must already be on the booking |
| insurance_number | The customers insurance number |
| insurance_note | The customers insurance note |
|
|
| custom_fields |
If any custom fields are configured then they can be added in a custom_fields node containing the following child nodes:
| XML Node | Notes |
| field |
There should be a field node for each custom field containing the following two child nodes:
| XML Node | Notes |
| name | Custom field name E.g. PickupPoint. This can be found in the setup for the custom field inside TourCMS, it is labelled Token (RTF and email templates) and will be a string containing no spaces |
| value | Value for the custom field E.g. Hilton Hotel |
|
|
|
Response fields
Response fields
| 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. If no data was updated (perhaps because the supplied data was the same as the existing data this will contain the text NO DATA CHANGED. |
booking |
If the booking was found there will be a booking node containing the following child nodes.
| XML Node | Notes |
| booking_id | ID number for the Booking |
| channel_id | Channel ID |
| account_id | Account ID |
|
More information