Get Rates

Example on how to Get Rates for a Villa

Post Request data

Name Type Description
villa_id Integer Id of the Villas you want to retrieve info on.

This sample code is written in PHP:


$url = 'https://api.wthvillas.com/api/v1/rates';
$data = array('villa_id' => "123");
$data_string = $data;

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(                                                                          
	'Authorization: Bearer YourTokenGoesHere'                                                                      
);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");   
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST,count($data));
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);

$response = curl_exec($curl);

curl_close($curl);
$returnData = json_decode($response, true);
print_r($returnData);
    	

Response example data


{
    "response": "success",
    "rates": [
        {
            "date_from": "2019-04-28",
            "date_to": "2019-11-22",
            "bedrooms": 5,
            "nightly_rate": 1286,
            "weekly_rate": 9002,
            "min_stay": 5,
            "note": ""
        },
        {
            "date_from": "2019-11-23",
            "date_to": "2019-11-30",
            "bedrooms": 5,
            "nightly_rate": 1571,
            "weekly_rate": 10997,
            "min_stay": 7,
            "note": "Thanksgiving"
        },
        {
            "date_from": "2019-12-01",
            "date_to": "2019-12-14",
            "bedrooms": 5,
            "nightly_rate": 1286,
            "weekly_rate": 9002,
            "min_stay": 5,
            "note": ""
        },
        {
            "date_from": "2019-12-15",
            "date_to": "2019-12-20",
            "bedrooms": 5,
            "nightly_rate": 1643,
            "weekly_rate": 11501,
            "min_stay": 7,
            "note": ""
        },
        {
            "date_from": "2019-12-21",
            "date_to": "2019-12-27",
            "bedrooms": 5,
            "nightly_rate": 3000,
            "weekly_rate": 21000,
            "min_stay": 7,
            "note": "Christmas rates apply to any 7 night booking that includes Christmas Day"
        },
        {
            "date_from": "2019-12-28",
            "date_to": "2020-01-04",
            "bedrooms": 5,
            "nightly_rate": 3150,
            "weekly_rate": 22050,
            "min_stay": 7,
            "note": "New Year’s rates apply to any 7 night booking that includes New Year’s Eve"
        },
        {
            "date_from": "2019-01-03",
            "date_to": "2019-04-19",
            "bedrooms": 5,
            "nightly_rate": 1643,
            "weekly_rate": 11501,
            "min_stay": 7,
            "note": ""
        },
        {
            "date_from": "2019-04-20",
            "date_to": "2019-04-27",
            "bedrooms": 5,
            "nightly_rate": 1643,
            "weekly_rate": 11501,
            "min_stay": 7,
            "note": "Easter*"
        },
        {
            "date_from": "2020-01-05",
            "date_to": "2020-04-20",
            "bedrooms": 5,
            "nightly_rate": 1714,
            "weekly_rate": 11998,
            "min_stay": 7,
            "note": ""
        }
    ]
}