home > support > API > update booking component
Change some details of a particular booking component (tour/option/fee)
Designed to be used by tour operators only, Marketplace Agents cannot update booking components.
Endpoint | /c/booking/component/update |
Formats | XML |
Example | URL: /c/booking/component/update.xml POST data:
|
Verb | POST |
PHP examples use the PHP Client Library with SimpleXML
object booking_update_component ( SimpleXmlElement $component_data, int $channel )
// Set the channel this booking will be made with
$channel = 3930;
// Start building the booking XML
$component_data = new SimpleXMLElement('<booking />');
// Set the ID for the booking the tour is on
$component_data->addChild('booking_id', 'BOOKING_ID_HERE');
// Add a component node
$component = $component_data->addChild('component');
// Set the ID for the tour to update, obtained from the Show booking API
$component->addChild('component_id', 'COMPONENT_ID_HERE');
// Set the quantity for the tour to update
$component->addChild('sale_quantity','QUANTITY_HERE');
// Query the TourCMS API, updating a tour, option or fee from a regular (i.e. non-temporary, non-archived) booking
$result = $tourcms->booking_update_component($component_data, 3930);
// Check the result, will be "OK" if the tour was updated
switch ($result->error) {
case "OK":
// Print a success message
print "Thanks, your booking component (tour/option/fee) has been updated.";
break;
default:
// Some other problem (could check error to see what)
print "Sorry, unable to update the tour at this time.";
print $result->error;
break;
}
Thanks, your booking component (tour/option/fee) has been updated.
C# examples use the .Net Client Library
Code sample here soon
VB examples use the .Net Client Library
Code sample here soon
NodeJS examples use the NodeJS Wrapper
// Update a component to a booking
TourCMS.updateBookingComponent({
channelId: 3930,
booking: {
booking_id: 12920,
component: {
component_id: 8286216,
sale_quantity: 3
}
},
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 Update Booking Component endpoint.
Take care, submitting this form will modify live data!
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. |