GraphQL in 10 minutes

This page gives you a quick overview about GraphQL - why we use it, why you should learn it and how to get started.

It's state of the art

Facebook open-sourced GraphQL in 2015, after using it internally long before: https://code.facebook.com/posts/1691455094417024/graphql-a-data-query-language/. Since then, renowned companies like Coursera and Github, but also the Financial Times use it to build open, efficient and developer-friendly APIs.

Learn more about it from our recent 3-part webinar:

It's language independent

Like REST, using a GraphQL-API allows you to use any programming language you want. There are various client side implementations, but it's also easy to build the queries and issue the underlying REST call directly. Learn more about using GraphQL from Java as an example here: GraphQL in Java.

It's easy to understand

GraphQL has only two major concepts:

  • A query allows you to formulate precisely what arguments to return and what filters to apply for this
  • A mutation allows you to apply patches or to delete objects. Again, you can combine patches or define precisely what arguments to return.

It's interactive

We included a nice tool called graphiql (see https://github.com/graphql/graphiql) into LeanIX. With this, you can interactively develop and test your queries directly in the workspace, without relying on curl or other tools. The following screenshots show a nice example:

Quick Overview

a) Just type "{" and " - " to get an overview of available queries

Tab Completion

b) Use tab completion to get your first query within seconds

Prettify

c) Press "Prettify" to format your query, and "Play" to get your first result

More Attributes

d) Now subsequently use more attributes and relations, or copy a query from GraphQL Basics

Docs link

e) Finally, use the Docs link at the right-hand side to browse the available queries and mutations interactively:

It's extremely powerful and efficient

Comparing it to a classical REST-API, the main advantage of GraphQL is its ability to formulate queries and mutations in the most efficient way:

  • Developers can summarize multiple API calls in one. Doing so allows them to focus on the business logic instead of combining call results, handling different transactions, ...
  • In particular for large reports or analytics, GraphQL allows increasing performance dramatically. Now, you can transfer exactly the attributes you require via the network, with no extra latency. Further, GraphQL aligns perfectly with an underlying Graph Database to answer queries that span multiple relations, e.g. evaluating Technology Risk transitively.