home > support > API > Marketplace API > managing dates & prices externally > 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
For Tour Operator usage only (not accessible by Marketplace Agents)
Endpoint | /c/tour/datesprices/dep/manage/new |
Formats | XML |
Example | /c/tour/datesprices/dep/manage/new.xml POST data:
|
Verb | POST |
PHP examples use the PHP Client Library with SimpleXML
object create_departure ( SimpleXmlElement $departure_data , int $channel )
// 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
string createdeparture = @"<departure>
<tour_id>1</tour_id>
<start_date>2022-11-23</start_date>
<end_date>2022-11-23</end_date>
<code>13:00-16:00</code>
<rates>
<rate>
<rate_id>r1</rate_id>
<customer_price>85</customer_price>
<supplier_cost>85</supplier_cost>
</rate>
<rate>
<rate_id>r2</rate_id>
<customer_price>85</customer_price>
<supplier_cost>85</supplier_cost>
</rate>
</rates>
</departure>";
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml(createdeparture);
XmlDocument response = myTourCMS.CreateDeparture(xdoc, 3930);
Console.WriteLine(response.OuterXml);
<?xml version="1.0" encoding="utf-8"?>
<response>
<request>POST /c/tour/datesprices/dep/manage/new.xml</request>
<error>OK</error>
<tour>
<account_id>4069</account_id>
<channel_id>3930</channel_id>
<tour_id>1</tour_id>
<departure_id>95480</departure_id>
</tour>
</response>
VB examples use the .Net Client Library
Coming soon
There are no querystring parameters.
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.
XML Node | Notes | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
departure |
A departure containing:
|
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. | tour |
A tour node containing the following:
|