home > support > API > remove booking component

Remove booking component

Remove a tour from a regular (i.e. non-temporary, non-archived) booking.

REST info

Endpoint/c/booking/component/delete
FormatsXML
ExampleURL: /c/booking/component/delete.xml
 
POST data:
<?xml version="1.0"?>
<booking>
	<booking_id>12345</booking_id>
	<component>
		<component_id>1</component_id>
	</component>
</booking>
VerbPOST


 Code samples

PHP examples use the PHP Client Library with SimpleXML

Description

object booking_remove_component ( SimpleXmlElement $component_data, int $channel )


Parameters

$component_data
SimpleXmlElement containing the tour data
$channel
ID number for the channel the booking is being made with

Example


// 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 remove, obtained from the Show booking API
$component->addChild('component_id' 'COMPONENT_ID_HERE');

// Query the TourCMS API, removing a tour from a regular (i.e. non-temporary, non-archived) booking
$result = $tourcms->booking_remove_component($component_data, $channel);

// Check the result, will be "OK" if the tour was removed
switch ($result->error) {
    case "OK":
		// Print a success message
	    print "Thanks, your tour has been removed.";
	    break;
	default:
		// Some other problem (could check error to see what)
	    print "Sorry, unable to remove the tour at this time.";
	    break;
}
			

Thanks, your tour has been removed.
			

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

Example

// Remove a component from a booking
TourCMS.removeBookingComponent({
    channelId: 3930,
    booking: {
      booking_id: 12920,
      component: {
          component_id: 8286001
      }
    },
    callback: function(response) {
      console.log(response.error);
    }
  });
OK

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


 Post fields

Post fields
XML NodeNotes
booking

The root XML element

XML NodeNotes
booking_idThe ID for the booking the component is on
component_idThe ID for the component to remove, obtained from the Show booking API

 
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.

More information