SlideShare a Scribd company logo
2
Most read
4
Most read
12
Most read
An intro to GraphQL
Suraj Paul
https://www.drupal.org/u/suraj2012
● Data Query Language developed by Facebook in 2012.
● Released publicly in 2015.
● GraphQL is a query language for your API, and a server-side
runtime for executing queries by using a type system you
define for your data.
● GraphQL isn't tied to any specific database or storage engine
and is instead backed by your existing code and data.
● Drupal 8 provides module to create and expose graphQL
schema. https://www.drupal.org/project/graphql
What is GraphQL ?
Core Ideas of GraphQL
● Client Requests and Server payloads have same structure.
● The server contains the schema.
● The client dictates what it wants from the server to
provide.
Limitations of RESTful APIs
● Multiple Endpoints -- Endpoints specific to individual views
● Response Bloats -- Response contains more data, mostly
unused.
● Many Round Trips -- Complex and relational data
containing URLs.
● No backwards Compatibility -- REST APIs are versioned
● Not Introspective -- Lack Native Schema, making client
side validation difficult
● Single Endpoint -- Single Endpoint can resolve GraphQL
queries and send a single, unified
response
● Tailored Response -- Response is catered with the client
demand
● Fewer Round Trips -- Returns a single response flexible to
accommodate many relationships
● Backward Compatibility -- common response for each
version
● Introspective -- Native and Highly Extensible Schema
How GraphQL Resolves this
Operations
GraphQL provide 2 types of operations
● Query
● Mutations
Query:
query {
nodeById(id: 1) {
title
}
}
Fields can describe relationships with other data. Fields return
values and can carry arguments.
Arguments
{
nodeById(id: "1") {
title
}
}
Arguments
Fragments
GraphQL includes reusable units called fragments. Fragments let you
construct sets of fields, and then include them in queries where you
need to.
fragment nodeFields on NodeArticle {
nid
type {
targetId
}
created
}
{ nodeQuery: nodeById(id: "2") {
...nodeFields
}
}
Variables
Sometimes we need to pass dynamic values to query. We can pass
dynamic values using variables in GraphQL.
query getArticle($nid: String!) {
nodeById(id: $nid) {
title
}
}
{
"nid": "2"
}
Mutation
● Most discussions of GraphQL focus on data fetching, but any
complete data platform needs a way to modify server-side data as
well.
● A module GraphQL Mutation is needed to perform POST
operations. https://www.drupal.org/project/graphql_mutation
● The module Adds GraphQL mutations for all content entities.
mutation ($input: NodeArticleCreateInput!) {
createNodeArticle(input: $input) {
violations {
path
message
}
errors
entity {
entityId
entityBundle
entityLabel
}
}
}
Mutation
● GraphQL in action in Drupal 8
Demo
Future in Drupal
● Decoupled Drupal using React & graphQL . An example is given on
https://github.com/fubhy/drupal-decoupled-app
● A number of modules supported by amazee.io.
https://www.amazeelabs.com/en/blog/drupal-graphql-batt
Eries-included
● Drupal and GraphQL with React and Apollo
https://www.amazeelabs.com/en/blog/drupal-graphql-react-apollo
Thank you

More Related Content

What's hot (20)

PDF
GraphQL
Joel Corrêa
 
PDF
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
luisw19
 
PDF
React & GraphQL
Nikolas Burk
 
PPTX
GraphQL Introduction
Serge Huber
 
PPTX
Introduction to graphQL
Muhilvarnan V
 
PDF
GraphQL: Enabling a new generation of API developer tools
Sashko Stubailo
 
PDF
Better APIs with GraphQL
Josh Price
 
PDF
Introduction to GraphQL
Appier
 
PPTX
GraphQL API Gateway and microservices
Mohammed Shaban
 
PDF
How to GraphQL
Tomasz Bak
 
PDF
GraphQL
Cédric GILLET
 
PDF
GraphQL Fundamentals
Virbhadra Ankalkote
 
PDF
REST API and CRUD
Prem Sanil
 
PDF
Spring GraphQL
VMware Tanzu
 
PDF
GraphQL vs REST
GreeceJS
 
PPTX
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Scrum Breakfast Vietnam
 
PPTX
Ajax and Jquery
People Strategists
 
PDF
Laravel Introduction
Ahmad Shah Hafizan Hamidin
 
PPTX
Intro to React
Justin Reock
 
PDF
Angular
Lilia Sfaxi
 
GraphQL
Joel Corrêa
 
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
luisw19
 
React & GraphQL
Nikolas Burk
 
