SlideShare a Scribd company logo
1 of 29
Download to read offline
@luisw19#GraphQL
GraphQL as an alternative approach to REST
Luis Weir
@luisw19
blog: www.soa4u.co.uk
www.capgemini.com
@luisw19#GraphQL
Luis Weir
CTO Oracle Practice - Capgemini UK
luis.weir@capgemini.com
uk.linkedin.com/in/lweir
@luisw19
http://www.soa4u.co.uk
apiplatform.cloud/
Goes to Print Q2 2018
tinyurl.com/eapim18
Goes to Print Q4 2018
Latest articles:
• Is BPM Dead, Long Live Microservices?
• Five Minutes with LuisWeir
• 2nd vs 3rd Generation API Platforms - A
Comprehensive Comparison
• Podcast:Are Microservices and APIs Becoming
SOA 2.0?
• 3rd-Generation API Management: From Proxies
to Micro-Gateways
• Oracle API Platform Cloud Service Overview
About Myself
#GraphQL@luisw19Retail Recruitment Digitization © 2018 Capgemini. All rights reserved.
Agenda
GraphQL – context & key
concepts
GraphQL vs REST PoV
01
03
Demos02
Conclusions04
APIs are doors to
information and functionality
#GraphQL@luisw19
But some doors can be unfit for purpose…
source: https://imgur.com/a/J3ttg
01
#GraphQL@luisw19
Why GraphQL?
Source: https://dev-blog.apollodata.com/graphql-vs-rest-5d425123e34b by Sashko Stubailo
#GraphQL@luisw19
GraphQL - Background
• Created by Facebook in 2012 to get around a common constraints in
the REST when fetching data
• Publicly released in 2015
• GraphQL Schema Definition Language (SDL) added to spec in Feb’18
Latest release: http://facebook.github.io/graphql
Latest draft: http://facebook.github.io/graphql/draft/
https://GraphQL.org
01
#GraphQL@luisw19
GraphQL – What is it NOT?
a query
language for a
databases
in spite of its name,
it has nothing to do
with Graphs DBs
A silver Bullet
necessarily a
replacement for
REST. Both can
work together
01
#GraphQL@luisw19
GraphQL – What is it then?
A consumer oriented query language, a strongly typed schema
language and a runtime to implement GraphQL services.
Define Schema
type Country {
id: ID!
name: String!
code: String!
}
type query {
countries: [Country]
}
GraphQL Service GraphQL Client
Quickly write and
run queries
{
getCountries(name:"great")
{
name
}
}
GraphQL Client
Get exactly what
you asked for
{
"data": {
"countries": [
{
"name": "United Kingdom"
}
]
}
}
01
#GraphQL@luisw19
Who is using it?
Lots of organisations are embracing GraphQL: http://graphql.org/users
01
#GraphQL@luisw19
Increasing rapidly in Popularity
https://trends.google.com/trends/explore?date=2016-01-01%202018-05-07&q=GraphQL,REST%20API,OData
GraphQL REST API OData
Jan 2016 May 2018
01
#GraphQL@luisw19
Let’s put it into perspective
https://trends.google.com/trends/explore?date=2004-01-10%202018-05-07&q=GraphQL,REST%20API,OData,WSDL
trend
WSDL
??
01
GraphQL REST API OData
#GraphQL@luisw19
GraphQL – Key Concepts
There are 5 key characteristics of GraphQL that are
important to understand:
Hierarchical
Queries as
hierarchies of data
definitions, shaped
just how data is
expected to be
retuned.
1
View-centric
By design built to
satisfy frontend
application
requirements..
2
Strongly-typed
A GraphQL
servers defines a
specific type
system. Queries
are executed
within this
context.
3 4
Introspective
The type system
itself is queryable.
Tools are built
around this
capability.
5
Version-Free
GraphQL takes a
strong opinion on
avoiding versioning
by providing the
tools for the
continuous
evolution.
01
#GraphQL@luisw19
GraphQL
Server
Implementation
GraphQL
Schema
Definition
Language
GraphQL
Schema
(Data) Types
(Object, Input, Scalar,
Enum, Interface, Union)
Queries
(operation type)
Mutations
(operation type)
Resolvers
f(x), f(x), f(x)
Subscriptions
(operation type)
Define
Types
have
have
have
Execute
GraphQL – Anatomy
01
#GraphQL@luisw19
GraphQL
Server
Implementation
GraphQL
Schema
Definition
Language
GraphQL
Schema
(Data) Types
(Object, Input, Scalar,
Enum, Interface, Union)
Queries
(operation type)
Mutations
(operation type)
Resolvers
f(x), f(x), f(x)
Subscriptions
(operation type)
Define
Types
have
have
have
Execute
GraphQL – Anatomy
Effectively the blueprint of
a GraphQL API, it defines
the Types, Queries and
Mutations supported in a
GraphQL service
1
01
#GraphQL@luisw19
GraphQL
Server
Implementation
GraphQL
Schema
Definition
Language
GraphQL
Schema
(Data) Types
(Object, Input, Scalar,
Enum, Interface, Union)
Queries
(operation type)
Mutations
(operation type)
Resolvers
f(x), f(x), f(x)
Subscriptions
(operation type)
Define
Types
have
have
have
Execute
GraphQL – Anatomy
Object, Input, Scalar, Enumeration,
Interfaces and Unions are all types
to define data structures, which are
used in Operation types.
2
01
#GraphQL@luisw19
GraphQL
Server
Implementation
GraphQL
Schema
Definition
Language
GraphQL
Schema
(Data) Types
(Object, Input, Scalar,
Enum, Interface, Union)
Queries
(operation type)
Mutations
(operation type)
Resolvers
f(x), f(x), f(x)
Subscriptions
(operation type)
Define
Types
have
have
have
Execute
GraphQL – Anatomy
Entry point for operations that fetch
data (read / search). Note that a
single Query type can define
multiple query operations.
3
01
#GraphQL@luisw19
GraphQL
Server
Implementation
GraphQL
Schema
Definition
Language
GraphQL
Schema
(Data) Types
(Object, Input, Scalar,
Enum, Interface, Union)
Queries
(operation type)
Mutations
(operation type)
Resolvers
f(x), f(x), f(x)
Subscriptions
(operation type)
Define
Types
have
have
have
Execute
GraphQL – Key Concepts
Entry point for operations that
create/update data via a GraphQL
service. Note that a single Mutation
type can define multiple mutation
operations.
4
01
#GraphQL@luisw19
GraphQL
Server
Implementation
GraphQL
Schema
Definition
Language
GraphQL
Schema
(Data) Types
(Object, Input, Scalar,
Enum, Interface, Union)
Queries
(operation type)
Mutations
(operation type)
Resolvers
f(x), f(x), f(x)
Subscriptions
(operation type)
Define
Types
have
have
have
Execute
GraphQL – Anatomy
Under Draft: Pub/sub system for
near-realtime updates. Unlike
queries or mutations, it can deliver
more than one result via push.
https://github.com/facebook/graphql/pull/267
01
5
#GraphQL@luisw19
GraphQL
Server
Implementation
GraphQL
Schema
Definition
Language
GraphQL
Schema
(Data) Types
(Object, Input, Scalar,
Enum, Interface, Union)
Queries
(operation type)
Mutations
(operation type)
Resolvers
f(x), f(x), f(x)
Subscriptions
(operation type)
Define
Types
have
have
have
Execute
GraphQL – Anatomy
Functions that define how each
field, within a GraphQL Query or
Operation is to be acted upon.
6
01
#GraphQL@luisw19
GraphQL Schema Cheat Sheet
https://github.com/sogko/graphql-schema-language-cheat-sheet
01
#GraphQL@luisw19
Browser
GraphQL Client
Simple GraphQL Query Demo (I) - Service
{
query
}
GraphQL Server:
Apollo/Express
GraphQL Service
Graphiql
GraphQL Schema
GraphQL Endpoint
http://.../graphiql
Query Operation {JSON}
[HTTP/POST]
{JSON}
{
data
}
https://github.com/luisw19/graphql-samples/tree/master/graphql-countries-part1
02
#GraphQL@luisw19
Browser
GraphQL Client
Simple GraphQL Query Demo (II) – REST Backend
{
query
}
GraphQL Server:
Apollo/Express
GraphQL Service
Graphiql
GraphQL Schema
GraphQL Endpoint
Query Operation {JSON}
[HTTP/POST]
{JSON}
{
data
}
https://github.com/luisw19/graphql-samples/tree/master/graphql-countries-part2
[HTTP/GET]
https://restcountries.eu/rest/v2/{resource}
{JSON}
REST COUNTRIES
02
#GraphQL@luisw19
Docker Container
Browser
GraphQL Client
Simple GraphQL Query Demo (III) - Mutation
{
query
}
GraphQL Server:
Apollo/Express
GraphQL Service
Graphiql
GraphQL Schema
GraphQL Endpoint
Query Operation {JSON}
[HTTP/POST]
{JSON}
{
data
}
https://github.com/luisw19/graphql-samples/tree/master/graphql-countries-part2
[HTTP/GET]
https://restcountries.eu/rest/v2/{resource}
{JSON}
REST COUNTRIES
[HTTP/POST]
http://localhost:8000/{resource}
{JSON}
RequestBIN
02
#GraphQL@luisw19
GraphQL vs REST
GraphQL REST
(++) Usage: Best usage experience
for developers (Graphiql is brilliant!)
(~) API-first design:Tooling evolving
(build a service to mock)
(~) Usage: depends on the quality of
API definition and documentation
(+) API-first design: good tools
available (e.g.Apiary, Swagger Hub)
Developer Experience
(design and consume APIs)
Design
Try
Build
API Composition
(query data from multiple sources)
API
(++) Perfectly suited for API
composition. Each field can be fetch
(in parallel) from any source in a
single query.
(--) The nature of REST makes it difficult
to model resources that combine data
structures from multiple sources.
HATEOAS results in chattiness.
(++) Brilliant
(+) Good
(~) Neutral (it depends)
(-) Not very good
(--) It sucks!
API Gateway
(API routing, security, policies)
(-) Existing Gateways have rich support
for REST, not yet GraphQL -but could
be used. Alternative is to use a
GraphQL Service as API Gateway.
(++) API Gateways take away from
REST endpoints common tasks (e.g.
OAuth,API keys, throttling, security)
API
API Gateway
API API
03
#GraphQL@luisw19
GraphQL vs REST
GraphQL REST
(++) Brilliant
(+) Good
(~) Neutral (it depends)
(-) Not very good
(--) It sucks!
Caching
(--) Network: unsuitable as there is a
common URL for all operations.
(+) Service: possible based on Object
Type (even fields) and tools like REDIS
(++) Network: Caching is easy as each
resource is a unique URI. Common
tools can be used (e.g. CDNs).
(+) Service: It’s equally possible at
service Level.
Network
Caching
App
Cache
Client
Back
End
Resource
(~) Specification doesn’t cover this.
Standards like OAuth, OpenID in
combination of custom (for fine-
grained).
(++) Major standards (OAuth 2,
OpenId) supported by API
Gateways and frameworks.
Authentication / Authorization
Client
Resource
Authorisation
Server
1
2
Versioning
(++) Best practices are clear.
Versioning should be avoided and
tools are provided (e.g. deprecation
of fields) for continuous evolution.
(-) Best practice less clear, in
practice URI based versioning very
popular although not encouraged.
03
#GraphQL@luisw19
GraphQL vs REST (completely subjective!)
GraphQL
REST
+++++++ (7)
~~ (2)
--- (3)
++++++++ (8)
~~ (2)
--- (3)
à But it will only improve!
03
#GraphQL@luisw19 28
© 2018 Capgemini. All rights reserved.
© 2018 Capgemini. All rights reserved.28
1
3
Conclusions
Still early days but GraphQL has huge potential
GraphQL takes away many of the headaches of dealing with
REST from a client side -specially around complex queries
(against multiple sources). However tooling specially around
API Design and API Gateways is still evolving. So bear this in
mind when considering GraphQL.
2
GraphQL and REST can work nicely together
There are thousands of REST APIs (external and internal) and
REST still a viable and popular option. Instead of boiling the
ocean, as Roy said, GraphQL is not necessarily a replacement
for REST. As shown in this presentation both can be
complementary and work together.
There is no silver bullets –do your own research
There is tons of information available in the GraphQL
Communities page. Explore it, learn about it and adopt it
based on your own criteria and requirements. And hope this
presentation helped in this process!
04
#GraphQL @luisw19
Q & A

