Guests

In this section we will see how to manage the guests of your properties.

Get the guests

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

To get the list of guests who booked your property, use the following function:

GetGuests(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 GetGuests(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, "GetGuests", 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.GetGuests', $args);
$result = $server->send($message);
$struct = $result->value();
?>

This function returns the list of guests, identified by their e-mail address. The guests are represented by a <tag>value</tag> structure. This is an example:


<guests>
	<guest>
		<email>guest@bookingbnb.com</email>
		<name>Jane</name>
		<surname>Doe</surname>
		<sex>f</sex>
		<birthday>1980-02-01</birthday>
		<address>140 South Beach Blvd, Miami, FL 33137, United States</address>
		<city>Miami</city>
		<country>US</country>
		<telephone>+12736289237</telephone>
		<language>en</language>
	</guest>
<guests>

Create new guests

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

To create new guests, use the following function:

CreateGuests(user, password, token, propertyID, guests)

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

How to correctly encode the guests

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


$guests[0][email]="guest@bookingbnb.com";
$guests[0][name]="Jane";
$guests[0][surname]="Doe";
$guests[0][sex]="f";
$guests[0][birthday]="1980-02-01";
$guests[0][address]="140 South Beach Blvd, Miami, FL 33137, United States";
$guests[0][city]="Miami";
$guests[0][country]="US";
$guests[0][telephone]="+12736289237";
$guests[0][language]="en";

$guests[1][email]="newguest@bookingbnb.com";
$guests[1][name]="Marcus";
$guests[1][surname]="Smith";
$guests[1][sex]="m";
$guests[1][birthday]="1978-04-04";
$guests[1][address]="280 North Beach Blvd, Los Angeles, CA 33137, United States";
$guests[1][city]="Los Angeles";
$guests[1][country]="US";
$guests[1][telephone]="+132798743974";
$guests[1][language]="en";

Your guests string must look like this:


[guest]
	[email]guest@bookingbnb.com[/email]
	[name]Jane[/name]
	[surname]Doe[/surname]
	[sex]f[/sex]
	[birthday]1980-02-01[/birthday]
	[address]140 South Beach Blvd, Miami, FL 33137, United States[/address]
	[city]Miami[/city]
	[country]US[/country]
	[telephone]+12736289237[/telephone]
	[language]en[/language]
[/guest]
[guest]
	[email]newguest@bookingbnb.com[/email]
	[name]Marcus[/name]
	[surname]Smith[/surname]
	[sex]m[/sex]
	[birthday]1978-04-04[/birthday]
	[address]280 North Beach Blvd, Los Angeles, CA 33137, United States[/address]
	[city]Los Angeles[/city]
	[country]US[/country]
	[telephone]+132798743974[/telephone]
	[language]en[/language]
[/guest]

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

Update guests

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

To update guests, use the following function:

UpdateGuests(user, password, token, propertyID, guests)

Here is an example of how your code should be:


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

How to correctly encode the guests

To update a guest, encode it with the same parameters you use to create one.

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