home > support > API > Marketplace API > managing dates & prices externally > update departure
Update 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
This API is for Tour Operator usage only (not accessible by Marketplace Agents).
Controlling available spaces
If you are building a user interface to control availability (e.g. perhaps to add or remove a bus on a particular trip), then you should be adjusting spaces_blocked in the table below. The default capacity / availability starting point will be max_departure_size on show departure.
If you know how many spaces remain, you may update spaces_available. E.g. if you know there are 7 spaces available, send us 7. However this is not advisable as when we update our system, we take into account temporary bookings, so if there happen to be 2 temporary bookings that do NOT convert to real bookings (i.e. the customer does not complete their booking process), at the point those temporary bookings are released, we will update to 9 spaces available.
Multi-lingual fields
Special offer notes (offer_note) AND product notes (note) can be multi-lingual. I.e. we can have a product note that has an English and a Spanish version, sharing the same field. In this situation we use a JSON to store the two (or more) values. The key to the JSON is a 2 letter language code (i.e. all English is en, not en-US for example)
These values are language specific, not channel specific
REST info
| Endpoint | /c/tour/datesprices/dep/manage/update |
| Formats | XML |
| Example | /c/tour/datesprices/dep/manage/update.xml
POST data:<?xml version="1.0"?>
<departure>
<tour_id>1</tour_id>
<departure_id>1</departure_id>
<code>13:30-16:30</code>
</departure>
|
| Verb | POST |
Code samples
PHP examples use the PHP Client Library with SimpleXML
Description
object update_departure ( SimpleXmlElement $departure_data , int $channel )
Parameters
- $departure_data
- SimpleXmlElement containing the 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 ID for the departure to update
$departure->addChild('departure_id', 3191);
// Add in the fields that need to be updated
// In this case just the code (times)
$departure->addChild('code', '13:30-16:30');
// Query the TourCMS API, updating the departure
$result = $tourcms->update_departure($departure , $channel);
if($result->error == "OK") {
print "Departure updated";
} else {
print $result->error;
}
Departure updated
NodeJS examples use the NodeJS Wrapper
Example
TourCMS.updateDeparture({
departure: {
tour_id: 6,
departure_id: 4954,
special_offer: {
offer_price: 45,
offer_note: "Early booking discount"
}
},
callback: function(response) {
console.log(response.error);
}
});
OK
Querystring parameters
There are no querystring parameters.
Post fields
The fields that can be used are as per the Create departure method, with the addition of a departure_id node to indicate which departure to update. At a bare minimum the tour_id and departure_id must be provided.
Post fields
| XML Node | Notes |
| departure |
A departure containing:
| XML Node | Notes |
| tour_id | The Tour that the departure belongs to. |
departure_id | The Departure to update. |
| code | Departure code. May be in format 09:00-17:00 for day tours with specific time, if so the start_time and end_time fields may be populated. For start_time and end_time to be populated the tour will need to have the Multiple start & end times option selected in the Times & Cutoffs tab of Tour CMS |
| note | Note for the departure (free text) |
| supplier_note | Supplier note (can be used for holding date specific IDs from 3rd party reservation systems) |
| guide_language |
If you would like to specify which guide languages are available, list them here, one language node per language
| XML Node | Notes |
|
language
|
Tour guide language, 2 digit, e.g. "fr".
|
|
| manually_closed | Set to 1 to manually close the departure, 0 (or leave) to not |
| spaces_blocked | Number of spaces to block off sale (e.g. spaces that can't be booked). Can be negative to ADD capacity to a specific departure
Spaces here will be ignored if tour manages capacity by rate category
See notes at bottom of page |
| spaces_available | Update the number of spaces that are available. Setting this value will calculate a spaces_blocked value that will make the tour capacity remaining equal to the supplied spaces_available value. NOT be used in conjunction with spaces_blocked
Spaces here will be ignored if tour manages capacity by rate category
See notes at bottom of page |
| fixed_sale_price | For accounts with “Fixed sale price” functionality enabled, set whether this particular departure should be flagged as having a fixed sale price (overriding cost+ margin logic).
1 = fixed sale price, 0 = regular price, blank to not change |
| special_offer |
To provide a discounted price for the first rate add a special offer node containing:
| XML Node | Notes |
| offer_price | The price for the offer. The currency should be in the base currency for the account. |
| offer_note | Note for the offer (free text) |
|
| rates |
A rates node containing:
| XML Node | Notes |
| rate |
A rate node for each rate including:
| XML Node | Notes |
| rate_id | The identifier for the rate. A list of Rate IDs for a particular Tour can be found via the Tour Show method |
| customer_price | The customer price for the rate. In the base currency for the account |
| supplier_cost | The supplier cost for the rate. In the cost currency set on the Tour. |
| spaces_blocked | Only If tour has capacity per rate, Otherwise, this will return an error. API user can update the number of spaces to block off sale (e.g. spaces that can't be booked). Can be negative to ADD capacity to a specific departure
See notes at bottom of page |
| spaces_available | If tour has capacity per rate you can update the number of spaces that are available. Setting this value will calculate a spaces_blocked value that will make the rate capacity remaining equal to the supplied spaces_available value. NOT be used in conjunction with spaces_blocked
|
| tiers |
Additional field for tours with tier pricing active with information of the various tiers for this rate
| Node | Notes |
| tier |
There will be a tier node for each tier pricing linked to the departure. If the tier scales are not correct the tier price won't be updated. Containing data required:
| Node | Notes |
| scale_from |
Minimum people accepted in the tier |
| scale_to |
Maximum people accepted in the tier |
| sale_price |
Actual price of the tier for the departure |
|
|
|
|
|
Response fields
Response fields
| 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:
| XML Node | Notes |
| account_id | Account ID |
| channel_id | Channel ID |
| tour_id | Tour ID |
| departure_id | Departure ID |
|
More information