More Related Content

What's hot

Scaling Your Team With GraphQL: Why Relationships Matter
Scaling Your Team With GraphQL: Why Relationships MatterScaling Your Team With GraphQL: Why Relationships Matter
Scaling Your Team With GraphQL: Why Relationships MatterJoel Bowen
 
Modernise your IT landscape with APIs and Microservices
Modernise your IT landscape with APIs and MicroservicesModernise your IT landscape with APIs and Microservices
Modernise your IT landscape with APIs and MicroservicesColin McGovern
 
GraphQL Advanced
GraphQL AdvancedGraphQL Advanced
GraphQL AdvancedLeanIX GmbH
 
Secrets of Custom API Policies on the Oracle API Platform
Secrets of Custom API Policies on the Oracle API PlatformSecrets of Custom API Policies on the Oracle API Platform
Secrets of Custom API Policies on the Oracle API PlatformPhil Wilkins
 
Clean architectures with fast api pycones
Clean architectures with fast api   pyconesClean architectures with fast api   pycones
Clean architectures with fast api pyconesAlvaro Del Castillo
 
Apiary - A Developers Perspective
Apiary - A Developers PerspectiveApiary - A Developers Perspective
Apiary - A Developers PerspectivePhil Wilkins
 
GraphQL Introduction
GraphQL IntroductionGraphQL Introduction
GraphQL IntroductionSerge Huber
 
