home > support > API > making a connection

Making a connection

If you are connecting to the TourCMS API using PHP, .NET, JavaScript, Ruby or Python then you may find it easier to use one of the existing client libraries rather than rolling your own code.

RESTful API

The TourCMS Marketplace is a RESTful (REpresentational STate) XML based API which allows you to read (and possibly write) certain resources within TourCMS accounts that grant you access permissions.

Put simply: To call API methods you will be requesting a URL (with header information for authentication), possibly with querystring parameters and receiving back an XML document. In general calls that read information will be sent via HTTP GET and those that modify information will be sent via HTTP POST.

A full list of URLs (methods) that you can call plus the responses you will get back is available on the main API page.

Connection concept

The TourCMS Marketplace lets you connect to multiple individual TourCMS accounts via a single API. Marketplace agents accessing multiple accounts can use the /p/ (Partner) style calls as well as the /c/ style API.

Individual TourCMS accounts may only call the /c/ (Channel) style API calls (i.e. can only access their own data).

Each channel (think of a channel as a single company) has a Channel ID.
Each Marketplace agent has a Marketplace Account ID (MAID).

To connect as Marketplace Agent 10.
  • Send MAID 10, Channel ID 0 - for the /p/ top level agent API calls
  • Send MAID 10, Channel ID 20 - for the /c/ channel specific API calls to take data out of Channel 20
For individual TourCMS accounts (/c/ API calls only)
  • Send MAID 0, Channel ID 20 - for the /c/ channel specific API calls

Authentication headers

Authentication is handled by passing in two special headers when making any request to the API:

  • x-tourcms-date: The GMT date/time the request was generated
  • Authorization: The text "TourCMS " and then three values separated by colons (Channel ID:Marketplace account ID:Signature)
    • Channel ID - Can be 0 if you are a Marketplace agent searching multiple accounts.
    • Marketplace Account ID - Your unique ID number, for Individual Operator accounts this should be left as 0
    • Signature - See "Signature Generation" section below.

Example headers

x-tourcms-date: Thu, 05 Aug 2010 10:51:29 GMT
Authorization: TourCMS 0:1:rJaU8iuQlVWlHNi7sbAN187ziY63qIedWSFluEm4PKI%3D

Signature Generation

This section will be updated fully shortly however in the meantime for a reference implementation please see the generate_signature function in the PHP Client Library.

Other headers

Ensure Content-Type is set to application/xml.