VOOZH about

URL: https://thenewstack.io/graphql-and-rest-can-coexist-author-will-lyon-says/

⇱ GraphQL and REST Can Coexist, Author Will Lyon Says - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

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.

What’s next?

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.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2022-10-12 08:14:43
GraphQL and REST Can Coexist, Author Will Lyon Says
contributed,sponsor-neo4j,sponsored,sponsored-post-contributed,
API Management / Data / Software Development

GraphQL and REST Can Coexist, Author Will Lyon Says

It’s been called 'the better REST' by more than one vendor. GraphQL champion Will Lyon believes GraphQL to be the REST we’ve needed all along.
Oct 12th, 2022 8:14am by Scott M. Fulton III
👁 Featued image for: GraphQL and REST Can Coexist, Author Will Lyon Says
Feature image via Pixabay
Neo4j sponsored this post.

The REST acronym, more often than not, means Representational State Transfer. And yes, that phrase has always been something of a stretch. Red Hat, for its part, asserts REST is really a set of constraints on how an application uses an API to address other software. It’s a way to ask, “How are you?” and get an answer that makes sense.

Yet you’ve probably already seen the comparisons being made, where vendors characterize GraphQL as, for example, “a more efficient, flexible and powerful way of working with APIs than REST,” and scoring “a few brownie points over REST.” Back in February 2019, marketing platform Crystallize publicly declared, “We have now killed off our REST API entirely and replaced it with GraphQL. Performance and developer experience are the main drivers.”

You’ve even seen similar head-to-head matchups being refereed here in The New Stack. Jessica Wachtel called GraphQL “better for complex systems and microservices” than REST. And Richard MacManus chronicled how e-commerce platform Shopify transitioned from REST to GraphQL, from its perspective, mainly because the REST scheme it had been using for its APIs would return unstructured JSON instead of values that could be mapped to strongly typed variables.

Perhaps most compellingly of all, when Facebook first proposed GraphQL in 2016, GitHub and others adopted it with, as GitHub itself characterized it, the explicit intention of dumping REST.

However, if REST is more of a methodology and GraphQL is, as its maintainers. . . well, maintain, “a query language for your API,” then a head-to-head match between the two wouldn’t be fair, would it? Aren’t they two separate weight categories? Maybe, unless GraphQL isn’t really a query language per se — that is to say, unless it belongs more to the REST category than the SQL category.

Neo4j is the company behind the world’s principal graph database, helping organizations make sense of their data by revealing how people, processes, and digital systems are interrelated.  Our focus on connections drives new business value from AI, real-time analysis, and anomaly detection.
Learn More
The latest from Neo4j

REST Specifications Lack Specificity

“The first thing to understand is that there isn’t a clear definition of what REST is,” remarked Will Lyon, a developer advocate with graph database producer Neo4j. Lyon is the author of “Full Stack GraphQL Applications with React, Node.js, and Neo4j,” just off the press from Manning Publications.

👁 Image

Will Lyon

“Typically we think of REST as, ‘I have an endpoint that maps to some resource,’” Lyon explained. “So if I have movies and actors, I have a “movies” endpoint, and then I have another endpoint for “actors,” and that maps to some resource. But the way you implement that REST API can be very different — up to the developer.

“There’s no REST specification. So you have everything from just an endpoint that’s returning some JSON, to a JSON API, to the fullest, most complete version of REST: HATEOAS (Hypermedia as the Engine of Application State). There’s really the spectrum of what REST is. That’s not the case with GraphQL.”

So the Shopify and Crystallize transitions, and others like them, weren’t really migrations, as Lyon perceives them, or even the killing off of anything besides inefficiencies. Moreover, they may have been examples of systematic tightening of the protocols and constraints that their REST API should have had from the outset, had there been a specification to match the goals of the methodology.

“One of the beauties of GraphQL is that it’s data layer-agnostic,” Lyon continued. “I can build a GraphQL API on top of any data layer, multiple data layers. I can fetch data from databases, I can even build GraphQL APIs on top of other GraphQL APIs, or on top of REST APIs. So REST and GraphQL are not mutually exclusive. I can use them together by building a GraphQL API on top of a REST API, as a data source.”

👁 Image

Lyon cited the recent the 2022 State of GraphQL Survey. When some 1,489 respondents were asked, “Which kind of data sources are consumed by your GraphQL APIs?” 26.8% of respondents answered REST APIs, with Swagger and OpenAPI listed as examples. It was the No. 2 answer behind databases with 42.5% of respondents.

For more than one-quarter of the survey’s respondents, GraphQL is a way to do REST, not a method of replacing REST.

Putting the either/or Issue to REST

The first enterprises to take the step of adopting GraphQL starting in 2016, Lyon told us, were not typically known for being early adopters of unproven technologies. The wave of uptakes for GraphQL was only feasible, he believes, by enabling itself to be adopted without upheaval. Rather than a “lift-and-shift” approach, these first adopters simply bolted GraphQL onto the APIs they had. And they worked.

“It’s important to understand that distinction that GraphQL and REST are not mutually exclusive,” said Lyon. “There’s a place for both. REST APIs can actually help you build and expose GraphQL to your organization.”

Suppose you have a database query that hits on three elements that share relationships: for example, known pathogens, known treatments and known side effects. With a common REST API implementation, this query could hit three separate endpoints. They’ll all be dependable connections. But with this level of separation, they’ll be slow. The second set of data retrieval calls will follow the first set, and the third set will follow the second, in cascading fashion. But because the retrieved data will not be processed until after all the calls have been resolved, the application will always place one more call than the total number it could possibly require — the classic n + 1 query problem.

“We need to be mindful of the performance implications we have, as we put GraphQL on top of other data layers,” Lyon remarked. “It’s not magic. There’s work to do there.” That work may not be possible with everyday REST implementations where no protocols have been put in place, and no best practices are being implemented. It’s this mess that organizations dump when they say they’re dumping REST for GraphQL.

Ask Lyon Yourself

Lyon plans to dive deep into the topic of GraphQL, including demonstrating how to connect applications to graph databases using solid, dependable GraphQL APIs, during a free, live webinar with Scott Fulton on Thursday, Oct. 13 at 2 p.m. ET / 11 a.m. PT. He’ll also be presenting a live session entitled “Making Sense of Geospatial Data with Knowledge Graphs” during the NODES 2022 virtual conference on Wed., Nov. 16, produced by Neo4j. Registration is free. 

Neo4j is the company behind the world’s principal graph database, helping organizations make sense of their data by revealing how people, processes, and digital systems are interrelated.  Our focus on connections drives new business value from AI, real-time analysis, and anomaly detection.
Learn More
The latest from Neo4j
TRENDING STORIES
Scott M. Fulton, III is a 39-year veteran technology journalist, author, analyst, and content strategist, the latter of which means he thought almost too carefully about the order in which those roles should appear. Decisions like these, he’ll tell you,...
Read more from Scott M. Fulton III
Neo4j sponsored this post.
SHARE THIS STORY
TRENDING STORIES
TNS owner Insight Partners is an investor in: Pragma.
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.