SlideShare a Scribd company logo
1
WHAT IS GraphQL
GraphQL - https://graphql.org/
GraphQL is an open-source data query and manipulation language for APIs, and a runtime for fulfilling queries with
existing data. Maintained and developed primarily via the GraphQL Foundation, GraphQL has had incredible adoption
across a variety of verticals and use cases with organizations like Twitter, Expedia, Shopify, and Hygraph to name a few.
GraphQL is a query language. GraphQL provides a complete and understandable description of the data in your API,
gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time,
and enables powerful developer tools.
Send a GraphQL query to your API and get exactly what you need, nothing more and nothing less. GraphQL queries
always return predictable results. Apps using GraphQL are fast and stable because they control the data they get, not
the server.
5/19/2023 2
GRAPQL VS REST API
The core difference between GraphQL and REST APIs is that GraphQL is a specification, a query
language, while REST is an architectural concept for network-based software.
GraphQL queries access not just the properties of one resource but also smoothly follow references
between them. While typical REST APIs require loading from multiple URLs, GraphQL APIs get all the
data your app needs in a single request. Apps using GraphQL can be quick even on slow mobile
network connections.
GraphQL is gaining momentum as a successor to REST APIs. However, it isn’t always a “replacement”,
and making the decision to opt for GraphQL comes with several considerations. Traditionally and when
used “out of the box”, REST has had limitations like multiple network requests and overfetching data.
To overcome these, Facebook developed GraphQL as an open-source data query and manipulation
language for APIs. GraphQL is a syntax for requesting data and lets you specify precisely what you
need.
Depending on your use cases, you will need to choose between GraphQL or REST API, or a combination
of both. To make a more informed decision, let’s take a look at REST and GraphQL, and understand
some of the reasons for choosing GraphQL.
Rest Api
GraphQL
5/19/2023 3
GraphQL VS REST API
GraphQL REST API
A query language for solving common problems when integrating APIs An architectural style largely viewed as a conventional standard for
designing APIs
Deployed over HTTP using a single endpoint that provides the full
capabilities of the exposed service
Deployed over a set of URLs where each of them exposes a single resource
Uses a client-driven architecture Uses a server-driven architecture
Lacks in-built caching mechanism Uses caching automatically
No API versioning required Supports multiple API versions
Response output in JSON Response output usually in XML, JSON, and YAML
Offers type-safety and auto-generated documentation Doesn't offer type-safety or auto-generated documentation
Allows for schema stitching and remote data fetching Simplifying work with multiple endpoints requires expensive custom
middleware
5/19/2023 4
GraphQL Language Support
5/19/2023 5
GraphQL Advantages
• Data Fetching
One of the most common limitations of REST out-of-the-box is that of overfetching and underfetching.
This happens because the only way for a client to download data is by hitting endpoints that return fixed data sets.
It’s very difficult to design the API in a way that it’s able to provide clients with their exact data needs.
Overfetching means getting more information than you need.
With GraphQL, you’d simply need to dictate what you want in a query
• Schema Stitching
A major differentiation is the ability for stitching schemas. GraphQL can combine multiple schemas into a
single schema to make it accessible to the client. For example, merging the schemas of a Burgers API and a
Nutrition API by getting the details of a particular menu and the nutrition facts of the item into a single
schema, from different sources.

More Related Content

Similar to GraphQL.pptx

Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
Seven Peaks Speaks
 
Graphql for Frontend Developers Simplifying Data Fetching.docx
Graphql for Frontend Developers Simplifying Data Fetching.docxGraphql for Frontend Developers Simplifying Data Fetching.docx
Graphql for Frontend Developers Simplifying Data Fetching.docx
ssuser5583681
 
GraphQL Advanced Concepts A Comprehensive Guide.docx
GraphQL Advanced Concepts A Comprehensive Guide.docxGraphQL Advanced Concepts A Comprehensive Guide.docx
GraphQL Advanced Concepts A Comprehensive Guide.docx
ssuser5583681
 
Create GraphQL server with apolloJS
Create GraphQL server with apolloJSCreate GraphQL server with apolloJS
Create GraphQL server with apolloJS
Jonathan Jalouzot
 
How has netflix embraced graph ql for rapid application development
How has netflix embraced graph ql for rapid application developmentHow has netflix embraced graph ql for rapid application development
How has netflix embraced graph ql for rapid application development
jenniferCarnel1
 
Building an Android app with GraphQL Unleashing the Power of Modern Mobile De...
Building an Android app with GraphQL Unleashing the Power of Modern Mobile De...Building an Android app with GraphQL Unleashing the Power of Modern Mobile De...
Building an Android app with GraphQL Unleashing the Power of Modern Mobile De...
ssuser5583681
 
