GraphQL vs
Traditional REST API
Vladimir Dejanović
9th May 2018
Kraków, 9-11 May 2018
@VladimirD_42
Let’s Meet
Kraków, 9-11 May 2018
Vladimir Dejanović
@VladimirD_42
Let’s Meet
Kraków, 9-11 May 2018
Vladimir Dejanović
@VladimirD_42
Let’s Meet
Kraków, 9-11 May 2018
Vladimir Dejanović
@VladimirD_42
Let’s Meet
Kraków, 9-11 May 2018
Vladimir Dejanović and Others...
@VladimirD_42
Agenda
Kraków, 9-11 May 2018
@VladimirD_42
Agenda
REST
Kraków, 9-11 May 2018
@VladimirD_42
Agenda
REST
Kraków, 9-11 May 2018
GraphQL
@VladimirD_42
Agenda
REST
Kraków, 9-11 May 2018
GraphQL
GraphQL vs REST
@VladimirD_42
Agenda
REST
Kraków, 9-11 May 2018
GraphQL
GraphQL vs REST
Questions
@VladimirD_42
What is REST?
Kraków, 9-11 May 2018
@VladimirD_42
REST
http://www.ics.uci.edu/~fielding/pubs/
dissertation/rest_arch_style.htm
Kraków, 9-11 May 2018
@VladimirD_42
REST
Client-Server Architecture
Kraków, 9-11 May 2018
@VladimirD_42
REST
Client-Server Architecture
Kraków, 9-11 May 2018
Statelessness
@VladimirD_42
REST
Client-Server Architecture
Kraków, 9-11 May 2018
Statelessness
Cacheability
@VladimirD_42
REST
Client-Server Architecture
Kraków, 9-11 May 2018
Statelessness
Cacheability
Layered System
@VladimirD_42
REST
Client-Server Architecture
Kraków, 9-11 May 2018
Statelessness
Cacheability
Layered System
Code on Demand (Optional)
@VladimirD_42
REST
Client-Server Architecture
Kraków, 9-11 May 2018
Statelessness
Cacheability
Layered System
Code on Demand (Optional)
Uniform Interface
@VladimirD_42
REST in Real Life
Kraków, 9-11 May 2018
@VladimirD_42
REST in Real Life
Kraków, 9-11 May 2018
@VladimirD_42
REST in Real Life
Kraków, 9-11 May 2018
@VladimirD_42
REST in Real Life
Kraków, 9-11 May 2018
@VladimirD_42
Simple Blog
Kraków, 9-11 May 2018
@VladimirD_42
Simple Blog
Kraków, 9-11 May 2018
@VladimirD_42
Author
id
name
Simple Blog
Kraków, 9-11 May 2018
@VladimirD_42
Author
id
name
Post
id
title
body
authorId
Simple Blog
Kraków, 9-11 May 2018
@VladimirD_42
Author
id
name
Post
id
title
body
authorId
Comment
id
text
postId
authorId
Simple Blog
Kraków, 9-11 May 2018
@VladimirD_42
Simple Blog REST code
Kraków, 9-11 May 2018
@VladimirD_42
https://github.com/vladimir-dejanovic/graphql-vs-
traditional-rest-api-conftalk_demo
Tag: rest-0.1
What is GraphQL?
Kraków, 9-11 May 2018
@VladimirD_42
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
GraphQL is a query language
for APIs
GraphQL
is
Specification
Kraków, 9-11 May 2018
@VladimirD_42
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
graphql-java
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
Talking is boring
Show Code
Simple Blog GraphQL code
Kraków, 9-11 May 2018
@VladimirD_42
https://github.com/vladimir-dejanovic/graphql-vs-
traditional-rest-api-conftalk_demo
Tag: graphql-0.1
Client-Server Architecture
Statelessness
Cacheability
GraphQL
Kraków, 9-11 May 2018
Layered System
Code on Demand (Optional)
Uniform Interface
@VladimirD_42
Statelessness
Cacheability
GraphQL
Client-Server Architecture
Kraków, 9-11 May 2018
Layered System
Code on Demand (Optional)
Uniform Interface
@VladimirD_42
Cacheability
GraphQL
Client-Server Architecture
Kraków, 9-11 May 2018
Statelessness
Layered System
Code on Demand (Optional)
Uniform Interface
@VladimirD_42
GraphQL
Client-Server Architecture
Kraków, 9-11 May 2018
Statelessness
Cacheability
Layered System
Code on Demand (Optional)
Uniform Interface
@VladimirD_42
GraphQL
Client-Server Architecture
Kraków, 9-11 May 2018
Statelessness
Cacheability
Layered System
Code on Demand (Optional)
Uniform Interface
@VladimirD_42
GraphQL
Client-Server Architecture
Kraków, 9-11 May 2018
Statelessness
Cacheability
Layered System
Code on Demand (Optional)
Uniform Interface
@VladimirD_42
GraphQL
Client-Server Architecture
Kraków, 9-11 May 2018
Statelessness
Cacheability
Layered System
Code on Demand (Optional)
Uniform Interface
@VladimirD_42
REST
Schema optional
Kraków, 9-11 May 2018
@VladimirD_42
REST
Schema optional
Kraków, 9-11 May 2018
Good practice, but still optional
@VladimirD_42
GraphQL
Schema is mandatory
Kraków, 9-11 May 2018
@VladimirD_42
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
ref: https://i0.wp.com/keyholesoftware.com/wp-content/uploads/HATEOAS.png
Simple Blog GraphQL code
Kraków, 9-11 May 2018
@VladimirD_42
https://github.com/vladimir-dejanovic/graphql-vs-
traditional-rest-api-conftalk_demo
Tag: graphql-0.2
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
Post
Comment
Author
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
Post
Comment
Author
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
Post
Comment
Author
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
Post
Comment
Author
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
Post
Comment
Author
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
Post
Comment
Author
Simple Blog GraphQL code
Kraków, 9-11 May 2018
@VladimirD_42
https://github.com/vladimir-dejanovic/graphql-vs-
traditional-rest-api-conftalk_demo
Tag: graphql-0.3
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
GraphQL is a query language
for APIs
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
API
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
Powerful query language
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
Client call the shots
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
Post
Comment
Author
GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
Post
Comment
Author
Abuse of GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
query {
allPosts {
title
comments {
text
createdBy {
name
posts {
title
comments {
text
Abuse of GraphQL
Kraków, 9-11 May 2018
@VladimirD_42
query {
allPosts {
title
comments {
text
createdBy {
name
posts {
title
comments {
text
Protection from Abuse
Kraków, 9-11 May 2018
@VladimirD_42
Protection from Abuse
Kraków, 9-11 May 2018
@VladimirD_42
Time out
Protection from Abuse
Kraków, 9-11 May 2018
@VladimirD_42
Max Query Depth
Time out
Protection from Abuse
Kraków, 9-11 May 2018
@VladimirD_42
Max Query Depth
Time out
Max Query Complexity
Protection from Abuse
Kraków, 9-11 May 2018
@VladimirD_42
Max Query Depth
Time out
Max Query Complexity
Throttling
GraphQL query language for API
Kraków, 9-11 May 2018
@VladimirD_42
GraphQL query language for API
Kraków, 9-11 May 2018
@VladimirD_42
Query
GraphQL query language for API
Kraków, 9-11 May 2018
@VladimirD_42
Mutation
Query
Simple Blog GraphQL code
Kraków, 9-11 May 2018
@VladimirD_42
https://github.com/vladimir-dejanovic/graphql-vs-
traditional-rest-api-conftalk_demo
Tag: graphql-0.4
GraphQL query language for API
Kraków, 9-11 May 2018
@VladimirD_42
Mutation
Query
Subscription
GraphQL questions to ask
Kraków, 9-11 May 2018
@VladimirD_42
GraphQL questions to ask
Kraków, 9-11 May 2018
@VladimirD_42
Error Responses
GraphQL questions to ask
Kraków, 9-11 May 2018
@VladimirD_42
Performance & Cache
Error Responses
GraphQL questions to ask
Kraków, 9-11 May 2018
@VladimirD_42
Performance & Cache
Error Responses
Authentication & Authorisation
GraphQL
vs
Traditional REST API
Kraków, 9-11 May 2018
@VladimirD_42
GraphQL vs Traditional REST API
Kraków, 9-11 May 2018
@VladimirD_42
“Similar”
GraphQL vs Traditional REST API
Kraków, 9-11 May 2018
@VladimirD_42
Tools & Knowledge
“Similar”
GraphQL vs Traditional REST API
Kraków, 9-11 May 2018
@VladimirD_42
Tools & Knowledge
“Similar”
“Old Tricks”
GraphQL vs Traditional REST API
Kraków, 9-11 May 2018
@VladimirD_42
GraphQL rich SDL
GraphQL vs Traditional REST API
GraphQL rich SDL
Kraków, 9-11 May 2018
GraphQL powerful Query Language
@VladimirD_42
Thank You
Kraków, 9-11 May 2018
@VladimirD_42
Questions
Kraków, 9-11 May 2018
@VladimirD_42
@VladimirD_42
vladimir@itshark.xyz

GeeCON 2018 GraphQL vs Traditional REST API