GraphQL Introduction
Serge Huber
 
Introduction to graphQL
Muhilvarnan V
 
GraphQL: Enabling a new generation of API developer tools
Sashko Stubailo
 
Better APIs with GraphQL
Josh Price
 
Introduction to GraphQL
Appier
 
GraphQL API Gateway and microservices
Mohammed Shaban
 
How to GraphQL
Tomasz Bak
 
GraphQL Fundamentals
Virbhadra Ankalkote
 
REST API and CRUD
Prem Sanil
 
Spring GraphQL
VMware Tanzu
 
GraphQL vs REST
GreeceJS
 
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Scrum Breakfast Vietnam
 
Ajax and Jquery
People Strategists
 
Laravel Introduction
Ahmad Shah Hafizan Hamidin
 
Intro to React
Justin Reock
 
Angular
Lilia Sfaxi
 

Similar to An intro to GraphQL (20)

PDF
GraphQL
Deepak Shevani
 
PDF
GraphQL with .NET Core Microservices.pdf
Knoldus Inc.
 
PPTX
Intro to GraphQL for Database Developers
Daniel McGhan
 
PDF
PHP, the GraphQL ecosystem and GraphQLite
JEAN-GUILLAUME DUJARDIN
 
PDF
Let's start GraphQL: structure, behavior, and architecture
Andrii Gakhov
 
PPTX
GraphQl Introduction
AbhayKumarAgrawal1
 
PDF
GraphQL - A love story
bwullems
 
PDF
GraphQL + relay
Cédric GILLET
 
PPTX
GraphQL Introduction with Spring Boot
vipin kumar
 
PPTX
Introduction to Graph QL
Deepak More
 
PDF
Modern APIs with GraphQL
Taikai
 
PDF
GraphQL IndyJS April 2016
Brad Pillow
 
PDF
GraphQL and Relay Modern
Carmel JavaScript Roundabout
 
PDF
GraphQL And Relay Modern
Brad Pillow
 
PDF
GraphQL And Relay Modern
Brad Pillow
 
PDF
GraphQL the holy contract between client and server
Pavel Chertorogov
 
PPTX
Into to GraphQL
shobot
 
PDF
GraphQL in Symfony
Bernd Alter
 
PPTX
Graphql
Girish Talekar
 
PPTX
Building a GraphQL API in PHP
Andrew Rota
 
GraphQL with .NET Core Microservices.pdf
Knoldus Inc.
 
Intro to GraphQL for Database Developers
Daniel McGhan
 
PHP, the GraphQL ecosystem and GraphQLite
JEAN-GUILLAUME DUJARDIN
 
Let's start GraphQL: structure, behavior, and architecture
Andrii Gakhov
 
GraphQl Introduction
AbhayKumarAgrawal1
 
GraphQL - A love story
bwullems
 
GraphQL + relay
Cédric GILLET
 
GraphQL Introduction with Spring Boot
vipin kumar
 
Introduction to Graph QL
Deepak More
 
Modern APIs with GraphQL
Taikai
 
GraphQL IndyJS April 2016
Brad Pillow
 
GraphQL and Relay Modern
Carmel JavaScript Roundabout
 
GraphQL And Relay Modern
Brad Pillow
 
GraphQL And Relay Modern
Brad Pillow
 
GraphQL the holy contract between client and server
Pavel Chertorogov
 
Into to GraphQL
shobot
 
GraphQL in Symfony
Bernd Alter
 
Building a GraphQL API in PHP
Andrew Rota
 
Ad

More from valuebound (20)

PDF
Scaling Drupal for High Traffic Websites
valuebound
 
PDF
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
valuebound
 
PDF
How to Use DDEV to Streamline Your Drupal Development Process.
valuebound
 
PDF
How to Use AWS to Automate Your IT Operation| Valuebound
valuebound
 
PDF
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
valuebound
 
PDF
Mastering Drupal Theming
valuebound
 
PDF
The Benefits of Cloud Engineering
valuebound
 
PDF
Cloud Computing
valuebound
 
PDF
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
valuebound
 
PDF
Deep dive into ChatGPT
valuebound
 
PDF
Content Creation Solution | Valuebound
valuebound
 
PPTX
Road ahead for Drupal 8 contributed projects
valuebound
 
PPTX
Chatbot with RASA | Valuebound
valuebound
 
PDF
Drupal and Artificial Intelligence for Personalization
valuebound
 
PPTX
Drupal growth in last year | Valuebound
valuebound
 
PPTX
BE NEW TO THE WORLD "BRAVE FROM CHROME"
valuebound
 
