SlideShare une entreprise Scribd logo
1  sur  40
Télécharger pour lire hors ligne
More power to API clients
with GraphQL
Yann Simon - @simon_yann
Who am I
• Yann Simon, backend developer at commercetools
• in the last years, worked with REST APIs:
• for micro-services
• public APIs
Let’s build a
REST API
Let’s build an
e-commerce API
Let’s build an
e-commerce API
surprise surprise
GET /products/45
GET /products/45
{

"id": "45",

"name": "running shoes",

"price": {

"centAmount": 3900,

"currencyCode": "USD"

}

}
GET /products/45
GET /products/45
{

"id": "45",

"name": "running shoes",

"masterVariant": {

"description": "white color",

"price": {

"centAmount": 3900,

"currencyCode": "USD"

}

}

}
GET /products/45
GET /products/45
{

"id": "45",

"name": "running shoes",

"masterVariant": {

"description": "white color",

"price": {

"centAmount": 3900,

"currencyCode": "USD"

}

},

"variants": [

{

"description": "black color",

"price": {

"centAmount": 3600,

"currencyCode": "USD"

}

},

{

"description": "red color",

"price": {

"centAmount": 3500,

"currencyCode": "USD"

}

}

]

}
GET /products/45
{

"id": "45",

"name": "running shoes",

"masterVariant": {

"description": "white color",

"price": {

"centAmount": 3900,

"currencyCode": "USD"

}

},

"variants": [

{

"description": "black color",

"price": {

"centAmount": 3600,

"currencyCode": "USD"

}

},

{

"description": "red color",

"price": {

"centAmount": 3500,

"currencyCode": "USD"

}

}

]

}
OR?
GET /products/45
GET /products/45
{

"id": "45",

"name": "running shoes",

"masterVariant": {

"id": "3",

"description": "white color",

"price": {

"centAmount": 3900,

"currencyCode": "USD"

}

},

"variantIds": [ "23", "18" ]

}
GET /products/45
{

"id": "45",

"name": "running shoes",

"masterVariant": {

"id": "3",

"description": "white color",

"price": {

"centAmount": 3900,

"currencyCode": "USD"

}

},

"variantIds": [ "23", "18" ]

}
GET /products/45/variants/23
GET /products/45
{

"id": "45",

"name": "running shoes",

"masterVariant": {

"id": "3",

"description": "white color",

"price": {

"centAmount": 3900,

"currencyCode": "USD"

}

},

"variantIds": [ "23", "18" ]

}
GET /products/45/variants/23
{

"id": "23",

"description": "black color",

"price": {

"centAmount": 3600,

"currencyCode": "USD"

}

}
GET /products/45
{

"id": "45",

"name": "running shoes",

"masterVariant": {

"id": "3",

"description": "white color",

"price": {

"centAmount": 3900,

"currencyCode": "USD"

}

},

"variantIds": [ "23", "18" ]

}
GET /products/45/variants/23
GET /products/45/variants/18
{

"id": "23",

"description": "black color",

"price": {

"centAmount": 3600,

"currencyCode": "USD"

}

}
GET /products/45
{

"id": "45",

"name": "running shoes",

"masterVariant": {

"id": "3",

"description": "white color",

"price": {

"centAmount": 3900,

"currencyCode": "USD"

}

},

"variantIds": [ "23", "18" ]

}
GET /products/45/variants/23
GET /products/45/variants/18
{

"id": "23",

"description": "black color",

"price": {

"centAmount": 3600,

"currencyCode": "USD"

}

}
{

"id": "18",

"description": "red color",

"price": {

"centAmount": 3500,

"currencyCode": "USD"

}

}
More data, maybe unused
or
more requests?
Let’s build this API
with GraphQL
Demo
With GraphQL
• the client decides which fields are needed
With GraphQL
• the client decides which fields are needed
{

product(id: "45") {

name

masterVariant {

description

price {

centAmount

currencyCode

}

}

variants {

description

price {

centAmount

currencyCode

}

}

}

}
With GraphQL
• the client decides which fields are needed
{

product(id: "45") {

name

masterVariant {

description

price {

centAmount

currencyCode

}

}

variants {

description

price {

centAmount

currencyCode

}

}

}

}
With GraphQL
• the client decides which fields are needed
{

product(id: "45") {

name

masterVariant {

description

price {

centAmount

currencyCode

}

}

variants {

description

price {

centAmount

currencyCode

}

}

}

}
{

"data": {

"product": {

"name": "running shoes",

"masterVariant": {

"description": "white",

"price": {

"centAmount": 3900,

"currencyCode": "USD"

}

},

"variants": [

{

"description": "white",

"price": {

"centAmount": 3900,

"currencyCode": "USD"

}

},

{

"description": "black",

• exactly the data the client needs
• in one request
{

p45: product(id: "45") {

name

}



p54: product(id: "54") {

name

canBeCombinedWith {

id

name

}

}

}
• exactly the data the client needs
• in one request
{

p45: product(id: "45") {

name

}



p54: product(id: "54") {

name

canBeCombinedWith {

id

name

}

}

}
• exactly the data the client needs
• in one request
{

p45: product(id: "45") {

name

}



p54: product(id: "54") {

name

canBeCombinedWith {

id

name

}

}

}
{

"data": {

"p45": {

"name": "running shoes"

},

"p54": {

"name": "basketball shirt",

"canBeCombinedWith": [

{

"id": "46",

"name": "basketball shoes"

},

{

"id": "58",

"name": "basketball T-shirt"

}

]

}

}

}
• exactly the data the client needs
• in one request
{

p45: product(id: "45") {

name

}



p54: product(id: "54") {

name

canBeCombinedWith {

id

name

}

}

}
{

"data": {

"p45": {

"name": "running shoes"

},

"p54": {

"name": "basketball shirt",

"canBeCombinedWith": [

{

"id": "46",

"name": "basketball shoes"

},

{

"id": "58",

"name": "basketball T-shirt"

}

]

}

}

}
• exactly the data the client needs
• in one request
m
obile
friendly
With GraphQL
• the client has more power
{

product(id: "45") {

variants(master: false, limit: 10, offset: 20) {

price {

centAmount

}

}

}

}

• and the server can be more generic
Introspection
{

__type(name: "product") {

fields {

name

}

}

}

{

"data": {

"__type": {

"fields": [

{

"name": "id"

},

{

"name": "name"

},

{

"name": "masterVariant"

},

{

• the schema is used:
• to validate the queries (server & maybe client)
• for introspection
• for documentation
API evolution
GET /products/45
{

"id": "45",

"name": "running shoes",

"masterVariant": {

"description": "white color",

"price": {

"centAmount": 3900,

"currencyCode": "USD"

}

}

}
API evolution
GET /products/45
{

"id": "45",

"name": "running shoes",

"masterVariant": {

"description": "white color",

"price": {

"centAmount": 3900,

"currencyCode": "USD"

}

}

}
{

"id": "45",

"names": {

"en": "running shoes",

"fr": "godasses pour courir vite"

},

"name": "running shoes",

"masterVariant": {

"descriptions": {

"en": "white color",

"fr": "couleur blanche"

},

"description": "white color",

"prices": {

"us": {

"centAmount": 3900,

"currencyCode": "USD"

},

"fr": {

"centAmount": 3400,

"currencyCode": "EUR"

}

},

"price": {

"centAmount": 3900,

"currencyCode": "USD"

}

}

}
Can we remove a
deprecated field?
Let’s modify our
GraphQL based API
Demo
With GraphQL
• a field can be deprecated
• still valid for a query
• not in the schema anymore
• the server can track if a field is used
• the field can be removed when not used anymore
REST vs GraphQL?
• REST is here to stay
• simple
• widely used
• GraphQL
• different approach
• solve some limits of REST
ecosystem
• used in Facebook’s native apps in production since 2012
• open source in July 2015
• specification
• backend agnostic
• implementation in different languages
• nodejs, java, scala, ruby, php and many more
• front-end frameworks based on GraphQL like relay
So you want to try it?
• https://learngraphql.com/
• create an account on https://admin.sphere.io/
• you can create a project with sample data
• try GraphQL with this account on https://
impex.sphere.io/graphiql
Thanks for your attention
Yann Simon - @simon_yann

Contenu connexe

Tendances

Graphql presentation
Graphql presentationGraphql presentation
Graphql presentationVibhor Grover
 
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 togetherSashko Stubailo
 
GraphQL in an Age of REST
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of RESTYos Riady
 
Adding GraphQL to your existing architecture
Adding GraphQL to your existing architectureAdding GraphQL to your existing architecture
Adding GraphQL to your existing architectureSashko Stubailo
 
GraphQL Introduction
GraphQL IntroductionGraphQL Introduction
GraphQL IntroductionSerge Huber
 
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...luisw19
 
An intro to GraphQL
An intro to GraphQLAn intro to GraphQL
An intro to GraphQLvaluebound
 
GraphQL: The Missing Link Between Frontend and Backend Devs
GraphQL: The Missing Link Between Frontend and Backend DevsGraphQL: The Missing Link Between Frontend and Backend Devs
GraphQL: The Missing Link Between Frontend and Backend DevsSashko Stubailo
 
The Apollo and GraphQL Stack
The Apollo and GraphQL StackThe Apollo and GraphQL Stack
The Apollo and GraphQL StackSashko Stubailo
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQLRodrigo Prates
 
Modular GraphQL with Schema Stitching
Modular GraphQL with Schema StitchingModular GraphQL with Schema Stitching
Modular GraphQL with Schema StitchingSashko Stubailo
 
How web works and browser works ? (behind the scenes)
How web works and browser works ? (behind the scenes)How web works and browser works ? (behind the scenes)
How web works and browser works ? (behind the scenes)Vibhor Grover
 
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern AppsMeteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern AppsSashko Stubailo
 

Tendances (20)

Graphql presentation
Graphql presentationGraphql presentation
Graphql presentation
 
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 in an Age of REST
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of REST
 
Adding GraphQL to your existing architecture
Adding GraphQL to your existing architectureAdding GraphQL to your existing architecture
Adding GraphQL to your existing architecture
 
GraphQL Introduction
GraphQL IntroductionGraphQL Introduction
GraphQL Introduction
 
GraphQL
GraphQLGraphQL
GraphQL
 
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
 
An intro to GraphQL
An intro to GraphQLAn intro to GraphQL
An intro to GraphQL
 
GraphQL: The Missing Link Between Frontend and Backend Devs
GraphQL: The Missing Link Between Frontend and Backend DevsGraphQL: The Missing Link Between Frontend and Backend Devs
GraphQL: The Missing Link Between Frontend and Backend Devs
 
GraphQL
GraphQLGraphQL
GraphQL
 
The Apollo and GraphQL Stack
The Apollo and GraphQL StackThe Apollo and GraphQL Stack
The Apollo and GraphQL Stack
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
GraphQL + relay
GraphQL + relayGraphQL + relay
GraphQL + relay
 
GraphQL Search
GraphQL SearchGraphQL Search
GraphQL Search
 
Modular GraphQL with Schema Stitching
Modular GraphQL with Schema StitchingModular GraphQL with Schema Stitching
Modular GraphQL with Schema Stitching
 
Graphql
GraphqlGraphql
Graphql
 
How web works and browser works ? (behind the scenes)
How web works and browser works ? (behind the scenes)How web works and browser works ? (behind the scenes)
How web works and browser works ? (behind the scenes)
 
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern AppsMeteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
 
GraphQL & Relay
GraphQL & RelayGraphQL & Relay
GraphQL & Relay
 

En vedette

Introduction to rust: a low-level language with high-level abstractions
Introduction to rust: a low-level language with high-level abstractionsIntroduction to rust: a low-level language with high-level abstractions
Introduction to rust: a low-level language with high-level abstractionsyann_s
 
GraphQL vs REST
GraphQL vs RESTGraphQL vs REST
GraphQL vs RESTGreeceJS
 
GraphQL Story: Intro To GraphQL
GraphQL Story: Intro To GraphQLGraphQL Story: Intro To GraphQL
GraphQL Story: Intro To GraphQLRiza Fahmi
 
GraphQL IndyJS April 2016
GraphQL IndyJS April 2016GraphQL IndyJS April 2016
GraphQL IndyJS April 2016Brad Pillow
 
Zensations Drupal 8 GraphQL Presentation 2015
Zensations Drupal 8 GraphQL Presentation 2015Zensations Drupal 8 GraphQL Presentation 2015
Zensations Drupal 8 GraphQL Presentation 2015Zensations GmbH
 
GraphQL Relay Introduction
GraphQL Relay IntroductionGraphQL Relay Introduction
GraphQL Relay IntroductionChen-Tsu Lin
 
Relay: Seamless Syncing for React (VanJS)
Relay: Seamless Syncing for React (VanJS)Relay: Seamless Syncing for React (VanJS)
Relay: Seamless Syncing for React (VanJS)Brooklyn Zelenka
 
Work with V8 memory leaks
Work with V8 memory leaksWork with V8 memory leaks
Work with V8 memory leaksRoman Krivtsov
 
Migration microservices to GraphQL
Migration microservices to GraphQLMigration microservices to GraphQL
Migration microservices to GraphQLRoman Krivtsov
 
React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)
React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)
React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)Pavel Chertorogov
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQLBrainhub
 
London React August - GraphQL at The Financial Times - Viktor Charypar
London React August - GraphQL at The Financial Times - Viktor CharyparLondon React August - GraphQL at The Financial Times - Viktor Charypar
London React August - GraphQL at The Financial Times - Viktor CharyparReact London Community
 
B plan ppt format
B plan ppt formatB plan ppt format
B plan ppt formatAkshit Raja
 
Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)Rafael Wilber Kerr
 
Javascript State of the Union 2015 - English
Javascript State of the Union 2015 - EnglishJavascript State of the Union 2015 - English
Javascript State of the Union 2015 - EnglishHuge
 
Social e conteúdo preditivo: como antever reações de usuários e diminuir risc...
Social e conteúdo preditivo: como antever reações de usuários e diminuir risc...Social e conteúdo preditivo: como antever reações de usuários e diminuir risc...
Social e conteúdo preditivo: como antever reações de usuários e diminuir risc...Huge
 
How to format powerpoint presentation slides
How to format powerpoint presentation slidesHow to format powerpoint presentation slides
How to format powerpoint presentation slidesmikejeffs
 
What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great InfographicsSlideShare
 

En vedette (20)

Introduction to rust: a low-level language with high-level abstractions
Introduction to rust: a low-level language with high-level abstractionsIntroduction to rust: a low-level language with high-level abstractions
Introduction to rust: a low-level language with high-level abstractions
 
GraphQL vs REST
GraphQL vs RESTGraphQL vs REST
GraphQL vs REST
 
GraphQL Story: Intro To GraphQL
GraphQL Story: Intro To GraphQLGraphQL Story: Intro To GraphQL
GraphQL Story: Intro To GraphQL
 
GraphQL IndyJS April 2016
GraphQL IndyJS April 2016GraphQL IndyJS April 2016
GraphQL IndyJS April 2016
 
Graphql
GraphqlGraphql
Graphql
 
Zensations Drupal 8 GraphQL Presentation 2015
Zensations Drupal 8 GraphQL Presentation 2015Zensations Drupal 8 GraphQL Presentation 2015
Zensations Drupal 8 GraphQL Presentation 2015
 
GraphQL Relay Introduction
GraphQL Relay IntroductionGraphQL Relay Introduction
GraphQL Relay Introduction
 
Relay: Seamless Syncing for React (VanJS)
Relay: Seamless Syncing for React (VanJS)Relay: Seamless Syncing for React (VanJS)
Relay: Seamless Syncing for React (VanJS)
 
Work with V8 memory leaks
Work with V8 memory leaksWork with V8 memory leaks
Work with V8 memory leaks
 
Migration microservices to GraphQL
Migration microservices to GraphQLMigration microservices to GraphQL
Migration microservices to GraphQL
 
React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)
React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)
React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)
 
Swift + GraphQL
Swift + GraphQLSwift + GraphQL
Swift + GraphQL
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
London React August - GraphQL at The Financial Times - Viktor Charypar
London React August - GraphQL at The Financial Times - Viktor CharyparLondon React August - GraphQL at The Financial Times - Viktor Charypar
London React August - GraphQL at The Financial Times - Viktor Charypar
 
B plan ppt format
B plan ppt formatB plan ppt format
B plan ppt format
 
Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)
 
Javascript State of the Union 2015 - English
Javascript State of the Union 2015 - EnglishJavascript State of the Union 2015 - English
Javascript State of the Union 2015 - English
 
Social e conteúdo preditivo: como antever reações de usuários e diminuir risc...
Social e conteúdo preditivo: como antever reações de usuários e diminuir risc...Social e conteúdo preditivo: como antever reações de usuários e diminuir risc...
Social e conteúdo preditivo: como antever reações de usuários e diminuir risc...
 
How to format powerpoint presentation slides
How to format powerpoint presentation slidesHow to format powerpoint presentation slides
How to format powerpoint presentation slides
 
What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great Infographics
 

Similaire à Introduction to GraphQL at API days

SDKs, the good the bad the ugly - Japan
SDKs, the good the bad the ugly - JapanSDKs, the good the bad the ugly - Japan
SDKs, the good the bad the ugly - Japantristansokol
 
Elixir, GraphQL and Vue.js
Elixir, GraphQL and Vue.jsElixir, GraphQL and Vue.js
Elixir, GraphQL and Vue.jsJeroen Visser
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedMarcinStachniuk
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedMarcinStachniuk
 
Learning to rank search results
Learning to rank search resultsLearning to rank search results
Learning to rank search resultsJettro Coenradie
 
Wave Analytics: Developing Predictive Business Intelligence Apps
Wave Analytics: Developing Predictive Business Intelligence AppsWave Analytics: Developing Predictive Business Intelligence Apps
Wave Analytics: Developing Predictive Business Intelligence AppsSalesforce Developers
 
Rich Results and Structured Data
Rich Results and Structured DataRich Results and Structured Data
Rich Results and Structured DataSMA Marketing
 
Extending spark ML for custom models now with python!
Extending spark ML for custom models  now with python!Extending spark ML for custom models  now with python!
Extending spark ML for custom models now with python!Holden Karau
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedMarcinStachniuk
 
apidays LIVE New York - Automation API Testing: with Postman collection are ...
apidays LIVE New York -  Automation API Testing: with Postman collection are ...apidays LIVE New York -  Automation API Testing: with Postman collection are ...
apidays LIVE New York - Automation API Testing: with Postman collection are ...apidays
 
Audit¢rio 09 mercado envios - novas funcionalidades - bruno elia
Audit¢rio 09   mercado envios - novas funcionalidades - bruno eliaAudit¢rio 09   mercado envios - novas funcionalidades - bruno elia
Audit¢rio 09 mercado envios - novas funcionalidades - bruno eliafsolari
 
Do more with less code in serverless
Do more with less code in serverlessDo more with less code in serverless
Do more with less code in serverlessjeromevdl
 
InterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan Soares
InterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan SoaresInterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan Soares
InterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan SoaresiMasters
 
Utilizing Arrays: Modeling, Querying and Indexing
Utilizing Arrays: Modeling, Querying and IndexingUtilizing Arrays: Modeling, Querying and Indexing
Utilizing Arrays: Modeling, Querying and IndexingKeshav Murthy
 
apidays LIVE Paris - Automation API Testing by Guillaume Jeannic
apidays LIVE Paris - Automation API Testing by Guillaume Jeannicapidays LIVE Paris - Automation API Testing by Guillaume Jeannic
apidays LIVE Paris - Automation API Testing by Guillaume Jeannicapidays
 
APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...
APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...
APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...apidays
 
APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...
APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...
APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...apidays
 
Keynote: New in MongoDB: Atlas, Charts, and Stitch
Keynote: New in MongoDB: Atlas, Charts, and StitchKeynote: New in MongoDB: Atlas, Charts, and Stitch
Keynote: New in MongoDB: Atlas, Charts, and StitchMongoDB
 
How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...
How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...
How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...Oleksandr Tarasenko
 

Similaire à Introduction to GraphQL at API days (20)

SDKs, the good the bad the ugly - Japan
SDKs, the good the bad the ugly - JapanSDKs, the good the bad the ugly - Japan
SDKs, the good the bad the ugly - Japan
 
Elixir, GraphQL and Vue.js
Elixir, GraphQL and Vue.jsElixir, GraphQL and Vue.js
Elixir, GraphQL and Vue.js
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
 
Learning to rank search results
Learning to rank search resultsLearning to rank search results
Learning to rank search results
 
Wave Analytics: Developing Predictive Business Intelligence Apps
Wave Analytics: Developing Predictive Business Intelligence AppsWave Analytics: Developing Predictive Business Intelligence Apps
Wave Analytics: Developing Predictive Business Intelligence Apps
 
Rich Results and Structured Data
Rich Results and Structured DataRich Results and Structured Data
Rich Results and Structured Data
 
Extending spark ML for custom models now with python!
Extending spark ML for custom models  now with python!Extending spark ML for custom models  now with python!
Extending spark ML for custom models now with python!
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learned
 
apidays LIVE New York - Automation API Testing: with Postman collection are ...
apidays LIVE New York -  Automation API Testing: with Postman collection are ...apidays LIVE New York -  Automation API Testing: with Postman collection are ...
apidays LIVE New York - Automation API Testing: with Postman collection are ...
 
Audit¢rio 09 mercado envios - novas funcionalidades - bruno elia
Audit¢rio 09   mercado envios - novas funcionalidades - bruno eliaAudit¢rio 09   mercado envios - novas funcionalidades - bruno elia
Audit¢rio 09 mercado envios - novas funcionalidades - bruno elia
 
Do more with less code in serverless
Do more with less code in serverlessDo more with less code in serverless
Do more with less code in serverless
 
InterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan Soares
InterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan SoaresInterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan Soares
InterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan Soares
 
Utilizing Arrays: Modeling, Querying and Indexing
Utilizing Arrays: Modeling, Querying and IndexingUtilizing Arrays: Modeling, Querying and Indexing
Utilizing Arrays: Modeling, Querying and Indexing
 
apidays LIVE Paris - Automation API Testing by Guillaume Jeannic
apidays LIVE Paris - Automation API Testing by Guillaume Jeannicapidays LIVE Paris - Automation API Testing by Guillaume Jeannic
apidays LIVE Paris - Automation API Testing by Guillaume Jeannic
 
APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...
APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...
APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...
 
APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...
APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...
APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...
 
Keynote: New in MongoDB: Atlas, Charts, and Stitch
Keynote: New in MongoDB: Atlas, Charts, and StitchKeynote: New in MongoDB: Atlas, Charts, and Stitch
Keynote: New in MongoDB: Atlas, Charts, and Stitch
 
How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...
How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...
How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...
 

Plus de yann_s

FS2 mongo reactivestreams
FS2 mongo reactivestreamsFS2 mongo reactivestreams
FS2 mongo reactivestreamsyann_s
 
Bringing a public GraphQL API from the whiteboard to production
Bringing a public GraphQL API from the whiteboard to productionBringing a public GraphQL API from the whiteboard to production
Bringing a public GraphQL API from the whiteboard to productionyann_s
 
Bringing a public GraphQL API from beta to production ready
Bringing a public GraphQL API from beta to production readyBringing a public GraphQL API from beta to production ready
Bringing a public GraphQL API from beta to production readyyann_s
 
Introduction to type classes in Scala
Introduction to type classes in ScalaIntroduction to type classes in Scala
Introduction to type classes in Scalayann_s
 
Compile time dependency injection in Play 2.4 with macwire
Compile time dependency injection in Play 2.4 with macwireCompile time dependency injection in Play 2.4 with macwire
Compile time dependency injection in Play 2.4 with macwireyann_s
 
Structure your Play application with the cake pattern (and test it)
Structure your Play application with the cake pattern (and test it)Structure your Play application with the cake pattern (and test it)
Structure your Play application with the cake pattern (and test it)yann_s
 

Plus de yann_s (6)

FS2 mongo reactivestreams
FS2 mongo reactivestreamsFS2 mongo reactivestreams
FS2 mongo reactivestreams
 
Bringing a public GraphQL API from the whiteboard to production
Bringing a public GraphQL API from the whiteboard to productionBringing a public GraphQL API from the whiteboard to production
Bringing a public GraphQL API from the whiteboard to production
 
Bringing a public GraphQL API from beta to production ready
Bringing a public GraphQL API from beta to production readyBringing a public GraphQL API from beta to production ready
Bringing a public GraphQL API from beta to production ready
 
Introduction to type classes in Scala
Introduction to type classes in ScalaIntroduction to type classes in Scala
Introduction to type classes in Scala
 
Compile time dependency injection in Play 2.4 with macwire
Compile time dependency injection in Play 2.4 with macwireCompile time dependency injection in Play 2.4 with macwire
Compile time dependency injection in Play 2.4 with macwire
 
Structure your Play application with the cake pattern (and test it)
Structure your Play application with the cake pattern (and test it)Structure your Play application with the cake pattern (and test it)
Structure your Play application with the cake pattern (and test it)
 

Dernier

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Dernier (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Introduction to GraphQL at API days

  • 1. More power to API clients with GraphQL Yann Simon - @simon_yann
  • 2. Who am I • Yann Simon, backend developer at commercetools • in the last years, worked with REST APIs: • for micro-services • public APIs
  • 5. Let’s build an e-commerce API surprise surprise
  • 7. GET /products/45 {
 "id": "45",
 "name": "running shoes",
 "price": {
 "centAmount": 3900,
 "currencyCode": "USD"
 }
 }
  • 9. GET /products/45 {
 "id": "45",
 "name": "running shoes",
 "masterVariant": {
 "description": "white color",
 "price": {
 "centAmount": 3900,
 "currencyCode": "USD"
 }
 }
 }
  • 11. GET /products/45 {
 "id": "45",
 "name": "running shoes",
 "masterVariant": {
 "description": "white color",
 "price": {
 "centAmount": 3900,
 "currencyCode": "USD"
 }
 },
 "variants": [
 {
 "description": "black color",
 "price": {
 "centAmount": 3600,
 "currencyCode": "USD"
 }
 },
 {
 "description": "red color",
 "price": {
 "centAmount": 3500,
 "currencyCode": "USD"
 }
 }
 ]
 }
  • 12. GET /products/45 {
 "id": "45",
 "name": "running shoes",
 "masterVariant": {
 "description": "white color",
 "price": {
 "centAmount": 3900,
 "currencyCode": "USD"
 }
 },
 "variants": [
 {
 "description": "black color",
 "price": {
 "centAmount": 3600,
 "currencyCode": "USD"
 }
 },
 {
 "description": "red color",
 "price": {
 "centAmount": 3500,
 "currencyCode": "USD"
 }
 }
 ]
 } OR?
  • 14. GET /products/45 {
 "id": "45",
 "name": "running shoes",
 "masterVariant": {
 "id": "3",
 "description": "white color",
 "price": {
 "centAmount": 3900,
 "currencyCode": "USD"
 }
 },
 "variantIds": [ "23", "18" ]
 }
  • 15. GET /products/45 {
 "id": "45",
 "name": "running shoes",
 "masterVariant": {
 "id": "3",
 "description": "white color",
 "price": {
 "centAmount": 3900,
 "currencyCode": "USD"
 }
 },
 "variantIds": [ "23", "18" ]
 } GET /products/45/variants/23
  • 16. GET /products/45 {
 "id": "45",
 "name": "running shoes",
 "masterVariant": {
 "id": "3",
 "description": "white color",
 "price": {
 "centAmount": 3900,
 "currencyCode": "USD"
 }
 },
 "variantIds": [ "23", "18" ]
 } GET /products/45/variants/23 {
 "id": "23",
 "description": "black color",
 "price": {
 "centAmount": 3600,
 "currencyCode": "USD"
 }
 }
  • 17. GET /products/45 {
 "id": "45",
 "name": "running shoes",
 "masterVariant": {
 "id": "3",
 "description": "white color",
 "price": {
 "centAmount": 3900,
 "currencyCode": "USD"
 }
 },
 "variantIds": [ "23", "18" ]
 } GET /products/45/variants/23 GET /products/45/variants/18 {
 "id": "23",
 "description": "black color",
 "price": {
 "centAmount": 3600,
 "currencyCode": "USD"
 }
 }
  • 18. GET /products/45 {
 "id": "45",
 "name": "running shoes",
 "masterVariant": {
 "id": "3",
 "description": "white color",
 "price": {
 "centAmount": 3900,
 "currencyCode": "USD"
 }
 },
 "variantIds": [ "23", "18" ]
 } GET /products/45/variants/23 GET /products/45/variants/18 {
 "id": "23",
 "description": "black color",
 "price": {
 "centAmount": 3600,
 "currencyCode": "USD"
 }
 } {
 "id": "18",
 "description": "red color",
 "price": {
 "centAmount": 3500,
 "currencyCode": "USD"
 }
 }
  • 19. More data, maybe unused or more requests?
  • 20. Let’s build this API with GraphQL Demo
  • 21. With GraphQL • the client decides which fields are needed
  • 22. With GraphQL • the client decides which fields are needed {
 product(id: "45") {
 name
 masterVariant {
 description
 price {
 centAmount
 currencyCode
 }
 }
 variants {
 description
 price {
 centAmount
 currencyCode
 }
 }
 }
 }
  • 23. With GraphQL • the client decides which fields are needed {
 product(id: "45") {
 name
 masterVariant {
 description
 price {
 centAmount
 currencyCode
 }
 }
 variants {
 description
 price {
 centAmount
 currencyCode
 }
 }
 }
 }
  • 24. With GraphQL • the client decides which fields are needed {
 product(id: "45") {
 name
 masterVariant {
 description
 price {
 centAmount
 currencyCode
 }
 }
 variants {
 description
 price {
 centAmount
 currencyCode
 }
 }
 }
 } {
 "data": {
 "product": {
 "name": "running shoes",
 "masterVariant": {
 "description": "white",
 "price": {
 "centAmount": 3900,
 "currencyCode": "USD"
 }
 },
 "variants": [
 {
 "description": "white",
 "price": {
 "centAmount": 3900,
 "currencyCode": "USD"
 }
 },
 {
 "description": "black",

  • 25. • exactly the data the client needs • in one request
  • 26. {
 p45: product(id: "45") {
 name
 }
 
 p54: product(id: "54") {
 name
 canBeCombinedWith {
 id
 name
 }
 }
 } • exactly the data the client needs • in one request
  • 27. {
 p45: product(id: "45") {
 name
 }
 
 p54: product(id: "54") {
 name
 canBeCombinedWith {
 id
 name
 }
 }
 } • exactly the data the client needs • in one request
  • 28. {
 p45: product(id: "45") {
 name
 }
 
 p54: product(id: "54") {
 name
 canBeCombinedWith {
 id
 name
 }
 }
 } {
 "data": {
 "p45": {
 "name": "running shoes"
 },
 "p54": {
 "name": "basketball shirt",
 "canBeCombinedWith": [
 {
 "id": "46",
 "name": "basketball shoes"
 },
 {
 "id": "58",
 "name": "basketball T-shirt"
 }
 ]
 }
 }
 } • exactly the data the client needs • in one request
  • 29. {
 p45: product(id: "45") {
 name
 }
 
 p54: product(id: "54") {
 name
 canBeCombinedWith {
 id
 name
 }
 }
 } {
 "data": {
 "p45": {
 "name": "running shoes"
 },
 "p54": {
 "name": "basketball shirt",
 "canBeCombinedWith": [
 {
 "id": "46",
 "name": "basketball shoes"
 },
 {
 "id": "58",
 "name": "basketball T-shirt"
 }
 ]
 }
 }
 } • exactly the data the client needs • in one request m obile friendly
  • 30. With GraphQL • the client has more power {
 product(id: "45") {
 variants(master: false, limit: 10, offset: 20) {
 price {
 centAmount
 }
 }
 }
 }
 • and the server can be more generic
  • 31. Introspection {
 __type(name: "product") {
 fields {
 name
 }
 }
 }
 {
 "data": {
 "__type": {
 "fields": [
 {
 "name": "id"
 },
 {
 "name": "name"
 },
 {
 "name": "masterVariant"
 },
 {
 • the schema is used: • to validate the queries (server & maybe client) • for introspection • for documentation
  • 32. API evolution GET /products/45 {
 "id": "45",
 "name": "running shoes",
 "masterVariant": {
 "description": "white color",
 "price": {
 "centAmount": 3900,
 "currencyCode": "USD"
 }
 }
 }
  • 33. API evolution GET /products/45 {
 "id": "45",
 "name": "running shoes",
 "masterVariant": {
 "description": "white color",
 "price": {
 "centAmount": 3900,
 "currencyCode": "USD"
 }
 }
 } {
 "id": "45",
 "names": {
 "en": "running shoes",
 "fr": "godasses pour courir vite"
 },
 "name": "running shoes",
 "masterVariant": {
 "descriptions": {
 "en": "white color",
 "fr": "couleur blanche"
 },
 "description": "white color",
 "prices": {
 "us": {
 "centAmount": 3900,
 "currencyCode": "USD"
 },
 "fr": {
 "centAmount": 3400,
 "currencyCode": "EUR"
 }
 },
 "price": {
 "centAmount": 3900,
 "currencyCode": "USD"
 }
 }
 }
  • 34. Can we remove a deprecated field?
  • 35. Let’s modify our GraphQL based API Demo
  • 36. With GraphQL • a field can be deprecated • still valid for a query • not in the schema anymore • the server can track if a field is used • the field can be removed when not used anymore
  • 37. REST vs GraphQL? • REST is here to stay • simple • widely used • GraphQL • different approach • solve some limits of REST
  • 38. ecosystem • used in Facebook’s native apps in production since 2012 • open source in July 2015 • specification • backend agnostic • implementation in different languages • nodejs, java, scala, ruby, php and many more • front-end frameworks based on GraphQL like relay
  • 39. So you want to try it? • https://learngraphql.com/ • create an account on https://admin.sphere.io/ • you can create a project with sample data • try GraphQL with this account on https:// impex.sphere.io/graphiql
  • 40. Thanks for your attention Yann Simon - @simon_yann