Reviews

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

Get the reviews

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

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

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

This function returns the list of reviews, related to the guest who wrote it. The reviews are represented by a <tag>value</tag> structure. This is an example:


<reviews>
	<review>
		<id>3572593</id>
		<guestID>67575</guestID>
		<bookingID>7486407</bookingID>
		<propertyID>3368960</propertyID>
		<unitID>4</unitID>
		<experienceID>0</experienceID>
		<rating>10</rating>
		<publishedDate>2017-07-26</publishedDate>
		<reviewYear>2017</reviewYear>
		<reviewMonth>08</reviewMonth>
		<title>What a wonderful place!</title>
		<text>This is the review written by the guest. It may be a bit long or short, depending on what he has to say.</text>
		<reply>This is your reply as a host.</reply>
	</review>
<reviews>

Create new reviews

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

To create new reviews, use the following function:

CreateReviews(user, password, token, propertyID, reviews)

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

How to correctly encode the reviews

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

  • guestID is the guest identifier
  • bookingID is the booking identifier (this is not mandatory, if you don't have a value, leave it blank)
  • propertyID is the property identifier (this is not mandatory for experience reviews, if you don't have a value, set it to zero)
  • unitID is the unit identifier (this is not mandatory for experience reviews, if you don't have a value, set it to zero)
  • experienceID is the experience identifier (this is not mandatory for accommodation reviews, if you don't have a value, leave it blank)
  • rating is the general rating from 0 to 10
  • publishedDate is the publishing date, it may be post-dated to the actual date on which the stay/experience occurred
  • reviewYear is the year in which the stay/experience took place
  • reviewMonth is the month in which the stay/experience took place
  • title is the review title
  • text is the review text
  • reply is the review reply by the host

Your reviews string must look like this:


[review]
	[guestID]67575[/guestID]
	[bookingID]7486407[/bookingID]
	[propertyID]3368960[/propertyID]
	[unitID]4[/unitID]
	[experienceID]0[/experienceID]
	[rating]10[/rating]
	[publishedDate]2017-07-26[/publishedDate]
	[reviewYear]2017[/reviewYear]
	[reviewMonth]07[/reviewMonth]
	[title]What a wonderful place![/title]
	[text]This is the review written by the guest. It may be a bit long or short, depending on what he has to say.[/text]
	[reply]This is your reply as a host.[/reply]
[/review]

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

Update reviews

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

To update reviews, use the following function:

UpdateReviews(user, password, token, propertyID, reviews)

Here is an example of how your code should be:


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

How to correctly encode the reviews

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

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