GraphQL APIs

Published by: Boeing Developer Tools | Posted: September 1, 2021 05:00 PM GMT+0
GraphQL APIs on Boeing Developer Tools

GraphQL is an open source query language (QL) for APIs. While REST APIs typically provide highly constrained means to request and receive data, GraphQL allows the client to define the structure of the data to be returned. The underlying mechanism for executing queries and mutations (insert/update/delete) is the HTTP POST verb. GraphQL offers flexibility and richness in how to request data; however, it adds complexity which is not necessary for simple APIs. GraphQL consists of a type system, query language, and execution symantics. GraphQL has a tremendous amount of support documentation given its open source status.

GraphQL represents data in a graph. Instead of the rows and columns found in a relational database, a graph database is a collection of nodes and edges. A graph is defined according to a schema language that is particular to GraphQL. Developers use the schema language to define the types (for example, Airplane, Owner, Crew, Passenger) as well as the query and mutation (insert/update/delete) operations that will be published by the GraphQL API. Unlike REST, in which the requester has no control over the structure of the response, GraphQL allows you to define the structure of the response data explicitly in the query itself.

One of the biggest advantages of GraphQL is that it helps you solve the problem of over-fetching and under-fetching. Over-fetching is a limitation of REST APIs where you may be forced to fetch more data than required, whereas under-fetching occurs when a single API does not provide all the data you require and hence you are forced to call multiple APIs. For example, you might be forced to call the Flight API to get the flight details and then call the Crew API to fetch the crew information assigned to a specific flight.

Boeing Developer Tools supports GraphQL functionality offered over HTTP protocol. This includes ‘query’ and ‘mutation’ operations. The ‘subscription’ operation is not currently supported by Boeing Developer Tools.

API Publishers can use the OpenAPI specification or swagger to document the schema for your GraphQL endpoint.

Please contact us at developertools@boeing.com to find out more about publishing GraphQL APIs on Boeing Developer Tools.