index

getAvailabilities JSON


Instructions

Post JSON data here to get availability and price information for a room, property or account

See here for information about using the JSON API.

The getAvailabilites parameters checkIn, (one of lastNight or checkOut) and (one of roomId, propId or ownerId) are required.

To return a price at least one of numAdult or numChild should be specified.

apiKey and propKey are not required to authenticate access to this function.

If both lastNight and checkOut are specified, lastNight will be ignored.

Example Data

Return price and availability for the following parameters

{
    "checkIn": "20160501",
    "checkOut": "20160503",
    "propId": "3103",
    "numAdult": "2",
    "numChild": "0"
}

Normally only one of roomId, propId or ownerId should be used, the results will be limited to the most specific criteria used.

Specifying offerId will limit the results to only that offer number. (1 to 4)

ignoreAvail = true will return prices even if the room has no availability

All possible parameters:

{
    "checkIn": "20151001",
    "lastNight": "20151002",
    "checkOut": "20151003",
    "roomId": "12345",
    "propId": "1234",
    "ownerId": "123",
    "numAdult": "2",
    "numChild": "0",
    "offerId": "1",
    "voucherCode": "",
    "ignoreAvail": false
}

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 the availability for one property with the specified parameters. 
* Change the propId and other parameters to values for your account to use and test.
*/

$data = array();
$data["checkIn"] = "20160501";
$data["checkOut"] = "20160503";
$data["propId"] = "3103";
$data["numAdult"] = "2";
$data["numChild"] = "0";

$json = json_encode($data);

$url = "https://api.beds24.com/json/getAvailabilities";

$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;	

?>