home > support > API > Marketplace API > managing dates & prices externally > create new departure

Create new departure

Create a new departure on a Tour

Part of a series of API calls intended largely for managing dates and prices outside of TourCMS


Notes

For Tour Operator usage only (not accessible by Marketplace Agents)

REST info

Endpoint/c/tour/datesprices/dep/manage/new
FormatsXML
Example/c/tour/datesprices/dep/manage/new.xml
 
POST data:
<?xml version="1.0"?>
<departure>
  <tour_id>1</tour_id>
  <start_date>2017-11-22</start_date>
  <end_date>2017-11-22</end_date>
  <code>13:00-16:00</code>
</departure>
VerbPOST

Code samples

PHP examples use the PHP Client Library with SimpleXML

Description

object create_departure ( SimpleXmlElement $departure_data , int $channel )


Parameters

$departure_data
SimpleXmlElement containing the raw departure information
$channel
The Channel that the tour belongs to

Example

// Set our Channel ID
$channel = 3930;

// Start building the departure XML
$departure = new SimpleXMLElement('<departure />');

// Set the Tour this departure should be added to
$departure->addChild('tour_id', 1);

// Set the start and end date
$departure->addChild('start_date', '2012-11-22');
$departure->addChild('end_date', '2012-11-22');

// Set the code, in this example using the standard TourCMS time format
$departure->addChild('code', '13:00-16:00');

// Append a container for the components to be booked
// Rates for a Tour can be found via the "Show Tour" API method
$rates = $departure->addChild('rates');

// Here we'll just use one rate as an example
$rate = $departure->addChild('rate');

// Use the correct Rate ID
$rate->addChild('rate_id', 'r1');

// Set the customer price
// The currency for this will be the account base currency
$rate->addChild('customer_price', '100');

// Set the cost price
// The currency for this will be the cost currency configured on the Tour
$rate->addChild('supplier_cost', '90');

// Query the TourCMS API, creating the departure
$result = $tourcms->create_departure($departure , $channel);

if($result->error == "OK") {
	print "Departure created, the ID is: ";
	print $result->tour->departure_id;
} else {
	print $result->error;
}
Departure created, the ID is: 12345

C# examples use the .Net Client Library

Coming soon

VB examples use the .Net Client Library

Coming soon

Querystring parameters

There are no querystring parameters.

Post fields

The following fields can be posted as XML when calling this API method.

At a bare minimum the tour_id, start_date and end_date must be provided.

Post fields
XML NodeNotes
departure

A departure containing:

XML NodeNotes
tour_idThe Tour that the departure should be added to.
codeDeparture code. May be in format 09:00-17:00 for day tours with specific time. To automatically have start_time and end_time populated populated the tour will need to have the Multiple start & end times option selected in the Times & Cutoffs tab of Tour CMS otherwise it will appear as text.
start_dateStart date (YYYY-MM-DD)
end_dateEnd date (YYYY-MM-DD)
noteNote for the departure (free text)
guide_language

If you would like to specify which guide languages are available, list them here:

XML NodeNotes
language Tour guide language, 2 digit, e.g. "fr".
manually_closedSet to 1 to manually close the departure, 0 (or leave) to not
spaces_blockedNumber of spaces to block off sale (e.g. spaces that can't be booked)
special_offer

To provide a discounted price for the first rate add a special offer node containing:

XML NodeNotes
offer_priceThe price for the offer. The currency should be in the base currency for the account.
offer_noteNote for the offer (free text)
rates

A rates node containing:

XML NodeNotes
rate

A rate node for each rate including:

XML NodeNotes
rate_idThe identifier for the rate. A list of Rate IDs for a particular Tour can be found via the Tour Show method
customer_priceThe customer price for the rate. In the base currency for the account
supplier_costThe supplier cost for the rate. In the cost currency set on the Tour.

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.
tour

A tour node containing the following:

XML NodeNotes
account_idAccount ID
channel_idChannel ID
tour_idTour ID
departure_idID number for the newly created departure

More information