What is GraphQL? Will it Replace REST API?

GraphQL with SpringBoot and Maven

Ruby Valappil
Javarevisited

--

Photo by Annie Spratt on Unsplash

What is GraphQL?

GraphQL is a query language that’s used to query APIs. It also provides the runtime for fulfilling the queries.

GraphQL uses a simple query (not JSON) to query the data on the server-side and returns the response in JSON format.

In a previous article, we explained how gRPC could be a better alternative to REST when performance is of high priority. Similarly, in this article, we will learn how GraphQL could be a better alternative to REST and RPC in some cases.

Who Developed it and Why?

Developers at Facebook developed GraphQL.

It was developed when the engineers had to use API to fetch news feeds for their mobile applications and were unhappy with the number of calls that were to be made to the server and the complex response objects they had to parse.

When to Use it?

Considering the fact that GraphQL API development is not quite straightforward and simple like developing a REST API, its usage would be most justified in cases where a crucial API that is consumed by multiple clients returns a heavy response object. It would make sense to give the power back to…

--

--