-
Notifications
You must be signed in to change notification settings - Fork 0
THH
Supplier site https://www.thailandholidayhomes.com/
THH provides several ways for interacting. One of them is XML API (working via HTTPS/HTTP protocol). The API is enough for all current Roomorama purposes.
THH has an admin site http://naga.thailandholidayhomes.com/login.php. There are a lot of useful information about the supplier (all ways of interacting descriptions, properties list, their availabilities). It also contains API documentations:
- HTML documentation with examples. In the menu:
Data Integration -> API Interface
- More details about "all properties" response XML structure. In the menu:
Manuals -> Create XML feed
All calls to THH's API must be authenticated using a key passed as usual GET parameter. The key can be found in the admin site in the menu: Data Integration -> API Interface
All THH prices are given in THB, but the API provides currency conversion service and allows currency param in the request. But
If you select another currency as THB (Thai Baht – our currency) – an extra tag is in the XML Feed: <currency_updated>…</currency_updated> All currency rates are updated 3 times a day.
So if we use USD
then almost 100% that prices will be changed by every sync. That is why we decided to use THB
To check a property availability and get the price for a given stay Concierge sends GET request to the API url with param action=availability
and other stay params:
for more details about params see API documentation.
Available Response
<response>
<available>yes</available>
<nights>8</nights>
<price>1,406</price>
<currency>USD</currency>
</response>
Not Available Response
<response>
<available>no</available>
<nights>8</nights>
<price>4,356</price>
<currency>USD</currency>
</response>
NOTE: request doesn't have guests
param so Concierge takes the property from DB and check its max_guest
value
To book a property Concierge sends GET request to the API url with param action=book
and other stay params:
for more details about params see API documentation.
Success Response
<response>
<villa_status>instant</villa_status>
<booking_status>success</booking_status>
<booking_id>80385</booking_id>
<booked_nights>8</booked_nights>
<price_total>48,000</price_total>
<currency>THB</currency>
</response>
Not available Response
<response>
<villa_status>not_available</villa_status>
<message>Property is already booked</message>
</response>
The booking is successful if booking_status=success
and villa_status=instant
, in this case Concierge saves booking_id
as reference number.
If response returns villa_status=on_request
this is not valid business case for Roomorama, but we shouldn't cancel the reservation in this case, it will be cancelled automatically by THH next 24 hours.
To cancel reservation Concierge sends GET request to the API url with param action=book_cancel
:
http://api.thailandholidayhomes.com/?key=secret_key&action=book_cancel&booking_id=66271
NOTE: there are also firstname
, lastname
params for this request in the documentation, but it works fine without them.
Success Response
<response>
<status>ok</status>
<message>Booking successfully canceled</message>
</response>
Not Successful Response
<response>
<status>false</status>
<message>Booking ID does not exist</message>
</response>
The sync process is executed by two workers:
- Properties metadata sync
Workers::Suppliers::THH::Metadata
- Properties availabilities sync
Workers::Suppliers::THH::Availabilities
Metadata
THH provides two way to get info about all the properties: XML feed and API method. On the recommendation of the support Concierge uses API method.
Metadata worker uses action data_all
:
It returns all required information about property. For more details see the documentation.
Availabilities
To get calendar info for availability worker sends GET request to the API url with param action=book_cancel
for each property:
It returns all required information about property. For more details see the documentation.
Questions:
- The API has
data_all
action to get all properties info, but at the same time Your site says:
If you run your own website you firstly need to create and download our XML Feed. This XML Feed delivers some or all of our properties with descriptions, images, rates, etc.
We start testing properties import with API and it works fine. Are there some valuable reasons to use exactly XML Feed instead of API?
2. In data_all
response we found an undocumented additional_information
tag. And there exists deposit
tag. Are we right that this is security deposit information?
3. Also we noticed that curr
parameter of request has no affect for deposit value, so the deposit is always in THB, is that correct?
4. Could you please to clarify on the way you get security deposit payment mode (credit card, cash, etc)?
5. We tried to generate XML Feed on admin site several times from several machines and didn't get success. On the third step (GENERATE XML) after pressing Generate button we saw Loader (Please wait - generation XML File is in progress) and nothing happened further. Could you advice on this?
6. Sometimes API provides different rates for the same period, could you explain this case:
<rate>
<start_date>06.04.2016</start_date>
<end_date>31.08.2016</end_date>
<title>high1</title>
<night>7,475</night>
<currency>THB</currency>
<min_nights>2</min_nights>
</rate>
<rate>
<start_date>06.04.2016</start_date>
<end_date>31.08.2016</end_date>
<title>high1</title>
<night>6,500</night>
<currency>THB</currency>
<min_nights>3</min_nights>
</rate>
Answers:
- The only reason is if you have your own xml-shceme
- Yes, "deposit" is security deposit
- Right, but this is a bug, and I hope to fix it asap
- We get security deposit by cash on customer's arrival
- XML generator is not supported now for two reasons: it generates the feed just once, so the agent shot always do it manually and the second is API provides absolutely the same and it is always up to date. So as I wrote above XML feed provided individually depending on the scheme agent has
- The rate in this case depends on min_nights value. In example below if customer books 3 nights or more he pays 6,500 THB per night, if only 2 nights - 7,475 THB per night
Tech contacts:
and CC: