Page 1 of 1

getBookings API

Posted: Tue May 01, 2012 3:49 pm
by markkinchin
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.

Re: getBookings API

Posted: Tue May 01, 2012 8:38 pm
by moresby
That's great news, I will give it a try and see how it works.

Re: getBookings API

Posted: Mon Jun 11, 2012 2:40 am
by amberbb
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

Re: getBookings API

Posted: Mon Jun 11, 2012 7:59 am
by markkinchin
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

Re: getBookings API

Posted: Mon Jul 23, 2012 7:56 am
by markkinchin
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.

Re: getBookings API

Posted: Mon Feb 18, 2013 11:23 am
by moresby
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.

Re: getBookings API

Posted: Mon Feb 18, 2013 7:18 pm
by markkinchin
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>.