Bookings

This API is used to read the future bookings. For information about how to get started using the APIs available, see API Access.

Parameters

  • page (integer)
    Zero-based page number. The query returns up to 50 rows per page. Based on has_more you might increment the page and request the next set of results.
  • include_cancellations (0 or 1)
    Normally only active bookings are returned. Use this parameter to extend the results to include cancellations.
  • include_unavailability (0 or 1)
    Extend the results to include periods of unavailability (member field is returned blank)

 

Output

  • total (integer)
    Total number of records available (not affected by the page parameter).
  • has_more (boolean)
    True if there are more records available by incrementing the page parameter. When false you have read the whole list. Before reading the whole list, consider whether this is necessary or do you only need to read to the end of the current day?
  • change_id (string)
    A string value which indicates whether any bookings have been added or updated. If you have read all data previously and the next read returns the same change_id, nothing has changed. However, if the value changes you might discard your current result set and read again from the first page.
  • rows  (array)
    Each row contains information about a booking.

 

Each row contains the following fields

  • id (integer)
  • url (string)
  • start_time (integer)
  • stop_time (integer)
  • booked_at (integer)
  • originator_id (integer)
  • originator_name (string)
  • customer_id (integer)
  • customer_name (string)
  • aircraft_id (integer)
  • aircraft (string)
  • instructor_id (integer)
  • instructor_name (string)
  • notes (string)

 

If the booking was cancelled, the following additional fields are present:

  • cancelled (boolean)
  • cancelled_at (integer)
  • cancelled_by (string)
  • cancelled_notes (string)

 

The customer, aircraft and instructor fields are optional. If a booking is a period of unavailability (for aircraft or instructor) there will be no customer fields. Similarly, if the booking does not include an aircraft there will be no aircraft fields.

Notes

Start reading at page zero. There could be a change in bookings in between you asking for page 0 and page 1, so check the change_id is the same and re-start from page=0 if it changes.

Then keep asking for more pages until you reach a date that you don’t need (records are ordered in ascending date order) or has_more returns false.

Example

curl -H "Accept: application/json" -H "Authorization: Bearer fb1f233e08aeef0a213dc87cea70cedbd7dbcd0a2229cac4f64e14e3c462cc8e" "https://acme.flightschoolbooking.com/club/bookings?page=0&include_cancellations=1&include_unavailability=1"

(Use your own site's URL, replacing acme with the name of your subdomain and use your own token)

The output looks like this:

{
  "total": "378",
  "has_more": true,
  "change_id": "15a981ba73513efc",
  "rows": [
    {
      "url": "https://acme.flightschoolbooking.com/user/21682/bookings/booking/5",
      "startTime": "1590998400",
      "stopTime": "1591005600",
      "bookedAt": "1590951551",
      "member": "John Smith",
      "aircraft": "G-AABC",
      "instructor": "",
      "notes": ""
    },
    . . . 
  ]
}