SlideShare a Scribd company logo
#MMAMD
#MMAMD
Magento 2 GraphQL Overview
Chirag Dodia
Sr. Magento Developer - Wagento
@erchiragdodia
#MMAMD
Agenda
• What is GraphQL ?
• Why GraphQL ?
• GraphQL Vs Rest
• Current state of GraphQL in Magento 2
• Developer Tools to access GraphQL
• Queries
• Mutations
• GraphQL Module Structure
#MMAMD
What is GraphQL?
● GraphQL is a new API standard that provides a more efficient, powerful and
flexible alternative to REST and SOAP Web APIs.
● GraphQL was developed and open-sourced by Facebook in 2015 and is now
maintained by a large community of companies and individuals from all over the
world.
● GraphQL enables declarative data fetching where a client can specify exactly
what data it needs from an API. Instead of multiple endpoints that return fixed
data structures, a GraphQL server only exposes a single endpoint and
responds with precisely the data a client asked for.
● GraphQL is a query language for APIs - not database. It’s a replacement of
REST.
#MMAMD
Why GraphQL?
There are mainly three reason why PWA choose GraphQL over REST.
1. With the increase of mobile usage and low internet speed in some of the mobile
devices, it is a need of powerful query language which can minimize the data
that needs to transfer over network.
1. No more client specific endpoints. With GraphQL, each client can access
precisely the data it needs.
1. Faster Frontend Development.
#MMAMD
GraphQL Vs Rest
Single endpoint to gather multiple data. Gather Data using multiple endpoint.
No More Over and Under Fetching of
Data
Over and Under Fetching of Data
Rapid Product Iterations on the
Frontend
Due to rigid structure of Rest endpoint
every time app ui change we need to
adjust the endpoint that stop rapid
development.
No more outdated docs When structure changed, docs become
outdated.
#MMAMD
State of GraphQL in Magento 2
● Support All products types
● Supports PayPal, Braintree, and Authorize.Net payment methods.
● Supports Products, Customer, Categories, CMS, Coupons, Shopping cart,
Checkout, My Account etc.
● Some of the In Progress GraphQL Coverages which will available in 2.4 version
are following
○ ReOrders
○ Order history
○ Gift wrapping and message
○ Saved Payment methods
#MMAMD
Developer Tools to Access GraphQL
● There are many GraphQL client available are ChromeiQL, Altair, Postman etc.
● You can use any of the client to access GraphQL.
● But most handy and feature reach GraphQL client is Google Chrome, Altair
GraphQL Client.
● Demo of Altair GraphQL Client.
#MMAMD
GraphQL Queries
● Queries are use to retrieve a data from database same as GET method in
REST Api.
● GraphQL queries perform read operation. This includes wide variety of
information which include following
○ Product data
○ Customer data
○ Shopping cart data
○ Store configuration data etc
#MMAMD
GraphQL Query Structure
● The optional keyword query. If no keyword specify the processor assumes the
request is a query.
● The operation name. Optional if you are not using variables in your query.
● The query name.
● The Arguments.
● Fields.
#MMAMD
GraphQL Query Structure
query operationName{
queryName(arguments){
Fields
}
}
Let’s See the Demo
#MMAMD
GraphQL Mutations
● While Queries are use to retrieve a data, mutations are use to change the data.
● Mutations are use to Create, Update and Delete operations similar to REST
POST, PUT and DELETE.
#MMAMD
GraphQL Mutations Structure
● The keyword mutation
● The operation name. Optional if you are not using variables in your query.
● The mutation name
● The Arguments.
● Fields.
#MMAMD
GraphQL Mutations Structure
mutation operationName{
MutationName(arguments){
Fields
}
}
Let’s See the Demo
#MMAMD
GraphQL Module Structure
#MMAMD
GraphQL Module’s schema.graphqls
● schema.graphqls: A GraphQL module’s schema.graphqls file defines how the
attributes defined in the module can be used in GraphQL queries and
mutations.
● It is located under app/code/Vendor/Module/etc directory.
○ It’s define structure of the query
○ Define which attributes are use for input and output.
○ Points to resolver class.
○ Serves as the source for displaying the schema in a GraphQL browser.
○ Defines which objects are cached.
#MMAMD
GraphQL Module’s Resolver Class
● A resolver performs GraphQL request processing. In general, it is responsible
for constructing a query, fetching data and performing any calculations, then
transforming the fetched and calculated data into a GraphQL array format.
Finally, it returns the results wrapped by a callable function.
● It’s located under app/code/Vendor/Module/Model/Resolver directory.
#MMAMD
Demo of GraphQL Query and
Mutation
#MMAMD
Q & A
#MMAMD
Thank You All
For Attending

