Seasons

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

Get the seasons

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

To get the seasons, use the following function:

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

This function returns the list of seasons, each with a list of periods belonging to that season, identified by a ID. The seasons are represented by a <tag>value</tag> structure. This is an example:


<seasons>
	<season>
		<id>1</id>
		<label>Low Season</label>
		<periods>
			<period>
				<id>1</id>
				<start>2019-02-01</start>
				<end>2019-03-31</end>
				<minimumStay>1</minimumStay>
			</period>
			<period>
				<id>3</id>
				<start>2019-11-01</start>
				<end>2019-12-20</end>
				<minimumStay>1</minimumStay>
			</period>
		</periods>
	</season>
	<season>
		<id>2</id>
		<label>High Season</label>
		<periods>
			<period>
				<id>2</id>
				<start>2019-06-01</start>
				<end>2019-08-31</end>
				<minimumStay>3</minimumStay>
			</period>
		</periods>
	</season>
<seasons>
Please, note that each season can have more periods. Rates refer to seasons, not periods, so all the periods belonging to a season have the same rates.

Create new seasons

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

To create new seasons, use the following function:

CreateSeasons(user, password, token, propertyID, seasons)

Here is an example of how your code should be:


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

How to correctly encode the seasons

Given a multi-dimensional array of seasons, that your system will produce, you must include the following parameter: label is the season name


  $seasons[1][label]="Low Season";
  $seasons[2][label]="Mid Season";
  $seasons[3][label]="High Season";

Your seasons string must look like this:


[season]
	[label]Low Season[/label]
[/season]
[season]
	[label]Mid Season[/label]
[/season]
[season]
	[label]High Season[/label]
[/season]

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

Update seasons

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

To update seasons, use the following function:

UpdateSeasons(user, password, token, propertyID, seasons)

Here is an example of how your code should be:


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

How to correctly encode the seasons

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

  • seasonID is the identifier of the current season
  • newSeasonID is the new season identifier (if you don't want to change it, just declare it the same as the seasonID value)
  • newLabel is the new label of the current season

Here is an example of array in php:


  $seasons[0][seasonID]=1;
  $seasons[0][newSeasonID]=1;
  $seasons[0][newLabel]="Low Season 1";
  $seasons[1][seasonID]=2;
  $seasons[1][newSeasonID]=2;
  $seasons[1][newLabel]="June";

Your periods string must look like this:


[season]
	[seasonID]1[/seasonID]
	[newSeasonID]1[/newSeasonID]
	[newLabel]Low Season 1[/newLabel]
[/season]
[season]
	[seasonID]2[/seasonID]
	[newSeasonID]2[/newSeasonID]
	[newLabel]June[/newLabel]
[/season]

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