INTERFACE by apidays_Vulcain: beat GraphQL with HTTP/2+ by Kevin Dunglas
INTERFACE by apidays_Vulcain: beat GraphQL with HTTP/2+ by Kevin DunglasINTERFACE by apidays_Vulcain: beat GraphQL with HTTP/2+ by Kevin Dunglas
INTERFACE by apidays_Vulcain: beat GraphQL with HTTP/2+ by Kevin Dunglasapidays
 
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...apidays
 
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...apidays
 
Maintainable API Docs and Other Rainbow Colored Unicorns
Maintainable API Docs and Other Rainbow Colored UnicornsMaintainable API Docs and Other Rainbow Colored Unicorns
Maintainable API Docs and Other Rainbow Colored UnicornsNeil Mansilla
 
GraphQL London January 2018: Graphql tooling
GraphQL London January 2018: Graphql toolingGraphQL London January 2018: Graphql tooling
GraphQL London January 2018: Graphql toolingSøren Bramer Schmidt
 
An intro to GraphQL
An intro to GraphQLAn intro to GraphQL
An intro to GraphQLvaluebound
 
2016 06 - design your api management strategy - axway - Api Management
2016 06 - design your api management strategy - axway - Api Management2016 06 - design your api management strategy - axway - Api Management
2016 06 - design your api management strategy - axway - Api ManagementSmartWave
 
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays
 
