TourCMS, a leading online booking and channel management solution is operated by Palisis.

Contact Info

Palisis AG
Florastrasse 18A
8610 Uster
support@palisis.com
+41 44 533 40 40

Follow Us

home > support > API > Marketplace API > booking creation > get booking key

Getting a new booking key

Note this step is only required for Tour Operators (not Marketplace Agents).

Obtaining a booking key in various situations

Bookings on a public facing website
You must obtain a booking key using the process detailed below, this enables the marketplace tracking to work correctly
Booking assigned to a specific agent
Use Search Agents to obtain a booking key that represents the agent
Staff created booking not assigned to a specific agent
Set the booking key to "NO_AGENT"

Bookings on a public facing website

The process is:

  1. Call the Get booking redirect API call detailed below, redirect the users browser to the URL that TourCMS returns
  2. TourCMS processes the users cookie and redirects them back, the new booking key will be provided in the query string

The key is valid for 24 hours for that customer and there is no requirement to keep requesting the key from TourCMS within that 24 hour period. Each new customer however will require their own key. So for example you may want to request a booking key once when a customer first enters a booking process and then store it in their session.

Get booking redirect API call

This process will ensure that TourCMS picks up any Marketplace affiliate/PPC tracking information previously stored in the users browser by retrieving a cookie and recording the details alongside the newly created booking key.

Notes

Get a URL for use in retrieving a new booking key, ensures marketplace data (clicks, referrer) is maintained on the final booking / customer record.

Only for use by Tour Operators (mandatory step), not required when the API is being used by Marketplace Agents.

REST info

Endpoint/c/booking/new/get_redirect_url
FormatsXML
Example/c/booking/new/get_redirect_url.xml
 
POST data:
<?xml version="1.0"?>
<url>
  <response_url>https://example.com/step1.php</response_url>
</url>
VerbPOST

Code samples

PHP examples use the PHP Client Library with SimpleXML

Description

object get_booking_redirect_url ( SimpleXmlElement $url_data, int $channel )


Parameters

$customer_data
SimpleXmlElement containing the URL we want TourCMS to send the customer to
$channel
ID number for the channel the booking is being made with

Example

This is a two step example, the first step calls the API and then redirects the customer to TourCMS, the second step will then accept the customer back once TourCMS has finished and process the querystring parameters it has added.

Step 1: Call the API then redirect the customer to TourCMS

// Create a new SimpleXMLElement to hold the url
$url_data = new SimpleXMLElement('<url />');

// Response URL is the page we use to receive the customer back
$url_data->addChild('response_url', 'https://example.com/step2.php');

// Call TourCMS API
$result = $tourcms->get_booking_redirect_url($url_data, $channel);

// Process the redirect URL
$redirect_url = $result->url->redirect_url;

// Redirect the customer to TourCMS
header("Location: " . $redirect_url);

Step 2: TourCMS has redirected the customer back, we retrieve our key

// Retrieve the new booking Key TourCMS has generated
print "The booking key is: " . $_GET['booking_key'];
The booking key is: 0_0_12345678_1234_123abcd456fgh789123

This booking key will of course not be displayed to the customer, it is just required for Tour Operator API use when subsequently calling the Start New Booking API method.

C# examples use the .Net Client Library

Overload list

XmlDocument GetBookingRedirectUrl (XmlDocument urlData, int channelId)


Parameters

urlData
XML document containing the URL we want TourCMS to redirect back to
channelId
The channel we intend to make a booking via

VB examples use the .Net Client Library

Overload list

XmlDocument GetBookingRedirectUrl (XmlDocument urlData, Integer channelId)


Parameters

urlData
XML document containing the URL we want TourCMS to redirect back to
channelId
The channel we intend to make a booking via

NodeJS examples use the NodeJS Wrapper


Example

TourCMS.getBookingRedirectUrl({
	channelId: 3930,
  responseUrl: "http://www.example.com",
  callback: function(response) {
    console.log(response.url.redirect_url);
  }
});
https://live.tourcms.com/..........

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

Try it

Enter your TourCMS API credentials below to call the Get Booking Redirect Url endpoint.


            
            

Querystring parameters

There are no querystring parameters.

Post fields

Post fields
XML NodeNotes
url

The root XML element, must contain:

XML NodeNotes
response_urlThis is the URL that you would like TourCMS to return the customer to. This will likely be a page hosted on your website that represents the next step of the booking process.

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.
url
XML NodeNotes
redirect_urlThis is the URL that TourCMS requires you to send the customer to before you can start building their booking. TourCMS will do it's thing and then redirect the customer to the response_url you posted in your initial request.

More information