index

OTA_HotelAvail

Password
Property Id
Room Id
Start Date
End Date

Instructions

general information

This function is based on the industry standards set by the OpenTravel alliance. Not all elements in the standard are supported.

Request availability information by posting a OTA_HotelAvailRQ message to this endpoint and the information will be returned as an OTA_HotelAvailRS message. The XML must validate to schema version OTA2015A.

The post must be authorized using HTTP basic authorization. The username is the propid of the property and the password (minimum 6 characters) is set in the channel manager settings for this channel.

Only one room can be requested at a time with a date range. The roomid is specified in the RoomTypeCode attribute.

A sample OTA_HotelAvailRQ using PHP and curl with the supported OTA_HotelAvailRQ attributes follows.


<?php

$username = "3103"; //propid
$password = "mysecretpassword"; //set in OTA channel manager settings
$url = "https://manage.bookingautomation.com/api/ota/OTA_HotelAvail";
$roomid = 6027; //roomid
$start = "2016-10-24"; 
$end = "2016-11-07";
$echotoken = time();

$xml = '<OTA_HotelAvailRQ xmlns="http://www.opentravel.org/OTA/2003/05" EchoToken="'.$echotoken.'" Version="1.0">
  <AvailRequestSegments>
    <AvailRequestSegment>
      <StayDateRange Start="'.$start.'" End="'.$end.'" />
      <RoomStayCandidates>
        <RoomStayCandidate RoomTypeCode="'.$roomid.'" />
      </RoomStayCandidates>
    </AvailRequestSegment>
  </AvailRequestSegments>
</OTA_HotelAvailRQ>';

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml'));
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$return = curl_exec($ch);
curl_close($ch);

header ("Content-Type: text/xml; charset=utf-8");
echo $return;

?>