Web Access the Realm with GraphQL
Web Access the Realm with GraphQLWeb Access the Realm with GraphQL
Web Access the Realm with GraphQL
Knoldus Inc.
 
GraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits togetherGraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits together
Sashko Stubailo
 
GraphQL Federation, the missing piece of microservices
GraphQL Federation, the missing piece of microservicesGraphQL Federation, the missing piece of microservices
GraphQL Federation, the missing piece of microservices
Nguyễn Quang Huy
 
Harnessing the Power of GraphQL in WordPress
Harnessing the Power of GraphQL in WordPressHarnessing the Power of GraphQL in WordPress
Harnessing the Power of GraphQL in WordPress
Sandip Basnet
 
GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018
Sashko Stubailo
 
Andrea Baldon, Emanuele Di Saverio - GraphQL for Native Apps: the MyAXA case ...
Andrea Baldon, Emanuele Di Saverio - GraphQL for Native Apps: the MyAXA case ...Andrea Baldon, Emanuele Di Saverio - GraphQL for Native Apps: the MyAXA case ...
Andrea Baldon, Emanuele Di Saverio - GraphQL for Native Apps: the MyAXA case ...
Codemotion
 
Real Time Serverless Polling App
Real Time Serverless Polling AppReal Time Serverless Polling App
Real Time Serverless Polling App
Srushith Repakula
 
GraphQL.net
GraphQL.netGraphQL.net
GraphQL.net
Tyler Ayers
 
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays
 
REST API Graph API GraphQL GraphiQL Presentation
REST API Graph API  GraphQL GraphiQL Presentation REST API Graph API  GraphQL GraphiQL Presentation
REST API Graph API GraphQL GraphiQL Presentation
Atharva Jawalkar
 
apidays LIVE Paris - The Rise of GraphQL for database APIs by Karthic Rao
apidays LIVE Paris - The Rise of GraphQL for database APIs by Karthic Raoapidays LIVE Paris - The Rise of GraphQL for database APIs by Karthic Rao
apidays LIVE Paris - The Rise of GraphQL for database APIs by Karthic Rao
apidays
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
Rodrigo Prates
 
Implementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCImplementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPC
Tim Burks
 
apidays LIVE Paris - GraphQL meshes by Jens Neuse
apidays LIVE Paris - GraphQL meshes by Jens Neuseapidays LIVE Paris - GraphQL meshes by Jens Neuse
apidays LIVE Paris - GraphQL meshes by Jens Neuse
apidays
 

Similar to GraphQL.pptx (20)

Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
 
Graphql for Frontend Developers Simplifying Data Fetching.docx
Graphql for Frontend Developers Simplifying Data Fetching.docxGraphql for Frontend Developers Simplifying Data Fetching.docx
Graphql for Frontend Developers Simplifying Data Fetching.docx
 
GraphQL Advanced Concepts A Comprehensive Guide.docx
GraphQL Advanced Concepts A Comprehensive Guide.docxGraphQL Advanced Concepts A Comprehensive Guide.docx
GraphQL Advanced Concepts A Comprehensive Guide.docx
 
Create GraphQL server with apolloJS
Create GraphQL server with apolloJSCreate GraphQL server with apolloJS
Create GraphQL server with apolloJS
 
How has netflix embraced graph ql for rapid application development
How has netflix embraced graph ql for rapid application developmentHow has netflix embraced graph ql for rapid application development
How has netflix embraced graph ql for rapid application development
 
Building an Android app with GraphQL Unleashing the Power of Modern Mobile De...
Building an Android app with GraphQL Unleashing the Power of Modern Mobile De...Building an Android app with GraphQL Unleashing the Power of Modern Mobile De...
Building an Android app with GraphQL Unleashing the Power of Modern Mobile De...
 
Web Access the Realm with GraphQL
Web Access the Realm with GraphQLWeb Access the Realm with GraphQL
Web Access the Realm with GraphQL
 
GraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits togetherGraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits together
 
GraphQL Federation, the missing piece of microservices
GraphQL Federation, the missing piece of microservicesGraphQL Federation, the missing piece of microservices
GraphQL Federation, the missing piece of microservices
 
Harnessing the Power of GraphQL in WordPress
Harnessing the Power of GraphQL in WordPressHarnessing the Power of GraphQL in WordPress
Harnessing the Power of GraphQL in WordPress
 
GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018
 