Full Stack Graph in the Cloud
Full Stack Graph in the CloudFull Stack Graph in the Cloud
Full Stack Graph in the CloudNeo4j
 

What's hot (19)

Scaling Your Team With GraphQL: Why Relationships Matter
Scaling Your Team With GraphQL: Why Relationships MatterScaling Your Team With GraphQL: Why Relationships Matter
Scaling Your Team With GraphQL: Why Relationships Matter
 
Modernise your IT landscape with APIs and Microservices
Modernise your IT landscape with APIs and MicroservicesModernise your IT landscape with APIs and Microservices
Modernise your IT landscape with APIs and Microservices
 
GraphQL Advanced
GraphQL AdvancedGraphQL Advanced
GraphQL Advanced
 
Secrets of Custom API Policies on the Oracle API Platform
Secrets of Custom API Policies on the Oracle API PlatformSecrets of Custom API Policies on the Oracle API Platform
Secrets of Custom API Policies on the Oracle API Platform
 
Clean architectures with fast api pycones
Clean architectures with fast api   pyconesClean architectures with fast api   pycones
Clean architectures with fast api pycones
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Apiary - A Developers Perspective
Apiary - A Developers PerspectiveApiary - A Developers Perspective
Apiary - A Developers Perspective
 
GraphQL Introduction
GraphQL IntroductionGraphQL Introduction
GraphQL Introduction
 
INTERFACE by apidays_Vulcain: beat GraphQL with HTTP/2+ by Kevin Dunglas
INTERFACE by apidays_Vulcain: beat GraphQL with HTTP/2+ by Kevin DunglasINTERFACE by apidays_Vulcain: beat GraphQL with HTTP/2+ by Kevin Dunglas
INTERFACE by apidays_Vulcain: beat GraphQL with HTTP/2+ by Kevin Dunglas
 
Graphql
GraphqlGraphql
Graphql
 
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
 
Intro to GraphQL
 Intro to GraphQL Intro to GraphQL
Intro to GraphQL
 
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...
 
Maintainable API Docs and Other Rainbow Colored Unicorns
Maintainable API Docs and Other Rainbow Colored UnicornsMaintainable API Docs and Other Rainbow Colored Unicorns
Maintainable API Docs and Other Rainbow Colored Unicorns
 
GraphQL London January 2018: Graphql tooling
GraphQL London January 2018: Graphql toolingGraphQL London January 2018: Graphql tooling
GraphQL London January 2018: Graphql tooling
 
An intro to GraphQL
An intro to GraphQLAn intro to GraphQL
An intro to GraphQL
 
2016 06 - design your api management strategy - axway - Api Management
2016 06 - design your api management strategy - axway - Api Management2016 06 - design your api management strategy - axway - Api Management
2016 06 - design your api management strategy - axway - Api Management
 
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
 
