Calendars

BookingBnb supports a very easy way to automatically update availability through iCal calendars.

Supported calendars

You can import in the BookingBnb system iCal calendars and other calendars from travel portals like Airbnb and Booking.com, using the CreateCalendars function.

URL: https://api.bookingbnb.com/xrws/CreateCalendars/

CreateCalendars(user, password, token, calendars)

How to correctly encode the calendars

Given a multi-dimensional array of periods, that your system will produce, you must include the following parameters: where propertyID is the property identifier, unitID is the unit identifier, type is the type of calendar you want to import (it can be airbnb, bookingcom or ical), url is the calendar URL.


  $calendars[0][propertyID]=128902;
  $calendars[0][unitID]=1;
  $calendars[0][type]="bookingcom";
  $calendars[0][url]="https://admin.booking.com/hotel/hoteladmin/ical.html?t=V_Za3hNXMQFEeSaLBUnKzidJJqhvISu8Iz2_07FWUsqCLjHMD9ydzYcJO626me3-VyMWkqBz_dY9-1cXBsh4GFOnOHjBzbYGFTwyMLwUlHYdmqZDamhJw26y1GQSWsW3eQfLp9RGzhN1Bh8X";
  $calendars[1][propertyID]=128902;
  $calendars[1][unitID]=2;
  $calendars[1][type]="airbnb";
  $calendars[1][url]="https://www.airbnb.com/calendar/ical/123456789.ics?s=b85729d214b16b56d36d790b1019ea7c";

Your calendars string must look like this:


[calendar]
	[propertyID]128902[/propertyID]
	[unitID]1[/unitID]
	[type]bookingcom[/type]
	[url]https://admin.booking.com/hotel/hoteladmin/ical.html?t=V_Za3hNXMQFEeSaLBUnKzidJJqhvISu8Iz2_07FWUsqCLjHMD9ydzYcJO626me3-VyMWkqBz_dY9-1cXBsh4GFOnOHjBzbYGFTwyMLwUlHYdmqZDamhJw26y1GQSWsW3eQfLp9RGzhN1Bh8X[/url]
[/calendar]
[calendar]
	[propertyID]128902[/propertyID]
	[unitID]2[/unitID]
	[type]airbnb[/type]
	[url]https://www.airbnb.com/calendar/ical/123456789.ics?s=b85729d214b16b56d36d790b1019ea7c[/url]
[/calendar]

The availability is automatically updated every 2 hours by default, but you can easily change this frequence in your code. You just need to call the UpdateCalendars function whenever you want the availability to be updated immediately.

Update the calendars

URL: https://api.bookingbnb.com/xrws/UpdateCalendars/

UpdateCalendars(user, password, token, propertyID, calendars)

The arguments user and password are the credentials that a partner uses to enter the BookingBnb Control Panel. The argument token is the one our partners acquire when they register to our system. The argument propertyID is the identification number of the current property. To retrieve this ID, use the BookingBnb function GetProperties.

Here is an example of how your code should be:


/** java /*	
public String UpdateCalendars(String username, String password, String token, Int propertyID, String calendars) throws Exception {
  Vector params = new Vector();
  params.addElement(username);
  params.addElement(password);
  params.addElement(token);
  params.addElement(propertyID);
  params.addElement(calendars);
  Object[] objects = (Object[]) xmlRpcClient.execute(config, "UpdateCalendars", params);
  return (String) objects[1];
}

/* php */
<?php
include("xmlrpc.inc");
$server = new xmlrpc_client($url);
$args = array(
	new xmlrpcval($user, 'string'), 
	new xmlrpcval($pass, 'string'), 
	new xmlrpcval($token, 'string'), 
	new xmlrpcval($propertyID, 'int'), 
	new xmlrpcval($calendars, 'string')
);
$message = new xmlrpcmsg('xrws.UpdateCalendars', $args);
$result = $server->send($message);
$struct = $result->value();
?>

The function returns a status code, it can be ok or ko.

Get the calendars

To retrieve the list of the updated calendars for a given property, call the GetCalendars function.

URL: https://api.bookingbnb.com/xrws/GetCalendars/

GetCalendars(user, password, token, propertyID)

This function returns the list of your calendars, each with the ID of the unit related do it. The calendars are represented by a <tag>value</tag> structure. This is an example:


<calendars>
	<calendar>
		<id>237</id>
		<propertyID>128902</propertyID>
		<unitID>1</unitID>
		<updated>2019-08-22 02:23:51</updated>
		<type>bookingcom</type>
		<url>https://admin.booking.com/hotel/hoteladmin/ical.html?t=V_Za3hNXMQFEeSaLBUnKzidJJqhvISu8Iz2_07FWUsqCLjHMD9ydzYcJO626me3-VyMWkqBz_dY9-1cXBsh4GFOnOHjBzbYGFTwyMLwUlHYdmqZDamhJw26y1GQSWsW3eQfLp9RGzhN1Bh8X</url>
	<calendar>
	<calendar>
		<id>238</id>
		<propertyID>128902</propertyID>
		<unitID>2</unitID>
		<updated>2019-08-22 02:23:51</updated>
		<type>airbnb</type>
		<url>https://www.airbnb.com/calendar/ical/123456789.ics?s=b85729d214b16b56d36d790b1019ea7c</url>
	<calendar>
<calendars>
Please, note that datetime is in the UTC time zone.