More Related Content

What's hot

React vs angular what to choose for your app
React vs angular what to choose for your appReact vs angular what to choose for your app
React vs angular what to choose for your app
Concetto Labs
 
CQRS recipes or how to cook your architecture
CQRS recipes or how to cook your architectureCQRS recipes or how to cook your architecture
CQRS recipes or how to cook your architecture
Thomas Jaskula
 
Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)
Tech Triveni
 
Magento2.3 - GraphQL introduction
Magento2.3  - GraphQL introductionMagento2.3  - GraphQL introduction
Magento2.3 - GraphQL introduction
Vishakha Borkar
 
Angular state Management-NgRx
Angular state Management-NgRxAngular state Management-NgRx
Angular state Management-NgRx
Knoldus Inc.
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
Mustafa Dağdelen
 
Distributed tracing 101
Distributed tracing 101Distributed tracing 101
Distributed tracing 101
Itiel Shwartz
 
Understanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring BootUnderstanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring Boot
Kashif Ali Siddiqui
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Ryan Riley
 
Getting Started with NgRx (Redux) Angular
Getting Started with NgRx (Redux) AngularGetting Started with NgRx (Redux) Angular
Getting Started with NgRx (Redux) Angular
Gustavo Costa
 
React JS part 1
React JS part 1React JS part 1
React JS part 1
Diluka Wittahachchige
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
Amazon Web Services
 
reactJS
reactJSreactJS
reactJS
Syam Santhosh
 
OpenTelemetry For Developers
OpenTelemetry For DevelopersOpenTelemetry For Developers
OpenTelemetry For Developers
Kevin Brockhoff
 
Introduction to gRPC
Introduction to gRPCIntroduction to gRPC
Introduction to gRPC
Prakash Divy
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
 
Domain Driven Design
Domain Driven Design Domain Driven Design
Domain Driven Design
Araf Karsh Hamid
 
Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and Grafana
Arvind Kumar G.S
 
Inter-Process Communication in Microservices using gRPC
Inter-Process Communication in Microservices using gRPCInter-Process Communication in Microservices using gRPC
Inter-Process Communication in Microservices using gRPC
Shiju Varghese
 

What's hot (20)

React vs angular what to choose for your app
React vs angular what to choose for your appReact vs angular what to choose for your app
React vs angular what to choose for your app
 
CQRS recipes or how to cook your architecture
CQRS recipes or how to cook your architectureCQRS recipes or how to cook your architecture
CQRS recipes or how to cook your architecture
 
gRPC
gRPC gRPC
gRPC
 
Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)
 
Magento2.3 - GraphQL introduction
Magento2.3  - GraphQL introductionMagento2.3  - GraphQL introduction
Magento2.3 - GraphQL introduction
 
Angular state Management-NgRx
Angular state Management-NgRxAngular state Management-NgRx
Angular state Management-NgRx
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Distributed tracing 101
Distributed tracing 101Distributed tracing 101
Distributed tracing 101
 
Understanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring BootUnderstanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring Boot
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Getting Started with NgRx (Redux) Angular
Getting Started with NgRx (Redux) AngularGetting Started with NgRx (Redux) Angular
Getting Started with NgRx (Redux) Angular
 
React JS part 1
React JS part 1React JS part 1
React JS part 1
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
reactJS
reactJSreactJS
reactJS
 
OpenTelemetry For Developers
OpenTelemetry For DevelopersOpenTelemetry For Developers
OpenTelemetry For Developers
 
Introduction to gRPC
Introduction to gRPCIntroduction to gRPC
Introduction to gRPC
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
Domain Driven Design
Domain Driven Design Domain Driven Design
Domain Driven Design
 
Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and Grafana
 
Inter-Process Communication in Microservices using gRPC
Inter-Process Communication in Microservices using gRPCInter-Process Communication in Microservices using gRPC
Inter-Process Communication in Microservices using gRPC
 

Similar to Graphql Overview By Chirag Dodia

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 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_devoxx_2023.pptx
GraphQL_devoxx_2023.pptxGraphQL_devoxx_2023.pptx
GraphQL_devoxx_2023.pptx
Soham Dasgupta
 
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 Introduction
GraphQl IntroductionGraphQl Introduction
GraphQl Introduction
AbhayKumarAgrawal1
 
GraphQL-ify your APIs
GraphQL-ify your APIsGraphQL-ify your APIs
GraphQL-ify your APIs
Soham Dasgupta
 
GraphQL research summary
GraphQL research summaryGraphQL research summary
GraphQL research summary
Objectivity
 
Thiruvananthapuram Anypoint DataGraph 2 Sept.pdf
Thiruvananthapuram Anypoint DataGraph 2 Sept.pdfThiruvananthapuram Anypoint DataGraph 2 Sept.pdf
Thiruvananthapuram Anypoint DataGraph 2 Sept.pdf
Vikalp Bhalia
 
GraphQL API Gateway and microservices
GraphQL API Gateway and microservicesGraphQL API Gateway and microservices
GraphQL API Gateway and microservices
Mohammed Shaban
 
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) ExtensionSimplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
VMware Tanzu
 
Building Fullstack Serverless GraphQL APIs In The Cloud
Building Fullstack Serverless GraphQL APIs In The CloudBuilding Fullstack Serverless GraphQL APIs In The Cloud
Building Fullstack Serverless GraphQL APIs In The Cloud
Nordic APIs
 
PyCon Korea - Real World Graphene
PyCon Korea - Real World GraphenePyCon Korea - Real World Graphene
PyCon Korea - Real World Graphene
Marcin Gębala
 
GraphQL Bangkok meetup 5.0
GraphQL Bangkok meetup 5.0GraphQL Bangkok meetup 5.0
GraphQL Bangkok meetup 5.0
Tobias Meixner
 
BigQuery ML - Machine learning at scale using SQL
BigQuery ML - Machine learning at scale using SQLBigQuery ML - Machine learning at scale using SQL
BigQuery ML - Machine learning at scale using SQL
Márton Kodok
 
GraphQL-ify your API - JFall 2022
GraphQL-ify your API - JFall 2022GraphQL-ify your API - JFall 2022
GraphQL-ify your API - JFall 2022
Soham Dasgupta
 
GraphQL
GraphQLGraphQL
GraphQL
Joel Corrêa
 
Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...
Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...
Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...
MysoreMuleSoftMeetup
 
CONDG April 23 2020 - Baskar Rao - GraphQL
CONDG April 23 2020 - Baskar Rao - GraphQLCONDG April 23 2020 - Baskar Rao - GraphQL
CONDG April 23 2020 - Baskar Rao - GraphQL
Matthew Groves
 
GraphQL-ify your APIs - Devoxx UK 2021
 GraphQL-ify your APIs - Devoxx UK 2021 GraphQL-ify your APIs - Devoxx UK 2021
GraphQL-ify your APIs - Devoxx UK 2021
Soham Dasgupta
 
