Technical

Example API Queries

This article aims to show the FlightLogger GraphQL API in action via a few simple example queries.

For more information on the API, please see the About Flightlogger's API article. Pagination will not be covered in this article. See instead the Pagination of API Results article.

Example #1: Flights

The following query will fetch all flights of the account for the entirety of the year 2022 (from January 1st to December 31st). It selects a few different fields related to the aircraft performing the flight, the type of activity which the flight is a part of and flight times along with landings.

You can try out the query in the playground: Example #1 Playground

{
flights(from: "2022-01-01", to: "2022-12-31", all: true) {
nodes {
flightType
activityRegistration {
__typename
id
}
aircraft {
callSign
aircraftClass
model
homeAirport {
name
}
currentAirport {
name
}
}
takeoff
onBlock
offBlock
landing
landings {
isArrival
landingType
airport {
name
}
}
}
}
}

Example #2: Users

The following query will fetch all users who are both instructors and crew, and who are not disabled for the account. It selects some basic name and contact information and with the time at which the user was last updated/edited.

You can try out the query in the playground: Example #2 Playground

{
users(roles: [INSTRUCTOR, CREW]) {
nodes {
callSign
firstName
lastName
contact {
email
}
audit {
updatedAt
}
}
}
}

Example #3: Bookings

The following query will fetch all multi student and single student training bookings missing completion that the requesting user is part of (either student, instructor or observer) for the month of November, 2022. It selects the aircraft, student(s) and instructor of the bookings, along with audit information about who last updated the booking(s).

You can try out the query in the playground: Example #3 Playground

{
bookings(from: "2022-11-01", to: "2022-11-31", subtypes: [MULTI_STUDENT, SINGLE_STUDENT], statuses: [OPEN]) {
nodes {
__typename
... on AircraftBooking {
aircraft {
callSign
}
}
... on SingleStudentBooking {
instructor {
callSign
}
student {
callSign
}
audit {
updatedAt
updatedById
}
}
... on MultiStudentBooking {
instructor {
callSign
}
students {
callSign
}
audit {
updatedAt
updatedById
}
}
}
}
}

Raw Data Report Equivalents

The follow queries are larger examples which will fetch the data fields of data as the raw data reports. The queries are quite long, so they wont be written out in their entirety here. Instead, use these links to view them in the playground:

Raw Data Flight Report Query

Raw Data Theory Report Query