Additional services

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

Get the services

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

To get the services, use the following function:

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

This function returns the list of services, identified by a ID. The services are represented by a <tag>value</tag> structure. This is an example:


<services>
	<service>
		<id>19380</id>
		<nameEN>Cleaning</nameEN>
		<descrEN>Deep cleaning of the property. All the rooms will already be clean upon your arrival.</descrEN>
		<price>50</price>
		<frequency>once</frequency>
		<minimumChoice>1</minimumChoice>
		<maximumChoice>2</maximumChoice>
		<status>activated</status>
		<increaseByUnit>no</increaseByUnit>
		<condPay>ca</condPay>
		<mandatory>yes</mandatory>
	</service>
<services>

Create new services

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

To create a new booking, use the following function:

CreateServices(user, password, token, propertyID, services)

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

How to correctly encode the services

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

  • id is the service identifier
  • nameEN is the service name (in English)
  • descrEN is the service description (in English)
  • price is the service price in the currency declared for that property
  • frequency it can be daily || weekly || monthly || yearly || once
  • minimumChoice is the minimum number of choices of the current service per each reservation
  • maximumChoice is the maximum number of choices of the current per each reservation
  • status controls if the current service is activated or deactivated
  • increaseByUnit controls if the current service is assigned to each unit listed in a reservation
  • condPay controls if the current service is payable in cash (ca) or by card (tp)
  • increaseByUnit controls if the current service is mandatory or not


  $services[0][nameEN]="Cleaning";
  $services[0][descrEN]="Deep cleaning of the property. All the rooms will already be clean upon your arrival.";
  $services[0][price]="50";
  $services[0][frequency]="once";
  $services[0][minimumChoice]=1;
  $services[0][maximumChoice]=2;
  $services[0][status]="activated";
  $services[0][increaseByUnit]="no";
  $services[0][condPay]="ca";
  $services[0][mandatory]="yes";
  $services[1][nameEN]="Private transfer from the closest airport";
  $services[1][descrEN]="We provide a private transfer with a Mercedes vehicle.";
  $services[1][price]="100";
  $services[1][frequency]="once";
  $services[1][minimumChoice]=1;
  $services[1][maximumChoice]=2;
  $services[1][status]="activated";
  $services[1][increaseByUnit]="no";
  $services[1][condPay]="tp";
  $services[1][mandatory]="no";

Your services string must look like this:


[service]
  [nameEN]Cleaning[/nameEN]
  [descrEN]Deep cleaning of the property. All the rooms will already be clean upon your arrival[/descrEN]
  [price]50[/price]
  [frequency]once[/frequency]
  [minimumChoice]1[minimumChoice]
  [maximumChoice]2[maximumChoice]
  [status]activated[/status]
  [increaseByUnit]no[increaseByUnit]
  [condPay]ca[condPay]
  [mandatory]yes[mandatory]
[/service]

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

Update services

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

To update services, use the following function:

UpdateServices(user, password, token, propertyID, services)

Your services string must look like this:


[service]
  [id]37910[/id]
  [nameEN]Cleaning[/nameEN]
  [descrEN]Deep cleaning of the property. All the rooms will already be clean upon your arrival[/descrEN]
  [price]50[/price]
  [frequency]once[/frequency]
  [minimumChoice]1[minimumChoice]
  [maximumChoice]2[maximumChoice]
  [status]activated[/status]
  [increaseByUnit]no[increaseByUnit]
  [condPay]ca[condPay]
  [mandatory]yes[mandatory]
[/service]

How to correctly encode the services

To update a service, encode it with the same parameters you use to create one and add the id parameter that refers to the service you want to update.

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