Technical

Getting started with the GraphQL API

In this article we will go through the steps needed to get started with the FlightLogger API

To get started using the FlightLogger GraphQL API you need two things:

  1. An API key
  2. A place to execute GraphQL queries

Getting an API key

To query the GraphQL API, you will need a valid API token. A token is part of an API key. This token has to be sent with every request made to the API via the Authorization HTTP header.

Creating an API key is done by following these steps:

  1. Sign in to your personal my|FlightLogger account
  2. Click on the API icon in the menu
    Screenshot 2023-04-27 at 11.28.37
  3. Click Create API key
  4. Give the key a name so you know what it's used for. Choose if it should be a global key or not. In most cases you want to not have a global key and instead choose which account the API should connect to. Then set if there should be an expiry date on the key or not, and finally click Save.
    Screenshot 2023-04-27 at 11.30.54
  5. The key is now created. Make sure to copy it right away as it will not be available hereafter.
    Screenshot 2023-04-27 at 11.34.12

The token allows the person who uses it to communicate with the API on your behalf. It is therefore your responsibility to keep the token safe, and ensure it is not stolen/copied by anyone who shouldn't have access to it. 

Great!  You now have a valid key and accompanying token to use with the FlightLogger GraphQL API.

Executing a GraphQL query

To actually communicate with the API, you need some method of sending a GraphQL query to the FlightLogger GraphQL API. Conveniently, FlightLogger hosts a playground where you can easily interact with the API: FlightLogger GraphQL API Playground 

For non-playground users, GraphQL queries are accepted at the endpoint: https://api.flightlogger.net/graphql

In the playground, you will need to supply the aforementioned API token in order to query the API. To use your token, do the following:

  1. At the bottom of the playground view, click 'HTTP HEADERS'.
  2. Replace the TOKEN part of the Authorization header with your token. It should look something like this: "Authorization": "Bearer 95c286388..."

The token is now in place, and you can start communicating with the API, hooray! 🎉

Alternatives to the playground

The playground is an excellent place to start "playing around" with the API. If you require a more feature-rich way of interacting with our API you can use third-party API interaction clients like Insomnia or Postman.

Further reading

Now that you're able to communicate with the API it may be a good time to read up on some relevant info.

Introduction to GraphQL - The API uses the Graph Query Language (GraphQL) for its interactions. If you're unfamiliar, reading up on what GraphQL is, and how it works, is helpful.

FlightLogger API Reference - The API can do a lot of things, so an overview of what kind of data is available, and how to retrieve it is essential. The playground also provides information on the GraphQL schema.

Example API Queries Article - Contains some specific example queries to help get you started.

The Help Center - We will be adding new information regarding the API - and FlightLogger in general - here in the Help Center. Have a look around and enlighten yourself.