home > support > API > Marketplace API > booking creation > start new booking
Create a temporary booking, holding off stock for the customer
The temporary booking created by this method can subsequently be turned into a live booking via the Commit new booking API method.
Need to delete a temporary booking to release stock availability? Use Delete booking.
Endpoint | /c/booking/new/start |
Formats | XML |
Example | URL: /c/booking/new/start.xml POST data:
|
Verb | POST |
PHP examples use the PHP Client Library with SimpleXML
object start_new_booking ( SimpleXmlElement $booking_data, int $channel )
// Set the channel this booking will be made with
$channel = 3930;
// Start building the booking XML
$booking = new SimpleXMLElement('<booking />');
// Append the total customers, we'll add their details on below
$booking->addChild('total_customers', '1');
// If we're calling the API as a Tour Operator we need to add a Booking Key
// otherwise skip this
// See "Getting a new booking key" for info
$booking->addChild('booking_key', 'BOOKING_KEY_HERE');
// Append a container for the components to be booked
$components = $booking->addChild('components');
// Add a component node for each item to add to the booking
$component = $components->addChild('component');
// "Component key" obtained via call to "Check availability"
$component->addChild('component_key', 'COMPONENT_KEY_HERE');
// Append a container for the customer recrds
$customers = $booking->addChild('customers');
// Optionally append the customer details
// Either add their details (as here)
// OR an existing customer_id
// OR leave blank and TourCMS will create a blank customer
$customer = $customers->addChild('customer');
$customer->addChild('title', 'Mr');
$customer->addChild('firstname', 'Joe');
$customer->addChild('surname', 'Bloggs');
$customer->addChild('email', 'Email');
// Query the TourCMS API, creating the booking
$result = $tourcms->start_new_booking($booking, $channel);
$bkg = $result->booking;
// Display the temporary booking ID
print "Temporary booking ID: " . $bkg->booking_id . "<br />";
// Check whether any components were unavailable
// Non-zero would indicate some items sold out since "Check availability"
print $bkg->unavailable_component_count . " unavailable components";
Temporary booking ID: 123456
0 unavailable components
C# examples use the .Net Client Library
XmlDocument StartNewBooking (XmlDocument bookingData, int channelId)
VB examples use the .Net Client Library
XmlDocument StartNewBooking (XmlDocument bookingData, Integer channelId)
NodeJS examples use the NodeJS Wrapper
TourCMS.startNewBooking({
channelId: 3930,
booking: {
booking_key: "BOOKING_KEY_HERE",
total_customers: 1,
components: {
component: [
{
component_key: "COMPONENT_KEY_HERE",
}
]
}
},
callback: function(response) {
console.log(response.booking.booking_id);
}
});
12345
Looking for sample code in a different language? TourCMS and community provided API libraries
Enter your TourCMS API credentials below to call the Start new booking endpoint.
Provide a component_key obtained via Check Tour Availability to book that component.
Operators (Marketplace Agent ID 0) will need to provide a value for booking_key (more info), agents must remove that node from the XML.
Take care, submitting this form will modify live data!
There are no querystring parameters.
The following fields can be posted as XML when calling the API, if the API is being used by a Tour Operator then a valid booking_key must be provided (see Getting a new booking key).
XML Node | Notes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
booking |
The root XML element
|
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. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
supplier_subsystem _error |
If the <error> is "SUPPLIER_SUBSYSTEM_ERROR", indicating an issue starting the booking in a supplier subsystem then TourCMS will provide more information on the error that was experienced. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
supplier_subsystem _message |
If the <error> is "SUPPLIER_SUBSYSTEM_ERROR", indicating an issue starting the booking in a supplier subsystem and if the subsystem has provided a textual explanation it will be included here. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
errors |
This node will be returned if the tour has retricted fields and there are errors:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
booking |
If the temporary booking was created there will be a booking node containing the following:
|