Retrieving availability, price and minimum length of stay - http://xml.tobook.com/retrieveAvailability.asp
- Description
- Prerequisites
- Request XML - Structure
- Request XML - Example
- Response XML - Structure
- Response XML - Example
Description
This function can be used for retrieving availability information, such as number of available rooms, rates, minimum length of stay (MLOS), belonging to the given roomtypes.
Click here to see a demo of this function.
Prerequisites
A valid username with the corresponding password used for logging in to toBook.com.
A unique ID of the hotel in the system of toBook.com.
The ID and name of at least one roomtype.
Request XML - Structure
When ChainID is submitted, username and password must belong to the hotelchain, otherwise to the specific hotel.
| Node | Attribute | Data type | Field type | Description |
|---|---|---|---|---|
| Request | ||||
| Authentication | ||||
| Username | String | Mandatory | Username used for login | |
| Password | String | Mandatory | Password used for login | |
| ChainID | Integer | Optional | Unique ID of the hotelchain in the toBook.com system. | |
| HotelID | Integer | Mandatory | Unique ID of the hotel in the toBook.com system. | |
| RoomType | ||||
| ID | Integer | Mandatory | Unique ID of the roomtype in the toBook.com system. | |
| Name | String | Mandatory | Name of the roomtype in the toBook.com system. | |
| StartDate | Date | Mandatory | Beginning date of the requested period, given in YYYY-MM-DD format | |
| EndDate | Date | Mandatory | End date of the requested period, given in YYYY-MM-DD format |
Request XML - Example
<?xml version="1.0" encoding="utf-8" ?>
<Request>
<Authentication>
<Username>gentest</Username>
<Password>gen2008</Password>
<ChainID>46</ChainID>
<HotelID>463</HotelID>
</Authentication>
<RoomType ID="1958" Name="Double"></RoomType>
<RoomType ID="1959" Name="Extra large triple with french bed"></RoomType>
<StartDate>2009-07-20</StartDate>
<EndDate>2009-07-22</EndDate>
</Request>
Response XML - Structure
If the submitted Username / Password / ChainID are valid, the response contains the availability information (number of available rooms, rates and minimum length of stay) for the given time period.
| Node | Attribute | Data type | Field type | Description |
|---|---|---|---|---|
| Response | ||||
| ChainID | Integer | Optional | Unique ID of the hotelchain in the toBook.com system | |
| HotelID | Integer | Mandatory | Unique ID of the hotel in the toBook.com system | |
| Currency | String | Mandatory | Currency of the hotel in the toBook.com system. | |
| Status | String | Mandatory | Result of the request. | |
| RoomType | ||||
| ID | Integer | Mandatory | Unique ID of the roomtype in the toBook.com system | |
| Name | String | Mandatory | Name of the roomtype | |
| Date | Mandatory | |||
| ID | Date | Mandatory | ||
| MLOS | Integer | Mandatory | Minimum length of stay | |
| Rate | Float | Mandatory | The value of rate in the toBook.com system. | |
| Availability | Integer | Mandatory | Number of rooms available in the toBook.com system. |
If the validation prcoess fails, the response contains a short description of the error.
| Node | Data type | Field type | Description |
|---|---|---|---|
| Response | Mandatory | ||
| ErrorDesc | String | Mandatory | Short description of the error (eq. "Could't parse the received XML.", "Login failed, check Username, Password, HotelID or ChainID nodes.") |
| Status | String | Mandatory | Result of the request. |
Response XML - Example
<?xml version="1.0" encoding="utf-8" ?>
<Response>
<ChainID>46</ChainID>
<HotelID>463</HotelID>
<Currency>EUR</Currency>
<Status>Success</Status>
<RoomType ID="1958" Name="Double">
<Date ID="2009-07-20">
<MLOS>2</MLOS>
<Rate>120</Rate>
<Availability>4</Availability>
</Date>
<Date ID="2009-07-21">
<MLOS>2</MLOS>
<Rate>120</Rate>
<Availability>4</Availability>
</Date>
<Date ID="2009-07-22">
<MLOS>2</MLOS>
<Rate>120</Rate>
<Availability>4</Availability>
</Date>
</RoomType>
<RoomType ID="1959" Name="Extra large triple with french bed">
<Date ID="2009-07-20">
<MLOS>2</MLOS>
<Rate>160</Rate>
<Availability>5</Availability>
</Date>
<Date ID="2009-07-21">
<MLOS>2</MLOS>
<Rate>160</Rate>
<Availability>5</Availability>
</Date>
<Date ID="2009-07-22">
<MLOS>2</MLOS>
<Rate>160</Rate>
<Availability>5</Availability>
</Date>
</RoomType>
</Response>
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<ErrorDesc>Could't parse the received XML.</ErrorDesc>
<Status>Failure</Status>
</Response>
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<ErrorDesc>Login failed, check Username, Password, HotelID or ChainID nodes.</ErrorDesc>
<Status>Failure</Status>
</Response>