SlideShare a Scribd company logo
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

More Related Content

PDF
Performance optimisation with GraphQL
PDF
Better APIs with GraphQL
PDF
GraphQL: Enabling a new generation of API developer tools
PPTX
GraphQL, Redux, and React
PDF
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
PDF
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
PDF
Intro to GraphQL
PPTX
Taking Control of your Data with GraphQL
Performance optimisation with GraphQL
Better APIs with GraphQL
GraphQL: Enabling a new generation of API developer tools
GraphQL, Redux, and React
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Intro to GraphQL
Taking Control of your Data with GraphQL

What's hot (20)

PPT
Graphql presentation
PDF
GraphQL across the stack: How everything fits together
PDF
GraphQL in an Age of REST
PDF
Adding GraphQL to your existing architecture
PPTX
GraphQL Introduction
PDF
GraphQL
PDF
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
PPTX
An intro to GraphQL
PDF
GraphQL: The Missing Link Between Frontend and Backend Devs
PDF
PDF
The Apollo and GraphQL Stack
PPTX
Introduction to GraphQL
PPTX
Introduction to GraphQL
PDF
GraphQL + relay
PDF
GraphQL Search
PDF
Modular GraphQL with Schema Stitching
PDF
Graphql
PDF
How web works and browser works ? (behind the scenes)
PDF
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
PDF
GraphQL & Relay
Graphql presentation
GraphQL across the stack: How everything fits together
GraphQL in an Age of REST
Adding GraphQL to your existing architecture
GraphQL Introduction
GraphQL
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
An intro to GraphQL
GraphQL: The Missing Link Between Frontend and Backend Devs
The Apollo and GraphQL Stack
Introduction to GraphQL
Introduction to GraphQL
GraphQL + relay
GraphQL Search
Modular GraphQL with Schema Stitching
Graphql
How web works and browser works ? (behind the scenes)
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
GraphQL & Relay
Ad

Viewers also liked (20)

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

Similar to Introduction to GraphQL at API days (20)

PDF
Intro to GraphQL
PDF
Introduction to GraphQL
PDF
API Management for GraphQL
PDF
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
DOCX
GraphQL Advanced Concepts A Comprehensive Guide.docx
PDF
Api's and ember js
PDF
GraphQL vs REST_ Choosing the Best API for Shopify Headless Commerce Developm...
PDF
InterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan Soares
DOCX
How to Deploy a GraphQL API A Comprehensive Guide.docx
PDF
GraphQL with .NET Core Microservices.pdf
PDF
GraphQL - when REST API is to less - lessons learned
PDF
GraphQL APIs in Scala with Sangria
PDF
GraphQL Without a Database | Frontend Developer Love
PDF
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
PDF
GraphQL - when REST API is to less - lessons learned
PDF
GraphQL - when REST API is to less - lessons learned
PDF
Deploying GraphQL Services as Managed APIs
PDF
JNation: REST APIs to GraphQL with Express and Apollo
PDF
GraphQL: APIs the New Way.
PDF
GraphQL - gdy API RESTowe to za mało
Intro to GraphQL
Introduction to GraphQL
API Management for GraphQL
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
GraphQL Advanced Concepts A Comprehensive Guide.docx
Api's and ember js
GraphQL vs REST_ Choosing the Best API for Shopify Headless Commerce Developm...
InterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan Soares
How to Deploy a GraphQL API A Comprehensive Guide.docx
GraphQL with .NET Core Microservices.pdf
GraphQL - when REST API is to less - lessons learned
GraphQL APIs in Scala with Sangria
GraphQL Without a Database | Frontend Developer Love
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
Deploying GraphQL Services as Managed APIs
JNation: REST APIs to GraphQL with Express and Apollo
GraphQL: APIs the New Way.
GraphQL - gdy API RESTowe to za mało

More from yann_s (6)

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

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Cloud computing and distributed systems.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Modernizing your data center with Dell and AMD
PDF
Empathic Computing: Creating Shared Understanding
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Cloud computing and distributed systems.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Reach Out and Touch Someone: Haptics and Empathic Computing
Encapsulation_ Review paper, used for researhc scholars
The Rise and Fall of 3GPP – Time for a Sabbatical?
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Modernizing your data center with Dell and AMD
Empathic Computing: Creating Shared Understanding
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Chapter 3 Spatial Domain Image Processing.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
NewMind AI Monthly Chronicles - July 2025
NewMind AI Weekly Chronicles - August'25 Week I
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Approach and Philosophy of On baking technology
Bridging biosciences and deep learning for revolutionary discoveries: a compr...

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