![]() |
VOOZH | about |
We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.
Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.
Follow TNS on your favorite social media networks.
Become a TNS follower on LinkedIn.
Check out the latest featured and trending stories while you wait for your first TNS newsletter.
GraphQL is a relatively new method for creating APIs that offers advantages in efficiency, error handling, and backward compatibility compared to REST. GraphQL provides a great alternative to REST in use cases where the need to deal with complexity in data exchanges outstrips the need for simplicity in the API.
I had my first significant touchpoints with GraphQL when working on the Infrahub project from OpsMill. In context, Infrahub is open source infrastructure automation software that includes novel ways of combining diverse data (asset management, configuration management data, etc.) into a single schema to abstract service definitions for whatever IT or OT infrastructure you want.
For example, suppose you’re building a new AI data center filled with super-expensive GPUs, and you want to turn that data center into a fully automated service where you can update use cases and automate configuration changes so you don’t suffer any downtime of all that capital. In that case, this is an example of what the Infrahub project is meant to make possible. That involves combining disparate data, creating a complex data management challenge. As a result, the project uses a graph database (a technology different from GraphQL), which allows for a lot of schema flexibility. In fact, unlike a lot of automation projects, the Infrahub schema is wholly user-defined.
GraphQL comes into play because you need tremendous flexibility to exchange data with this graph database built custom to every deployment. GraphQL provides flexibility and efficiency to make it possible to automate large-scale infrastructures promptly. It has been fascinating to work on this sort of project, and it has illustrated the power of GraphQL in a way that I wouldn’t have grasped as thoroughly before.
GraphQL was initially created and used internally by Facebook in 2012 while developing the News Feed section of their IOS application. In 2015, it was released as an open source project, and in 2018, the project was moved from Facebook to the GraphQL Foundation, which the Linux Foundation hosts.
GraphQL and REST are complementary and share common API architecture characteristics. Both use a client-server model with stateless servers and communicate via HTTP. They both support similar data formats, such as JSON, and can work with any database and programming language.
The main reason for GraphQL’s development at Facebook was to overcome the challenge that REST-based APIs were too lengthy and rigid to produce news feeds efficiently. While this was the origin use case, GraphQL brings advantages for any API use case requiring high volume, variable, and complex data interactions.
Here are some of the critical limitations of REST that GraphQL addresses:
Where REST is a set of rules to define structured data exchange between a client and a server, GraphQL encompasses a query language, schema-driven architecture, and tools.
When you need to execute complex data exchanges across multiple data sources and where there may be a high degree of variability in client requests, GraphQL offers a significant efficiency advantage regarding the number of queries needed and the amount of data fetched. These complex use cases also benefit from better data typing and error checking, which are available in GraphQL.
Here are some practical examples of where GraphQL brings advantages to data exchanges:
GraphQL offers significant flexibility and efficiency benefits to API data transfers with greater complexity, variability, latency, or bandwidth constraints. While REST remains the default API for many applications, GraphQL is a powerful option in the API developer’s toolkit.