Boards

In this section we will see how to push and pull the boards of your properties.

Get the boards

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

To get the boards, use the following function:

GetBoards(user, password, token, propertyID)

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 GetBoards(String username, String password, String token, Int propertyID) throws Exception {
  Vector params = new Vector();
  params.addElement(username);
  params.addElement(password);
  params.addElement(token);
  params.addElement(propertyID);
  Object[] objects = (Object[]) xmlRpcClient.execute(config, "GetBoards", 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')
);
$message = new xmlrpcmsg('xrws.GetBoards', $args);
$result = $server->send($message);
$struct = $result->value();
?>

This function returns the list of all the active boards for the current property. The boards are represented by a <tag>value</tag> structure. This is an example:


<boards>
	<board>
		<propertyID>23790</propertyID>
		<periodID>1</periodID>
		<unitID>1</unitID>
		<breakfast>0</breakfast>
		<halfboard>35</halfboard>
		<fullboard>70</fullboard>
	</board>
	<board>
		<propertyID>23790</propertyID>
		<periodID>2</periodID>
		<unitID>1</unitID>
		<breakfast>0</breakfast>
		<halfboard>40</halfboard>
		<fullboard>80</fullboard>
	</board>
</boards>

Create new boards

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

To create new boards, use the following function:

CreateBoards(user, password, token, propertyID, boards)

The parameter rates must be a string encoded in a precise format (in the next paragraph you will see how). Here are examples of how your code should be:


/** java /*	
public String CreateBoards(String username, String password, String token, Int propertyID, String boards) throws Exception {
  Vector params = new Vector();
  params.addElement(username);
  params.addElement(password);
  params.addElement(token);
  params.addElement(propertyID);
  params.addElement(boards);
  Object[] objects = (Object[]) xmlRpcClient.execute(config, "CreateBoards", 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($boards, 'string')
);
$message = new xmlrpcmsg('xrws.CreateBoards', $args);
$result = $server->send($message);
$struct = $result->value();
?>

How to correctly encode the boards

Given a multi-dimensional array of boards, that your system will produce, you must include the following parameters:

  • unitID is the unit identifier (to which the boards refer)
  • periodID is the period identifier (to which the boards refer)
  • breakfast is the price of the breakfast (set to zero if you want to include it in the base rate)
  • halfboard is the price of the half board (set to zero if you want to include it in the base rate)
  • fullboard is the price of the full board (set to zero if you want to include it in the base rate)

Your boards string must look like this:


[boards]
	[board]
		[unitID]1[/unitID]
		[periodID]1[/periodID]
		[breakfast]0[/breakfast]
		[halfboard]35[/halfboard]
		[fullboard]70[/fullboard]
	[/board]
	[board]
		[unitID]1[/unitID]
		[periodID]2[/periodID]
		[breakfast]0[/breakfast]
		[halfboard]40[/halfboard]
		[fullboard]80[/fullboard]
	[/board]
[/boards]

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

Update boards

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

To update rates, use the following function:

UpdateBoards(user, password, token, propertyID, boards)

Here is an example of how your code should be:


/** java /*	
public String UpdateBoards(String username, String password, String token, Int propertyID, String boards) throws Exception {
  Vector params = new Vector();
  params.addElement(username);
  params.addElement(password);
  params.addElement(token);
  params.addElement(propertyID);
  params.addElement(boards);
  Object[] objects = (Object[]) xmlRpcClient.execute(config, "UpdateBoards", 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($boards, 'string')
);
$message = new xmlrpcmsg('xrws.UpdateBoards', $args);
$result = $server->send($message);
$struct = $result->value();
?>

How to correctly encode the boards

Given a multi-dimensional array of boards, that your system will produce, you must include the following parameters:

  • unitID is the unit identifier (to which the boards refer)
  • periodID is the period identifier (to which the boards refer)
  • breakfast is the new price of the breakfast (set to zero if you want to include it in the base rate)
  • halfboard is the new price of the half board (set to zero if you want to include it in the base rate)
  • fullboard is the new price of the full board (set to zero if you want to include it in the base rate)

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