Full Stack Graph in the Cloud
Full Stack Graph in the CloudFull Stack Graph in the Cloud
Full Stack Graph in the Cloud
 

Similar to DEVOXX UK 2018 - GraphQL as an alternative approach to REST

Real Time Serverless Polling App
Real Time Serverless Polling AppReal Time Serverless Polling App
Real Time Serverless Polling AppSrushith Repakula
 
Tutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHPTutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHPAndrew Rota
 
Documenting serverless architectures could we do it better - o'reily sa con...
Documenting serverless architectures  could we do it better  - o'reily sa con...Documenting serverless architectures  could we do it better  - o'reily sa con...
Documenting serverless architectures could we do it better - o'reily sa con...Asher Sterkin
 
GraphQL API Gateway and microservices
GraphQL API Gateway and microservicesGraphQL API Gateway and microservices
GraphQL API Gateway and microservicesMohammed Shaban
 
An oss api layer for your cassandra
An oss api layer for your cassandraAn oss api layer for your cassandra
An oss api layer for your cassandraCédrick Lunven
 
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...apidays
 
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...GreeceJS
 
Building real time serverless back ends with aws appsync
Building real time serverless back ends with aws appsyncBuilding real time serverless back ends with aws appsync
Building real time serverless back ends with aws appsyncsterkje
 
Serverless GraphQL for Product Developers
Serverless GraphQL for Product DevelopersServerless GraphQL for Product Developers
Serverless GraphQL for Product DevelopersSashko Stubailo
 
Introduction to Testing GraphQL Presentation
Introduction to Testing GraphQL PresentationIntroduction to Testing GraphQL Presentation
Introduction to Testing GraphQL PresentationKnoldus Inc.
 
Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)Knoldus Inc.
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQLRodrigo Prates
 
Introduction to graphQL
Introduction to graphQLIntroduction to graphQL
Introduction to graphQLMuhilvarnan V
 
Implementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCImplementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCTim Burks
 
GraphQL @ Manc.JS (March 2018)
GraphQL @ Manc.JS (March 2018)GraphQL @ Manc.JS (March 2018)
GraphQL @ Manc.JS (March 2018)Chris Grice
 
GraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer toolsGraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer toolsSashko Stubailo
 
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)Rob Crowley
 
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 accessConnected Data World
 

Similar to DEVOXX UK 2018 - GraphQL as an alternative approach to REST (20)

Graphql usage
Graphql usageGraphql usage
Graphql usage
 
Real Time Serverless Polling App
Real Time Serverless Polling AppReal Time Serverless Polling App
Real Time Serverless Polling App
 
Tutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHPTutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHP
 
Documenting serverless architectures could we do it better - o'reily sa con...
Documenting serverless architectures  could we do it better  - o'reily sa con...Documenting serverless architectures  could we do it better  - o'reily sa con...
Documenting serverless architectures could we do it better - o'reily sa con...
 
GraphQL API Gateway and microservices
GraphQL API Gateway and microservicesGraphQL API Gateway and microservices
GraphQL API Gateway and microservices
 
An oss api layer for your cassandra
An oss api layer for your cassandraAn oss api layer for your cassandra
An oss api layer for your cassandra
 
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
 
GraphQL
GraphQLGraphQL
GraphQL
 
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
 
Building real time serverless back ends with aws appsync
Building real time serverless back ends with aws appsyncBuilding real time serverless back ends with aws appsync
Building real time serverless back ends with aws appsync
 
Serverless GraphQL for Product Developers
Serverless GraphQL for Product DevelopersServerless GraphQL for Product Developers
Serverless GraphQL for Product Developers
 
Introduction to Testing GraphQL Presentation
Introduction to Testing GraphQL PresentationIntroduction to Testing GraphQL Presentation
Introduction to Testing GraphQL Presentation
 
Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Introduction to graphQL
Introduction to graphQLIntroduction to graphQL
Introduction to graphQL
 
Implementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCImplementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPC
 
GraphQL @ Manc.JS (March 2018)
GraphQL @ Manc.JS (March 2018)GraphQL @ Manc.JS (March 2018)
GraphQL @ Manc.JS (March 2018)
 
GraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer toolsGraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer tools
 
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
 
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
 

More from luisw19

Proving API Value Through Monetization
Proving API Value Through MonetizationProving API Value Through Monetization
Proving API Value Through Monetizationluisw19
 
Changing the game in hospitality integrations
Changing the game in hospitality integrationsChanging the game in hospitality integrations
Changing the game in hospitality integrationsluisw19
 