Andrea Baldon, Emanuele Di Saverio - GraphQL for Native Apps: the MyAXA case ...
Andrea Baldon, Emanuele Di Saverio - GraphQL for Native Apps: the MyAXA case ...Andrea Baldon, Emanuele Di Saverio - GraphQL for Native Apps: the MyAXA case ...
Andrea Baldon, Emanuele Di Saverio - GraphQL for Native Apps: the MyAXA case ...
 
Real Time Serverless Polling App
Real Time Serverless Polling AppReal Time Serverless Polling App
Real Time Serverless Polling App
 
GraphQL.net
GraphQL.netGraphQL.net
GraphQL.net
 
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
 
REST API Graph API GraphQL GraphiQL Presentation
REST API Graph API  GraphQL GraphiQL Presentation REST API Graph API  GraphQL GraphiQL Presentation
REST API Graph API GraphQL GraphiQL Presentation
 
apidays LIVE Paris - The Rise of GraphQL for database APIs by Karthic Rao
apidays LIVE Paris - The Rise of GraphQL for database APIs by Karthic Raoapidays LIVE Paris - The Rise of GraphQL for database APIs by Karthic Rao
apidays LIVE Paris - The Rise of GraphQL for database APIs by Karthic Rao
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Implementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCImplementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPC
 
apidays LIVE Paris - GraphQL meshes by Jens Neuse
apidays LIVE Paris - GraphQL meshes by Jens Neuseapidays LIVE Paris - GraphQL meshes by Jens Neuse
apidays LIVE Paris - GraphQL meshes by Jens Neuse
 

Recently uploaded

RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 

Recently uploaded (20)

RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 

GraphQL.pptx

  • 1. 1 WHAT IS GraphQL GraphQL - https://graphql.org/ GraphQL is an open-source data query and manipulation language for APIs, and a runtime for fulfilling queries with existing data. Maintained and developed primarily via the GraphQL Foundation, GraphQL has had incredible adoption across a variety of verticals and use cases with organizations like Twitter, Expedia, Shopify, and Hygraph to name a few. GraphQL is a query language. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools. Send a GraphQL query to your API and get exactly what you need, nothing more and nothing less. GraphQL queries always return predictable results. Apps using GraphQL are fast and stable because they control the data they get, not the server.
  • 2. 5/19/2023 2 GRAPQL VS REST API The core difference between GraphQL and REST APIs is that GraphQL is a specification, a query language, while REST is an architectural concept for network-based software. GraphQL queries access not just the properties of one resource but also smoothly follow references between them. While typical REST APIs require loading from multiple URLs, GraphQL APIs get all the data your app needs in a single request. Apps using GraphQL can be quick even on slow mobile network connections. GraphQL is gaining momentum as a successor to REST APIs. However, it isn’t always a “replacement”, and making the decision to opt for GraphQL comes with several considerations. Traditionally and when used “out of the box”, REST has had limitations like multiple network requests and overfetching data. To overcome these, Facebook developed GraphQL as an open-source data query and manipulation language for APIs. GraphQL is a syntax for requesting data and lets you specify precisely what you need. Depending on your use cases, you will need to choose between GraphQL or REST API, or a combination of both. To make a more informed decision, let’s take a look at REST and GraphQL, and understand some of the reasons for choosing GraphQL. Rest Api GraphQL
  • 3. 5/19/2023 3 GraphQL VS REST API GraphQL REST API A query language for solving common problems when integrating APIs An architectural style largely viewed as a conventional standard for designing APIs Deployed over HTTP using a single endpoint that provides the full capabilities of the exposed service Deployed over a set of URLs where each of them exposes a single resource Uses a client-driven architecture Uses a server-driven architecture Lacks in-built caching mechanism Uses caching automatically No API versioning required Supports multiple API versions Response output in JSON Response output usually in XML, JSON, and YAML Offers type-safety and auto-generated documentation Doesn't offer type-safety or auto-generated documentation Allows for schema stitching and remote data fetching Simplifying work with multiple endpoints requires expensive custom middleware
  • 5. 5/19/2023 5 GraphQL Advantages • Data Fetching One of the most common limitations of REST out-of-the-box is that of overfetching and underfetching. This happens because the only way for a client to download data is by hitting endpoints that return fixed data sets. It’s very difficult to design the API in a way that it’s able to provide clients with their exact data needs. Overfetching means getting more information than you need. With GraphQL, you’d simply need to dictate what you want in a query • Schema Stitching A major differentiation is the ability for stitching schemas. GraphQL can combine multiple schemas into a single schema to make it accessible to the client. For example, merging the schemas of a Burgers API and a Nutrition API by getting the details of a particular menu and the nutrition facts of the item into a single schema, from different sources.