GraphQL and its schema as a universal layer for database access
GraphQL and its schema as a universal layer for database accessGraphQL and its schema as a universal layer for database access
GraphQL and its schema as a universal layer for database access
Connected Data World
 

Similar to Graphql Overview By Chirag Dodia (20)

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 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_devoxx_2023.pptx
GraphQL_devoxx_2023.pptxGraphQL_devoxx_2023.pptx
GraphQL_devoxx_2023.pptx
 
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 Introduction
GraphQl IntroductionGraphQl Introduction
GraphQl Introduction
 
GraphQL-ify your APIs
GraphQL-ify your APIsGraphQL-ify your APIs
GraphQL-ify your APIs
 
GraphQL research summary
GraphQL research summaryGraphQL research summary
GraphQL research summary
 
Thiruvananthapuram Anypoint DataGraph 2 Sept.pdf
Thiruvananthapuram Anypoint DataGraph 2 Sept.pdfThiruvananthapuram Anypoint DataGraph 2 Sept.pdf
Thiruvananthapuram Anypoint DataGraph 2 Sept.pdf
 
GraphQL API Gateway and microservices
GraphQL API Gateway and microservicesGraphQL API Gateway and microservices
GraphQL API Gateway and microservices
 
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) ExtensionSimplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
 
Building Fullstack Serverless GraphQL APIs In The Cloud
Building Fullstack Serverless GraphQL APIs In The CloudBuilding Fullstack Serverless GraphQL APIs In The Cloud
Building Fullstack Serverless GraphQL APIs In The Cloud
 
PyCon Korea - Real World Graphene
PyCon Korea - Real World GraphenePyCon Korea - Real World Graphene
PyCon Korea - Real World Graphene
 
GraphQL Bangkok meetup 5.0
GraphQL Bangkok meetup 5.0GraphQL Bangkok meetup 5.0
GraphQL Bangkok meetup 5.0
 
BigQuery ML - Machine learning at scale using SQL
BigQuery ML - Machine learning at scale using SQLBigQuery ML - Machine learning at scale using SQL
BigQuery ML - Machine learning at scale using SQL
 
GraphQL-ify your API - JFall 2022
GraphQL-ify your API - JFall 2022GraphQL-ify your API - JFall 2022
GraphQL-ify your API - JFall 2022
 
GraphQL
GraphQLGraphQL
GraphQL
 
Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...
Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...
Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...
 
CONDG April 23 2020 - Baskar Rao - GraphQL
CONDG April 23 2020 - Baskar Rao - GraphQLCONDG April 23 2020 - Baskar Rao - GraphQL
CONDG April 23 2020 - Baskar Rao - GraphQL
 
GraphQL-ify your APIs - Devoxx UK 2021
 GraphQL-ify your APIs - Devoxx UK 2021 GraphQL-ify your APIs - Devoxx UK 2021
GraphQL-ify your APIs - Devoxx UK 2021
 
GraphQL and its schema as a universal layer for database access
GraphQL and its schema as a universal layer for database accessGraphQL and its schema as a universal layer for database access
GraphQL and its schema as a universal layer for database access
 

Recently uploaded

How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 

Recently uploaded (20)

How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 

