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. Additionally a limit and offset value can be specified to limit the returned bookings. The maximum number of bookings that can be returned is 1000.

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

The includeInvoice parameter will include the booking invoice items with the booking when set. This is only available if the number of bookings returned is less than 100.

The includeInfoItems parameter will include the booking info items for each booking when set, includeInfoItemsConverted will show the converted value of any template variables in the info item text. This is only available if the number of bookings returned is less than 100.

The includeStripeCharges parameter will include an object containing all charges stored in Stripe connected to this bookings Stripe customer. This is only available on one booking at a time, the booking must be requested using the bookId parameter. This is only available if the number of bookings returned is less than 100.

Bookings can be further filtered by an optional seachText which needs to be in any of the booking fields. (for example email or guest name)

Credit card information is not available.

Booking status values

Booking substatus values

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",
    "searchText": "",
    "includeInvoice": false,
    "includeInfoItems": false,
    "includeInfoItemsConverted": false,
    "includeStripeCharges": false,
    "status": "1",
    "limit": "100",
    "offset": "0"
}

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;
$data['includeInfoItemsConverted'] = false;
$data['status'] = '1';

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

?>