PPTX
Event loop in browser
valuebound
 
PPTX
The Basics of MongoDB
valuebound
 
PPTX
React JS: A Secret Preview
valuebound
 
PPTX
Dependency Injection in Drupal 8
valuebound
 
Scaling Drupal for High Traffic Websites
valuebound
 
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
valuebound
 
How to Use DDEV to Streamline Your Drupal Development Process.
valuebound
 
How to Use AWS to Automate Your IT Operation| Valuebound
valuebound
 
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
valuebound
 
Mastering Drupal Theming
valuebound
 
The Benefits of Cloud Engineering
valuebound
 
Cloud Computing
valuebound
 
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
valuebound
 
Deep dive into ChatGPT
valuebound
 
Content Creation Solution | Valuebound
valuebound
 
Road ahead for Drupal 8 contributed projects
valuebound
 
Chatbot with RASA | Valuebound
valuebound
 
Drupal and Artificial Intelligence for Personalization
valuebound
 
Drupal growth in last year | Valuebound
valuebound
 
BE NEW TO THE WORLD "BRAVE FROM CHROME"
valuebound
 
Event loop in browser
valuebound
 
The Basics of MongoDB
valuebound
 
React JS: A Secret Preview
valuebound
 
Dependency Injection in Drupal 8
valuebound
 
Ad

Recently uploaded (20)

PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
July Patch Tuesday
Ivanti
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
July Patch Tuesday
Ivanti
 

An intro to GraphQL

  • 1. An intro to GraphQL Suraj Paul https://www.drupal.org/u/suraj2012
  • 2. ● Data Query Language developed by Facebook in 2012. ● Released publicly in 2015. ● GraphQL is a query language for your API, and a server-side runtime for executing queries by using a type system you define for your data. ● GraphQL isn't tied to any specific database or storage engine and is instead backed by your existing code and data. ● Drupal 8 provides module to create and expose graphQL schema. https://www.drupal.org/project/graphql What is GraphQL ?
  • 3. Core Ideas of GraphQL ● Client Requests and Server payloads have same structure. ● The server contains the schema. ● The client dictates what it wants from the server to provide.
  • 4. Limitations of RESTful APIs ● Multiple Endpoints -- Endpoints specific to individual views ● Response Bloats -- Response contains more data, mostly unused. ● Many Round Trips -- Complex and relational data containing URLs. ● No backwards Compatibility -- REST APIs are versioned ● Not Introspective -- Lack Native Schema, making client side validation difficult
  • 5. ● Single Endpoint -- Single Endpoint can resolve GraphQL queries and send a single, unified response ● Tailored Response -- Response is catered with the client demand ● Fewer Round Trips -- Returns a single response flexible to accommodate many relationships ● Backward Compatibility -- common response for each version ● Introspective -- Native and Highly Extensible Schema How GraphQL Resolves this
  • 6. Operations GraphQL provide 2 types of operations ● Query ● Mutations Query: query { nodeById(id: 1) { title } }
  • 7. Fields can describe relationships with other data. Fields return values and can carry arguments. Arguments { nodeById(id: "1") { title } } Arguments
  • 8. Fragments GraphQL includes reusable units called fragments. Fragments let you construct sets of fields, and then include them in queries where you need to. fragment nodeFields on NodeArticle { nid type { targetId } created } { nodeQuery: nodeById(id: "2") { ...nodeFields } }
  • 9. Variables Sometimes we need to pass dynamic values to query. We can pass dynamic values using variables in GraphQL. query getArticle($nid: String!) { nodeById(id: $nid) { title } } { "nid": "2" }
  • 10. Mutation ● Most discussions of GraphQL focus on data fetching, but any complete data platform needs a way to modify server-side data as well. ● A module GraphQL Mutation is needed to perform POST operations. https://www.drupal.org/project/graphql_mutation ● The module Adds GraphQL mutations for all content entities.
  • 11. mutation ($input: NodeArticleCreateInput!) { createNodeArticle(input: $input) { violations { path message } errors entity { entityId entityBundle entityLabel } } } Mutation
  • 12. ● GraphQL in action in Drupal 8 Demo
  • 13. Future in Drupal ● Decoupled Drupal using React & graphQL . An example is given on https://github.com/fubhy/drupal-decoupled-app ● A number of modules supported by amazee.io. https://www.amazeelabs.com/en/blog/drupal-graphql-batt Eries-included ● Drupal and GraphQL with React and Apollo https://www.amazeelabs.com/en/blog/drupal-graphql-react-apollo