Spotify engineering culture summary
Spotify engineering culture summarySpotify engineering culture summary
Spotify engineering culture summaryluisw19
 
Oracle Code Capgemini: API management & microservices a match made in heaven
Oracle Code Capgemini: API management & microservices a match made in heavenOracle Code Capgemini: API management & microservices a match made in heaven
Oracle Code Capgemini: API management & microservices a match made in heavenluisw19
 
UKOUG - Implementing Enterprise API Management in the Oracle Cloud
UKOUG - Implementing Enterprise API Management in the Oracle CloudUKOUG - Implementing Enterprise API Management in the Oracle Cloud
UKOUG - Implementing Enterprise API Management in the Oracle Cloudluisw19
 
A microservice approach for legacy modernisation
A microservice approach for legacy modernisationA microservice approach for legacy modernisation
A microservice approach for legacy modernisationluisw19
 

More from luisw19 (6)

Proving API Value Through Monetization
Proving API Value Through MonetizationProving API Value Through Monetization
Proving API Value Through Monetization
 
Changing the game in hospitality integrations
Changing the game in hospitality integrationsChanging the game in hospitality integrations
Changing the game in hospitality integrations
 
Spotify engineering culture summary
Spotify engineering culture summarySpotify engineering culture summary
Spotify engineering culture summary
 
Oracle Code Capgemini: API management & microservices a match made in heaven
Oracle Code Capgemini: API management & microservices a match made in heavenOracle Code Capgemini: API management & microservices a match made in heaven
Oracle Code Capgemini: API management & microservices a match made in heaven
 
UKOUG - Implementing Enterprise API Management in the Oracle Cloud
UKOUG - Implementing Enterprise API Management in the Oracle CloudUKOUG - Implementing Enterprise API Management in the Oracle Cloud
UKOUG - Implementing Enterprise API Management in the Oracle Cloud
 
A microservice approach for legacy modernisation
A microservice approach for legacy modernisationA microservice approach for legacy modernisation
A microservice approach for legacy modernisation
 

Recently uploaded

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
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
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
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
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 

Recently uploaded (20)

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
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
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
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
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 