Graphql Overview By Chirag Dodia

  • 2. #MMAMD Magento 2 GraphQL Overview Chirag Dodia Sr. Magento Developer - Wagento @erchiragdodia
  • 3. #MMAMD Agenda • What is GraphQL ? • Why GraphQL ? • GraphQL Vs Rest • Current state of GraphQL in Magento 2 • Developer Tools to access GraphQL • Queries • Mutations • GraphQL Module Structure
  • 4. #MMAMD What is GraphQL? ● GraphQL is a new API standard that provides a more efficient, powerful and flexible alternative to REST and SOAP Web APIs. ● GraphQL was developed and open-sourced by Facebook in 2015 and is now maintained by a large community of companies and individuals from all over the world. ● GraphQL enables declarative data fetching where a client can specify exactly what data it needs from an API. Instead of multiple endpoints that return fixed data structures, a GraphQL server only exposes a single endpoint and responds with precisely the data a client asked for. ● GraphQL is a query language for APIs - not database. It’s a replacement of REST.
  • 5. #MMAMD Why GraphQL? There are mainly three reason why PWA choose GraphQL over REST. 1. With the increase of mobile usage and low internet speed in some of the mobile devices, it is a need of powerful query language which can minimize the data that needs to transfer over network. 1. No more client specific endpoints. With GraphQL, each client can access precisely the data it needs. 1. Faster Frontend Development.
  • 6. #MMAMD GraphQL Vs Rest Single endpoint to gather multiple data. Gather Data using multiple endpoint. No More Over and Under Fetching of Data Over and Under Fetching of Data Rapid Product Iterations on the Frontend Due to rigid structure of Rest endpoint every time app ui change we need to adjust the endpoint that stop rapid development. No more outdated docs When structure changed, docs become outdated.
  • 7. #MMAMD State of GraphQL in Magento 2 ● Support All products types ● Supports PayPal, Braintree, and Authorize.Net payment methods. ● Supports Products, Customer, Categories, CMS, Coupons, Shopping cart, Checkout, My Account etc. ● Some of the In Progress GraphQL Coverages which will available in 2.4 version are following ○ ReOrders ○ Order history ○ Gift wrapping and message ○ Saved Payment methods
  • 8. #MMAMD Developer Tools to Access GraphQL ● There are many GraphQL client available are ChromeiQL, Altair, Postman etc. ● You can use any of the client to access GraphQL. ● But most handy and feature reach GraphQL client is Google Chrome, Altair GraphQL Client. ● Demo of Altair GraphQL Client.
  • 9. #MMAMD GraphQL Queries ● Queries are use to retrieve a data from database same as GET method in REST Api. ● GraphQL queries perform read operation. This includes wide variety of information which include following ○ Product data ○ Customer data ○ Shopping cart data ○ Store configuration data etc
  • 10. #MMAMD GraphQL Query Structure ● The optional keyword query. If no keyword specify the processor assumes the request is a query. ● The operation name. Optional if you are not using variables in your query. ● The query name. ● The Arguments. ● Fields.
  • 11. #MMAMD GraphQL Query Structure query operationName{ queryName(arguments){ Fields } } Let’s See the Demo
  • 12. #MMAMD GraphQL Mutations ● While Queries are use to retrieve a data, mutations are use to change the data. ● Mutations are use to Create, Update and Delete operations similar to REST POST, PUT and DELETE.
  • 13. #MMAMD GraphQL Mutations Structure ● The keyword mutation ● The operation name. Optional if you are not using variables in your query. ● The mutation name ● The Arguments. ● Fields.
  • 14. #MMAMD GraphQL Mutations Structure mutation operationName{ MutationName(arguments){ Fields } } Let’s See the Demo
  • 16. #MMAMD GraphQL Module’s schema.graphqls ● schema.graphqls: A GraphQL module’s schema.graphqls file defines how the attributes defined in the module can be used in GraphQL queries and mutations. ● It is located under app/code/Vendor/Module/etc directory. ○ It’s define structure of the query ○ Define which attributes are use for input and output. ○ Points to resolver class. ○ Serves as the source for displaying the schema in a GraphQL browser. ○ Defines which objects are cached.
  • 17. #MMAMD GraphQL Module’s Resolver Class ● A resolver performs GraphQL request processing. In general, it is responsible for constructing a query, fetching data and performing any calculations, then transforming the fetched and calculated data into a GraphQL array format. Finally, it returns the results wrapped by a callable function. ● It’s located under app/code/Vendor/Module/Model/Resolver directory.
  • 18. #MMAMD Demo of GraphQL Query and Mutation