index

JSON_HotelAvail


Instructions

Post JSON data here to get room price and availability.

See here for information about using the JSON API.

Example Data

{
    "authentication": {
        "apiKey": "apiKeyAsSetInAccountSettings",
        "propKey": "propKeyAsSetForTheProperty"
    },
    "roomId": 12345,
    "from": "20201126",
    "to": "20201225"
}

Request Data Fields

FieldDescriptionData TypeRequiredNotes
apiKeyapiKey for accountstringrequired
propKeypropKey for propertystringrequired
roomIdroom id for roomintegerrequired
fromfrom datedate (yyyymmdd)optionaldefault=today
toto datedate (yyyymmdd)optionaldefault=+30 days

Response Data

Response is an array of date objects for the OTA channel with the following elements

FieldDescriptionData Type
iinventoryintnumber of units available for booking
rratesobjectrates are further grouped into objects by their ratecodes
p1 - pNprices for the specified occupancynumberfor example p2 is a price for up to 2 people
mminimum stayint
mxmaximum stayint
rrestriction typeint0=stay through, 1=first night
cclosedint0=rate open, 1=rate closed
cicheckin allowedint0=no, 1=yes
cocheckout allowedint0=no, 1=yes

Sample PHP code

<?php

/*
* The following sample uses a PHP array to construct the JSON data and php-curl to post it to the API.
* This sample will get one room with the specified parameters. 
* Change the parameters to values for your account.
*/

$auth = array();
$auth['apiKey'] = 'apiKeyAsSetInAccountSettings';
$auth['propKey'] = 'propKeyAsSetForTheProperty';

$data = array();
$data['authentication'] = $auth;

$data['roomId'] = 12345;
$data['from'] = date('Ymd', strtotime('+1 day'));
$data['to'] = date('Ymd', strtotime('+30 days'));

$json = json_encode($data);

$url = "https://manage.bookingautomation.com/api/ota/JSON_HotelAvail";

$ch=curl_init();
curl_setopt($ch, CURLOPT_POST, 1) ;
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
$result = curl_exec($ch);
curl_close ($ch);
echo $result;	

?>