SlideShare a Scribd company logo
2
Most read
4
Most read
16
Most read
Intro to GraphQL
Vol.01 Feb/10/2017
Hiroto Fukui
EC Marketplace RMS Development Department
Rakuten, Inc.
http://www.rakuten.co.jp/
2
Typical REST API
REST API
Server
Client
application
GET ../item?itemId=XXX
{
item{
itemId: “XXXXX”,
…
},
payment{
paymentMethodId: “XXX”,
},
campaign{
campaignId: “XXX”
}, …
}
3
Common issues for REST API
• Over fetching
o GET…/order?responseField=shipping&responseField=payment
&responseField=promotion
o GET …/user → GET …/orders → GET …/item
• Multiple I/Fs for multiple clients
o GET ../item, GET ../mobile/item
• Non-detailed error message in 4XX response
o POST ../order -> { “status”: 400, “message”: “bad request.” }
• Managing API design changes
o Versioning
o Deprecation
o Documentation
4
GraphQL?
“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.”
http://graphql.org/learn/
5
History
• Developed by facebook in 2012 for internal usage
• Specification became RFC in 2015
- “This year(2015) we've begun the process of open-sourcing GraphQL
by drafting a specification, releasing a reference implementation, and
forming a community around it at graphql.org.”
from blog post on code.facebook.com
• Exploring GraphQL - Lee Byron, React Europe 2015
• Doc: http://graphql.org/
• Implementations: https://github.com/graphql
6
GraphQL Approach
GraphQL
Client
application
Type1
- Field 1
- Field 2
Type2
- Field 3
- Field 4
Type1
- Field 1
- Field 2
Type2
- Field 3
- Field 4
runtime1
runtime2
runtime3
runtime4
- Parse
- Type Validation
My App
7
An real example1
http://api.endpoint/graphql?query={ player(playerName: "Ash") { name age items {
name quantity } } }
8
An real example2
http://api.endpoint/graphql?query={ player(playerName: "Ash") { name age} }
9
Type
10
Alias
11
Validation
12
Versioning
13
Relay
• A javascript framework for React that work with GraphQL
• Naturally integrate GraphQL API call into React component
• Manage cache, pagination, object identification
14
Demo Time
• Incrementally build applications
• From HelloWorld to calling GraphQL API from Relay app
15
When you should do, should not do?
Should
• When you build brand new UI application with brand new API
application.
• When you tired of maintaining document up-to-date
• When you answered inquiries from your clients 100 times.
• When you got to build …/v3/item/…
Should not
• When you already got many conservative clients
• When you have no time to maintain both REST and GraphQL during
migration
16
References
• Learning GraphQL and Relay by Samer Buna
• GraphQL official doc
• Relay official doc
• GraphQL with Sangria

More Related Content

PPT
Graphql presentation
PDF
GraphQL vs REST
PPTX
Introduction to GraphQL
PPTX
Introduction to GraphQL
PDF
Introduction to GraphQL
PDF
REST vs GraphQL
PPTX
An Introduction to OAuth 2
PDF
Android intents
Graphql presentation
GraphQL vs REST
Introduction to GraphQL
Introduction to GraphQL
Introduction to GraphQL
REST vs GraphQL
An Introduction to OAuth 2
Android intents

What's hot (20)

PPTX
An intro to GraphQL
PDF
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
PDF
GraphQL: Enabling a new generation of API developer tools
PDF
GraphQL
PPTX
Introduction to graphQL
PDF
GraphQL Fundamentals
PPTX
Introduction to GraphQL Presentation.pptx
PDF
React & GraphQL
PDF
How to GraphQL
PDF
The Apollo and GraphQL Stack
PDF
Spring GraphQL
PPTX
GraphQL Introduction
PDF
REST vs. GraphQL: Critical Look
PDF
Better APIs with GraphQL
PDF
Getting Started with Spring for GraphQL
PPTX
GraphQL API Gateway and microservices
PDF
Graphql
PDF
PPTX
PPTX
An intro to GraphQL
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL: Enabling a new generation of API developer tools
GraphQL
Introduction to graphQL
GraphQL Fundamentals
Introduction to GraphQL Presentation.pptx
React & GraphQL
How to GraphQL
The Apollo and GraphQL Stack
Spring GraphQL
GraphQL Introduction
REST vs. GraphQL: Critical Look
Better APIs with GraphQL
Getting Started with Spring for GraphQL
GraphQL API Gateway and microservices
Graphql
Ad

Viewers also liked (20)

