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

ignoreHidden = false will include rooms with sellPriority set to hidden

Rooms and properties can be limited to only those specified in the arrays roomIds and propIds, note, the propId or ownerId parameter must still be specified.

All possible parameters:

{
    "checkIn": "20151001",
    "lastNight": "20151002",
    "checkOut": "20151003",
    "roomId": "12345",
    "propId": "1234",
    "ownerId": "123",
    "numAdult": "2",
    "numChild": "0",
    "offerId": "1",
    "voucherCode": "",
    "referer": "",
    "agent": "",
    "apisource": "0",
    "ignoreAvail": false,
    "ignoreHidden": true,
    "propIds": [
        1235,
        1236
    ],
    "roomIds": [
        12347,
        12348,
        12349
    ]
}

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 = "http://soft.4twa.com/api/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;	

?>