getBookings API

News and new feature announcements
Post Reply
markkinchin
Site Admin
Posts: 935
Joined: Fri Mar 02, 2012 1:43 pm

For the developers and hobby programmers out there we now have a public API to download your bookings.
Booking and the related invoice information is available in XML format.
XML is a standard data format which can be opened by MS excel and many other programs.
The XML fields are self explanatory.

The URL is https://www.beds24.com/api/getbookings.xml

You can manually enter your username, password and optional date fields and save the resulting XML file to your computer.
It is also possible to automate the process by using a program to post the fields and parse the result.
moresby
Posts: 6
Joined: Thu Apr 26, 2012 4:40 pm

That's great news, I will give it a try and see how it works.
amberbb
Posts: 125
Joined: Tue Mar 20, 2012 10:12 pm
Location: Centre of New Zealand - sunny Nelson!
Contact:

markkinchin wrote:Booking and the related invoice information is available in XML format.
XML is a standard data format which can be opened by MS excel and many other programs.
The XML fields are self explanatory.
Help!

In Firefox 13.00 running under Windows 7, I went to https://www.beds24.com/api/getbookings.xml
and entered my usual user name and password in the relevant fields together with the start date and end date in the appropriate formats and then hit "Submit".

After a short delay, the firebox tab updated to display what looked very much like HTML code with the bookings I expected (all in fetching shades of purple) and captioned with:
"This XML file does not appear to have any style information associated with it. The document tree is shown below."
at the top of the page.

An extract looks like this:
- <bookings>
-<owner user="amberbb">
-<property name="AMBER HOUSE - at the centre! &trade;">
<room name="Balcony Suite"/>
-<room name="Gold Room">
-<booking ref="28575">
<status>Confirmed</status>
<firstNight>2012-06-10</firstNight>
<lastNight>2012-06-11</lastNight>
<numAdult>2</numAdult>
<numChild>0</numChild>
<rateDesc>Rose Room: NZ$375.30</rateDesc>
<price>375.30</price>
<guestName>Jillian Conway</guestName>

That all looked hunky dory so I then hit the <Ctrl> and <S> keys to save it and I selected "Web page, XML only" from the three options presented.

I've downloaded each year of bookings into these .xml files

However, when I ask my newly downloaded copy of LibreOffice 3.5.4 Calc to open this file, it gives me the following fatal error message:

General Error.
General input/output error.


Any assistance would be gratefully appreciated (rather than the suggestion to enrich Microsoft...)

Later (after some frantic Googling)...:
Is it something to do with date and time formats?
http://user.services.openoffice.org/en/ ... 534#p49750
Last edited by amberbb on Mon Jun 11, 2012 12:02 pm, edited 1 time in total.
Amber House Limited trading as AMBER HOUSE - at the centre!™
Mobile: +64 21 202 4961
Phone: +64 3 539 0605
Fax: +44 70 05 96 34 37
http://www.AmberHouse.co.nz
Amber House, 46 Weka Street, Nelson 7010, New Zealand
markkinchin
Site Admin
Posts: 935
Joined: Fri Mar 02, 2012 1:43 pm

Unfortunately both Libre office and Open office do not directly open XML files.
It is not the date format that is the problem, I tried creating a very tiny XML file with no dates and it still had the same error.

This following program can open, view and edit XML files but it is not a spreadsheet.
http://www.firstobject.com/dn_editor.htm
markkinchin
Site Admin
Posts: 935
Joined: Fri Mar 02, 2012 1:43 pm

There is now a corresponding putBookings method available at https://www.beds24.com/api
It takes the same format xml as returned by getBookings and can be used to modify or add new bookings.
moresby
Posts: 6
Joined: Thu Apr 26, 2012 4:40 pm

Is it possible to have a NumNights field in the API, I know it is possible to calculate this by taking one date from the other but it is more difficult doing this on the fly. I am trying to use the API as an import file and this field would be handy if already created.
markkinchin
Site Admin
Posts: 935
Joined: Fri Mar 02, 2012 1:43 pm

moresby wrote:Is it possible to have a NumNights field in the API,
Yes and I have added it called numNight to be consistent with the template variable naming.

<numNight>3</numNight>

I have also changed two other things in the xml to be consistent with lowercase first characters and the template variables.
<AmmountOutstanding> is now simply <balance> and <Currency> is now <currency>.
Post Reply