PDF
楽天のプライベートクラウドを支えるフラッシュストレージ
PDF
楽天トラベルの開発プロセスに関して
PDF
Creating a team of DevOps “Super Sentai”
PDF
USING VISION SENSORS FOR INNOVATIVE HCI
PDF
GraphQL Story: Intro To GraphQL
PDF
Rakuten Ichiba_Rakuten Technology Conference 2016
PDF
IBM Watson Question-Answering System and Cognitive Computing
PDF
The Quality Gatekeeper Rakuten Travel QA
PDF
Introduction to Mindfulness
PDF
Designing kinder Experiences
PDF
Huge Enterprise Systems Architecture Design with Java EE
PDF
Sora Raku (Rakuten Drone Project)
PDF
Introduction to GraphQL
PDF
Large-Scale Machine Learning for E-commerce
PDF
Introduction to Deep Learning (NVIDIA)
PDF
Experiences with PlayStation VR
PDF
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
PDF
AI Playing Go and Driving Cars, What’s Next?
PDF
GraphQL 101
PDF
Design Sprints: Unlocking the Wisdom of Teams
楽天のプライベートクラウドを支えるフラッシュストレージ
楽天トラベルの開発プロセスに関して
Creating a team of DevOps “Super Sentai”
USING VISION SENSORS FOR INNOVATIVE HCI
GraphQL Story: Intro To GraphQL
Rakuten Ichiba_Rakuten Technology Conference 2016
IBM Watson Question-Answering System and Cognitive Computing
The Quality Gatekeeper Rakuten Travel QA
Introduction to Mindfulness
Designing kinder Experiences
Huge Enterprise Systems Architecture Design with Java EE
Sora Raku (Rakuten Drone Project)
Introduction to GraphQL
Large-Scale Machine Learning for E-commerce
Introduction to Deep Learning (NVIDIA)
Experiences with PlayStation VR
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
AI Playing Go and Driving Cars, What’s Next?
GraphQL 101
Design Sprints: Unlocking the Wisdom of Teams
Ad

Similar to Intro to GraphQL (20)

PDF
Tutorial: Building a GraphQL API in PHP
PPTX
REST API Best Practices & Implementing in Codeigniter
PDF
Graphql usage
PDF
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
PDF
Exposing GraphQLs as Managed APIs
PDF
PiterPy 2016: Parallelization, Aggregation and Validation of API in Python
PPTX
Practices and Tools for Building Better APIs
PDF
Implementing OpenAPI and GraphQL services with gRPC
PDF
FOXX - a Javascript application framework on top of ArangoDB
PDF
Hands On - GraphQL
PDF
GraphQL in an Age of REST
PDF
O reilly sacon2018nyc - restful api design - master - v1.0
PDF
APIdays Paris 2018 - Secure & Manage APIs with GraphQL, Ozair Sheikh, Directo...
PPTX
API Workshop: Deep dive into REST APIs
PDF
Camunda GraphQL Extension (09/2017 Berlin)
PDF
APIdays Helsinki 2019 - GraphQL API Management with Amit P. Acharya, IBM
PDF
London React August - GraphQL at The Financial Times - Viktor Charypar
PDF
PDF
FlutterでGraphQLを扱う
PPTX
Code first in the cloud: going serverless with Azure
Tutorial: Building a GraphQL API in PHP
REST API Best Practices & Implementing in Codeigniter
Graphql usage
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
Exposing GraphQLs as Managed APIs
PiterPy 2016: Parallelization, Aggregation and Validation of API in Python
Practices and Tools for Building Better APIs
Implementing OpenAPI and GraphQL services with gRPC
FOXX - a Javascript application framework on top of ArangoDB
Hands On - GraphQL
GraphQL in an Age of REST
O reilly sacon2018nyc - restful api design - master - v1.0
APIdays Paris 2018 - Secure & Manage APIs with GraphQL, Ozair Sheikh, Directo...
API Workshop: Deep dive into REST APIs
Camunda GraphQL Extension (09/2017 Berlin)
APIdays Helsinki 2019 - GraphQL API Management with Amit P. Acharya, IBM
London React August - GraphQL at The Financial Times - Viktor Charypar
FlutterでGraphQLを扱う
Code first in the cloud: going serverless with Azure

More from Rakuten Group, Inc. (20)

