Bookingsync

Developer API Documentation

Bookings Private

Show

GET /bookings/#{id}.xml

Returns a single booking identified by its integer ID. Even canceled bookings can be returned.

Response

Status: 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<booking>
  <account-id type="integer">1</account-id>
  <id type="integer">1</id>
  <created-at type="datetime">2012-05-18T10:00:00Z</created-at>
  <updated-at type="datetime">2012-05-18T11:00:00Z</updated-at>
  <canceled-at type="datetime" nil="true"></canceled-at>
  <rental-id type="integer">1</rental-id>
  <client-id type="integer">1</client-id>
  <start-at type="datetime">2012-05-19T16:00:00Z</start-at>
  <end-at type="datetime">2012-05-22T10:00:00Z</end-at>
  <booked type="boolean">true</booked>
  <tentative-expires-at type="datetime" nil="true"></tentative-expires-at>
  <unavailable type="boolean">false</unavailable>
  <currency>EUR</currency>
  <initial-price type="integer">5000</initial-price>
  <discount>10%</discount>
  <final-price type="integer">4500</final-price>
  <deposit type="integer">1500</deposit>
  <adults type="integer">8</adults>
  <children type="integer" nil="true"></children>
  <notes nil="true"></notes>
</booking>

List all

GET /bookings.xml

Returns a list of all bookings starting after now. A default of maximum 50 bookings is returned per page, ordered by starting date.

Parameters

  • from. Optional. Retrieves all bookings starting after the specified date. (format: yyyymmdd and in UTC, default from now)
    • Example: https://www.bookingsync.com/bookings.xml?from=20120518
  • status. Optional.
    • booked. Retrieves only booked periods.
    • tentative. Retrieves only tentative bookings.
    • unavailable. Retrieves only unavailable periods.
    • Example: https://www.bookingsync.com/bookings.xml?status=tentative
    • Tip: You can also scope more status at once by joining them with a comma : status=booked,unavailable
  • include_canceled. Optional. Include canceled bookings? (disabled by default)
    • Example: https://www.bookingsync.com/bookings.xml?include_canceled=1
  • page. Optional. Specifies the page of bookings to retrieve. (default: 1)
    • Example: https://www.bookingsync.com/bookings.xml?page=2
  • per_page. Optional. Specifies the maximum number of bookings to return per page. (default: 50, maximum: 500)
    • Example: https://www.bookingsync.com/bookings.xml?per_page=500

Response

Status: 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<bookings type="array">
  <booking>
    ...
  </booking>
  <booking>
    ...
  </booking>
  ...
</bookings>

List all within rental

GET /rentals/#{rental-id}/bookings.xml

Returns a list of all bookings made for the rental specified by the integer RENTAL_ID.

Parameters

Use the same parameters as "List all".

Response

Status: 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<bookings type="array">
  <booking>
    ...
  </booking>
  <booking>
    ...
  </booking>
  ...
</bookings>

List all within client

GET /clients/#{client-id}/bookings.xml

Returns a list of all bookings made by the client specified by the integer CLIENT_ID.

Parameters

Use the same parameters as "List all".

Response

Status: 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<bookings type="array">
  <booking>
    ...
  </booking>
  <booking>
    ...
  </booking>
  ...
</bookings>

Create

POST /bookings.xml

Creates a new booking. The XML for the new booking is returned on a successful request with the timestamps recorded.

If the account doesn’t allow for more bookings to be created, a “507 Insufficient Storage” response will be returned.

Request

<?xml version="1.0" encoding="UTF-8"?>
<booking>
  <tentative-expires-at type="datetime">2012-05-21T22:00:00Z</tentative-expires-at>
  <client-id type="integer">1</client-id>
  <end-at type="datetime">2012-08-22T10:00:00Z</end-at>
  <final-price type="integer">3000</final-price>
  <rental-id type="integer">1</rental-id>
  <start-at type="datetime">2012-08-19T16:00:00Z</start-at>
</booking>

Response

Status: 201 Created
Location: https://www.bookingsync.com/bookings/#{new-booking-id}.xml

<?xml version="1.0" encoding="UTF-8"?>
<booking>
  <account-id type="integer">1</account-id>
  <adults type="integer" nil="true"></adults>
  <booked type="boolean">false</booked>
  <canceled-at type="datetime" nil="true"></canceled-at>
  <children type="integer" nil="true"></children>
  <client-id type="integer">1</client-id>
  <created-at type="datetime">2012-05-18T22:01:20Z</created-at>
  <currency>&#8364;</currency>
  <deposit type="integer" nil="true"></deposit>
  <discount nil="true"></discount>
  <end-at type="datetime">2012-08-22T10:00:00Z</end-at>
  <final-price type="integer">3000</final-price>
  <id type="integer">1</id>
  <initial-price type="integer" nil="true"></initial-price>
  <notes nil="true"></notes>
  <rental-id type="integer">1</rental-id>
  <start-at type="datetime">2012-08-19T16:00:00Z</start-at>
  <tentative-expires-at type="datetime">2012-05-21T22:00:00Z</tentative-expires-at>
  <unavailable type="boolean">false</unavailable>
  <updated-at type="datetime">2012-05-18T22:01:20Z</updated-at>
</booking>

Update

PUT /bookings/#{id}.xml

Updates an existing booking with new details from the submitted XML. The example bellow will convert a booking with the status “tentative” to “booked” and therefore confirm this reservation.

Request

<?xml version="1.0" encoding="UTF-8"?>
<booking>
  <tentative-expires-at type="datetime" nil="true"/>
  <booked type="boolean">true</booked>
</booking>

Response

Status: 200 OK

Cancel

DESTROY /bookings/#{id}.xml

Cancel the booking identified by its integer ID.

Response

Status: 200 OK

Restore

PUT /bookings/#{id}/restore.xml

Restore the previously canceled booking identified by its integer ID.

Response

Status: 200 OK