DEVOXX UK 2018 - GraphQL as an alternative approach to REST

  • 1. @luisw19#GraphQL GraphQL as an alternative approach to REST Luis Weir @luisw19 blog: www.soa4u.co.uk www.capgemini.com
  • 2. @luisw19#GraphQL Luis Weir CTO Oracle Practice - Capgemini UK luis.weir@capgemini.com uk.linkedin.com/in/lweir @luisw19 http://www.soa4u.co.uk apiplatform.cloud/ Goes to Print Q2 2018 tinyurl.com/eapim18 Goes to Print Q4 2018 Latest articles: • Is BPM Dead, Long Live Microservices? • Five Minutes with LuisWeir • 2nd vs 3rd Generation API Platforms - A Comprehensive Comparison • Podcast:Are Microservices and APIs Becoming SOA 2.0? • 3rd-Generation API Management: From Proxies to Micro-Gateways • Oracle API Platform Cloud Service Overview About Myself
  • 3. #GraphQL@luisw19Retail Recruitment Digitization © 2018 Capgemini. All rights reserved. Agenda GraphQL – context & key concepts GraphQL vs REST PoV 01 03 Demos02 Conclusions04
  • 4. APIs are doors to information and functionality
  • 5. #GraphQL@luisw19 But some doors can be unfit for purpose… source: https://imgur.com/a/J3ttg 01
  • 7. #GraphQL@luisw19 GraphQL - Background • Created by Facebook in 2012 to get around a common constraints in the REST when fetching data • Publicly released in 2015 • GraphQL Schema Definition Language (SDL) added to spec in Feb’18 Latest release: http://facebook.github.io/graphql Latest draft: http://facebook.github.io/graphql/draft/ https://GraphQL.org 01
  • 8. #GraphQL@luisw19 GraphQL – What is it NOT? a query language for a databases in spite of its name, it has nothing to do with Graphs DBs A silver Bullet necessarily a replacement for REST. Both can work together 01
  • 9. #GraphQL@luisw19 GraphQL – What is it then? A consumer oriented query language, a strongly typed schema language and a runtime to implement GraphQL services. Define Schema type Country { id: ID! name: String! code: String! } type query { countries: [Country] } GraphQL Service GraphQL Client Quickly write and run queries { getCountries(name:"great") { name } } GraphQL Client Get exactly what you asked for { "data": { "countries": [ { "name": "United Kingdom" } ] } } 01
  • 10. #GraphQL@luisw19 Who is using it? Lots of organisations are embracing GraphQL: http://graphql.org/users 01
  • 11. #GraphQL@luisw19 Increasing rapidly in Popularity https://trends.google.com/trends/explore?date=2016-01-01%202018-05-07&q=GraphQL,REST%20API,OData GraphQL REST API OData Jan 2016 May 2018 01
  • 12. #GraphQL@luisw19 Let’s put it into perspective https://trends.google.com/trends/explore?date=2004-01-10%202018-05-07&q=GraphQL,REST%20API,OData,WSDL trend WSDL ?? 01 GraphQL REST API OData
  • 13. #GraphQL@luisw19 GraphQL – Key Concepts There are 5 key characteristics of GraphQL that are important to understand: Hierarchical Queries as hierarchies of data definitions, shaped just how data is expected to be retuned. 1 View-centric By design built to satisfy frontend application requirements.. 2 Strongly-typed A GraphQL servers defines a specific type system. Queries are executed within this context. 3 4 Introspective The type system itself is queryable. Tools are built around this capability. 5 Version-Free GraphQL takes a strong opinion on avoiding versioning by providing the tools for the continuous evolution. 01
  • 14. #GraphQL@luisw19 GraphQL Server Implementation GraphQL Schema Definition Language GraphQL Schema (Data) Types (Object, Input, Scalar, Enum, Interface, Union) Queries (operation type) Mutations (operation type) Resolvers f(x), f(x), f(x) Subscriptions (operation type) Define Types have have have Execute GraphQL – Anatomy 01
  • 15. #GraphQL@luisw19 GraphQL Server Implementation GraphQL Schema Definition Language GraphQL Schema (Data) Types (Object, Input, Scalar, Enum, Interface, Union) Queries (operation type) Mutations (operation type) Resolvers f(x), f(x), f(x) Subscriptions (operation type) Define Types have have have Execute GraphQL – Anatomy Effectively the blueprint of a GraphQL API, it defines the Types, Queries and Mutations supported in a GraphQL service 1 01
  • 16. #GraphQL@luisw19 GraphQL Server Implementation GraphQL Schema Definition Language GraphQL Schema (Data) Types (Object, Input, Scalar, Enum, Interface, Union) Queries (operation type) Mutations (operation type) Resolvers f(x), f(x), f(x) Subscriptions (operation type) Define Types have have have Execute GraphQL – Anatomy Object, Input, Scalar, Enumeration, Interfaces and Unions are all types to define data structures, which are used in Operation types. 2 01
  • 17. #GraphQL@luisw19 GraphQL Server Implementation GraphQL Schema Definition Language GraphQL Schema (Data) Types (Object, Input, Scalar, Enum, Interface, Union) Queries (operation type) Mutations (operation type) Resolvers f(x), f(x), f(x) Subscriptions (operation type) Define Types have have have Execute GraphQL – Anatomy Entry point for operations that fetch data (read / search). Note that a single Query type can define multiple query operations. 3 01
  • 18. #GraphQL@luisw19 GraphQL Server Implementation GraphQL Schema Definition Language GraphQL Schema (Data) Types (Object, Input, Scalar, Enum, Interface, Union) Queries (operation type) Mutations (operation type) Resolvers f(x), f(x), f(x) Subscriptions (operation type) Define Types have have have Execute GraphQL – Key Concepts Entry point for operations that create/update data via a GraphQL service. Note that a single Mutation type can define multiple mutation operations. 4 01
  • 19. #GraphQL@luisw19 GraphQL Server Implementation GraphQL Schema Definition Language GraphQL Schema (Data) Types (Object, Input, Scalar, Enum, Interface, Union) Queries (operation type) Mutations (operation type) Resolvers f(x), f(x), f(x) Subscriptions (operation type) Define Types have have have Execute GraphQL – Anatomy Under Draft: Pub/sub system for near-realtime updates. Unlike queries or mutations, it can deliver more than one result via push. https://github.com/facebook/graphql/pull/267 01 5
  • 20. #GraphQL@luisw19 GraphQL Server Implementation GraphQL Schema Definition Language GraphQL Schema (Data) Types (Object, Input, Scalar, Enum, Interface, Union) Queries (operation type) Mutations (operation type) Resolvers f(x), f(x), f(x) Subscriptions (operation type) Define Types have have have Execute GraphQL – Anatomy Functions that define how each field, within a GraphQL Query or Operation is to be acted upon. 6 01
  • 21. #GraphQL@luisw19 GraphQL Schema Cheat Sheet https://github.com/sogko/graphql-schema-language-cheat-sheet 01
  • 22. #GraphQL@luisw19 Browser GraphQL Client Simple GraphQL Query Demo (I) - Service { query } GraphQL Server: Apollo/Express GraphQL Service Graphiql GraphQL Schema GraphQL Endpoint http://.../graphiql Query Operation {JSON} [HTTP/POST] {JSON} { data } https://github.com/luisw19/graphql-samples/tree/master/graphql-countries-part1 02
  • 23. #GraphQL@luisw19 Browser GraphQL Client Simple GraphQL Query Demo (II) – REST Backend { query } GraphQL Server: Apollo/Express GraphQL Service Graphiql GraphQL Schema GraphQL Endpoint Query Operation {JSON} [HTTP/POST] {JSON} { data } https://github.com/luisw19/graphql-samples/tree/master/graphql-countries-part2 [HTTP/GET] https://restcountries.eu/rest/v2/{resource} {JSON} REST COUNTRIES 02
  • 24. #GraphQL@luisw19 Docker Container Browser GraphQL Client Simple GraphQL Query Demo (III) - Mutation { query } GraphQL Server: Apollo/Express GraphQL Service Graphiql GraphQL Schema GraphQL Endpoint Query Operation {JSON} [HTTP/POST] {JSON} { data } https://github.com/luisw19/graphql-samples/tree/master/graphql-countries-part2 [HTTP/GET] https://restcountries.eu/rest/v2/{resource} {JSON} REST COUNTRIES [HTTP/POST] http://localhost:8000/{resource} {JSON} RequestBIN 02
  • 25. #GraphQL@luisw19 GraphQL vs REST GraphQL REST (++) Usage: Best usage experience for developers (Graphiql is brilliant!) (~) API-first design:Tooling evolving (build a service to mock) (~) Usage: depends on the quality of API definition and documentation (+) API-first design: good tools available (e.g.Apiary, Swagger Hub) Developer Experience (design and consume APIs) Design Try Build API Composition (query data from multiple sources) API (++) Perfectly suited for API composition. Each field can be fetch (in parallel) from any source in a single query. (--) The nature of REST makes it difficult to model resources that combine data structures from multiple sources. HATEOAS results in chattiness. (++) Brilliant (+) Good (~) Neutral (it depends) (-) Not very good (--) It sucks! API Gateway (API routing, security, policies) (-) Existing Gateways have rich support for REST, not yet GraphQL -but could be used. Alternative is to use a GraphQL Service as API Gateway. (++) API Gateways take away from REST endpoints common tasks (e.g. OAuth,API keys, throttling, security) API API Gateway API API 03
  • 26. #GraphQL@luisw19 GraphQL vs REST GraphQL REST (++) Brilliant (+) Good (~) Neutral (it depends) (-) Not very good (--) It sucks! Caching (--) Network: unsuitable as there is a common URL for all operations. (+) Service: possible based on Object Type (even fields) and tools like REDIS (++) Network: Caching is easy as each resource is a unique URI. Common tools can be used (e.g. CDNs). (+) Service: It’s equally possible at service Level. Network Caching App Cache Client Back End Resource (~) Specification doesn’t cover this. Standards like OAuth, OpenID in combination of custom (for fine- grained). (++) Major standards (OAuth 2, OpenId) supported by API Gateways and frameworks. Authentication / Authorization Client Resource Authorisation Server 1 2 Versioning (++) Best practices are clear. Versioning should be avoided and tools are provided (e.g. deprecation of fields) for continuous evolution. (-) Best practice less clear, in practice URI based versioning very popular although not encouraged. 03
  • 27. #GraphQL@luisw19 GraphQL vs REST (completely subjective!) GraphQL REST +++++++ (7) ~~ (2) --- (3) ++++++++ (8) ~~ (2) --- (3) à But it will only improve! 03
  • 28. #GraphQL@luisw19 28 © 2018 Capgemini. All rights reserved. © 2018 Capgemini. All rights reserved.28 1 3 Conclusions Still early days but GraphQL has huge potential GraphQL takes away many of the headaches of dealing with REST from a client side -specially around complex queries (against multiple sources). However tooling specially around API Design and API Gateways is still evolving. So bear this in mind when considering GraphQL. 2 GraphQL and REST can work nicely together There are thousands of REST APIs (external and internal) and REST still a viable and popular option. Instead of boiling the ocean, as Roy said, GraphQL is not necessarily a replacement for REST. As shown in this presentation both can be complementary and work together. There is no silver bullets –do your own research There is tons of information available in the GraphQL Communities page. Explore it, learn about it and adopt it based on your own criteria and requirements. And hope this presentation helped in this process! 04