index

getBookings JSON


Instructions

Post JSON data here to get bookings from a property.

See here for information about using the JSON API.

The getBookings parameters roomId, bookId, arrivalFrom, arrivalTo, departureFrom, departureTo and modifiedSince are all optional and can be used to limit the returned bookings to the specified values.

If not specified, arrivalFrom defaults to yesterday and arrivalTo defaults to plus one year from the current day.

Credit card information is not available.

Bookings will have a status field containing an integer with the following meanings

Example Data

All bookings in property

When not otherwise specified the date range is for arrivals from yesterday to one year from now.
{
    "authentication": {
        "apiKey": "apiKeyAsSetInAccountSettings",
        "propKey": "propKeyAsSetForTheProperty"
    },
    "includeInvoice": false,
    "includeInfoItems": false
}

Specific bookings

Using Optional parameters, returned bookings will match every optional parameter value
{
    "authentication": {
        "apiKey": "apiKeyAsSetInAccountSettings",
        "propKey": "propKeyAsSetForTheProperty"
    },
    "roomId": "12345",
    "bookId": "12345678",
    "masterId": "12345678",
    "arrivalFrom": "20141001",
    "arrivalTo": "20151001",
    "departureFrom": "20141001",
    "departureTo": "20151201",
    "modifiedSince": "20131001 12:30:00",
    "includeInvoice": false,
    "includeInfoItems": 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.
*/

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

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

/* Restrict the bookings using any combination of the following */
$data['roomId'] = '12345';
$data['bookId'] = '12345678';
$data['masterId'] = '12345678';
$data['arrivalFrom'] = '20141001';
$data['arrivalTo'] = '20151001';
$data['departureFrom'] = '20141001';
$data['departureTo'] = '20151201';
$data['modifiedSince'] = '20131001 12:30:00';
$data['includeInvoice'] = false;
$data['includeInfoItems'] = false;

$json = json_encode($data);

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

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

?>