PDF
EPSS (Exploit Prediction Scoring System)モニタリングツールの開発
PPTX
コードレビュー改善のためにJenkinsとIntelliJ IDEAのプラグインを自作してみた話
PDF
楽天における安全な秘匿情報管理への道のり
PDF
What Makes Software Green?
PDF
Simple and Effective Knowledge-Driven Query Expansion for QA-Based Product At...
PDF
DataSkillCultureを浸透させる楽天の取り組み
PDF
大規模なリアルタイム監視の導入と展開
PDF
楽天における大規模データベースの運用
PDF
楽天サービスを支えるネットワークインフラストラクチャー
PDF
楽天の規模とクラウドプラットフォーム統括部の役割
PDF
Rakuten Services and Infrastructure Team.pdf
PDF
The Data Platform Administration Handling the 100 PB.pdf
PDF
Supporting Internal Customers as Technical Account Managers.pdf
PDF
Making Cloud Native CI_CD Services.pdf
PDF
How We Defined Our Own Cloud.pdf
PDF
Travel & Leisure Platform Department's tech info
PDF
Travel & Leisure Platform Department's tech info
PDF
OWASPTop10_Introduction
PDF
Introduction of GORA API Group technology
PDF
100PBを越えるデータプラットフォームの実情
EPSS (Exploit Prediction Scoring System)モニタリングツールの開発
コードレビュー改善のためにJenkinsとIntelliJ IDEAのプラグインを自作してみた話
楽天における安全な秘匿情報管理への道のり
What Makes Software Green?
Simple and Effective Knowledge-Driven Query Expansion for QA-Based Product At...
DataSkillCultureを浸透させる楽天の取り組み
大規模なリアルタイム監視の導入と展開
楽天における大規模データベースの運用
楽天サービスを支えるネットワークインフラストラクチャー
楽天の規模とクラウドプラットフォーム統括部の役割
Rakuten Services and Infrastructure Team.pdf
The Data Platform Administration Handling the 100 PB.pdf
Supporting Internal Customers as Technical Account Managers.pdf
Making Cloud Native CI_CD Services.pdf
How We Defined Our Own Cloud.pdf
Travel & Leisure Platform Department's tech info
Travel & Leisure Platform Department's tech info
OWASPTop10_Introduction
Introduction of GORA API Group technology
100PBを越えるデータプラットフォームの実情

Recently uploaded (20)

PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
Machine Learning_overview_presentation.pptx
PDF
August Patch Tuesday
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
TLE Review Electricity (Electricity).pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Advanced methodologies resolving dimensionality complications for autism neur...
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Digital-Transformation-Roadmap-for-Companies.pptx
Group 1 Presentation -Planning and Decision Making .pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Machine Learning_overview_presentation.pptx
August Patch Tuesday
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Assigned Numbers - 2025 - Bluetooth® Document
Reach Out and Touch Someone: Haptics and Empathic Computing
Per capita expenditure prediction using model stacking based on satellite ima...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
A comparative analysis of optical character recognition models for extracting...
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Building Integrated photovoltaic BIPV_UPV.pdf
SOPHOS-XG Firewall Administrator PPT.pptx
TLE Review Electricity (Electricity).pptx

Intro to GraphQL

  • 1. Intro to GraphQL Vol.01 Feb/10/2017 Hiroto Fukui EC Marketplace RMS Development Department Rakuten, Inc. http://www.rakuten.co.jp/
  • 2. 2 Typical REST API REST API Server Client application GET ../item?itemId=XXX { item{ itemId: “XXXXX”, … }, payment{ paymentMethodId: “XXX”, }, campaign{ campaignId: “XXX” }, … }
  • 3. 3 Common issues for REST API • Over fetching o GET…/order?responseField=shipping&responseField=payment &responseField=promotion o GET …/user → GET …/orders → GET …/item • Multiple I/Fs for multiple clients o GET ../item, GET ../mobile/item • Non-detailed error message in 4XX response o POST ../order -> { “status”: 400, “message”: “bad request.” } • Managing API design changes o Versioning o Deprecation o Documentation
  • 4. 4 GraphQL? “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.” http://graphql.org/learn/
  • 5. 5 History • Developed by facebook in 2012 for internal usage • Specification became RFC in 2015 - “This year(2015) we've begun the process of open-sourcing GraphQL by drafting a specification, releasing a reference implementation, and forming a community around it at graphql.org.” from blog post on code.facebook.com • Exploring GraphQL - Lee Byron, React Europe 2015 • Doc: http://graphql.org/ • Implementations: https://github.com/graphql
  • 6. 6 GraphQL Approach GraphQL Client application Type1 - Field 1 - Field 2 Type2 - Field 3 - Field 4 Type1 - Field 1 - Field 2 Type2 - Field 3 - Field 4 runtime1 runtime2 runtime3 runtime4 - Parse - Type Validation My App
  • 7. 7 An real example1 http://api.endpoint/graphql?query={ player(playerName: "Ash") { name age items { name quantity } } }
  • 13. 13 Relay • A javascript framework for React that work with GraphQL • Naturally integrate GraphQL API call into React component • Manage cache, pagination, object identification
  • 14. 14 Demo Time • Incrementally build applications • From HelloWorld to calling GraphQL API from Relay app
  • 15. 15 When you should do, should not do? Should • When you build brand new UI application with brand new API application. • When you tired of maintaining document up-to-date • When you answered inquiries from your clients 100 times. • When you got to build …/v3/item/… Should not • When you already got many conservative clients • When you have no time to maintain both REST and GraphQL during migration
  • 16. 16 References • Learning GraphQL and Relay by Samer Buna • GraphQL official doc • Relay official doc • GraphQL with Sangria