SlideShare ist ein Scribd-Unternehmen logo
1 von 76
Downloaden Sie, um offline zu lesen
APIs The New Way
Volodymyr Tsukur
API,
Volodymyr Tsukur
not DB!
Volodymyr Tsukur
Lead Engineer,
Guild Master @
Partner @
EASYHUNT
Program Committee @
JEEConf, XP Days
flushdia vtsukur
Lithuania
Ukraine
Kyiv
Dnipro
Vilnius
Локации Wix Engineering
Israel
Tel Aviv
Be’er Sheva
~ 110M+ users*
~ 700 engineers
~ 1800 employees
~ 500 microservices
title
price
images
description
info
...
{
}
GET /products/:id
imagesimages(1)
priceprice
titletitle
[
]
description
GET /products
...
info
{
}
10%!
OVER-fetching
01
GET /carts/:id
items [
{
product
quantity
total
}
{
}
]
subTotal
GET /carts/1
GET /products/59eb838e3f
GET /products/59eb88c400
GET /products/59eb838e40
- UNDER-fetching
- extra requests
02
GET /carts/1?projection=with-products
...
GET /carts/1?projection=summary
GET /carts/1?projection=
GET /carts/1?projection=
GET /carts/1?projection=with-products
- no unified & widely adopted
standard :( *
- harder to collaborate :(
03
How to @deprecate and
phase out outdated stuff?
04
2012
2015
“... is a query language for APIs and a runtime for
fulfilling those queries with your existing data”
type User {
name: String
friends: [User]
city: City
}
type City {
name: String
population: Int
citizens: [User]
}
1. Define schema
{
user(name: String): User
...
}
2. Ask for data
user(name: String): User
2. Ask for data
{
user(name: “Vanya Unicorn”) {
friends {
name
}
city {
name
population
}
}
}
3. Get it!
{
user(name: “Vanya Unicorn”) {
friends {
name
}
city {
name
population
}
}
}
{
“data”: {
“user”: {
“friends”: [
{ “name”: “Lena” },
{ “name”: “Stas” }
]
“city”: {
“name”: “Kyiv”,
“population”: 2928087
}
}
}
}
only necessary data
{
“data”: {
“user”: {
“friends”: [
{ “name”: “Lena” },
{ “name”: “Stas” }
]
“city”: {
“name”: “Kyiv”,
“population”: 2928087
}
}
}
}
{
user(name: “Vanya Unicorn”) {
friends {
name
}
city {
name
population
}
}
}
in one request *
{
“data”: {
“user”: {
“friends”: [
{ “name”: “Lena” },
{ “name”: “Stas” }
]
“city”: {
“name”: “Kyiv”,
“population”: 2928087
}
}
}
}
{
user(name: “Vanya Unicorn”) {
friends {
name
}
city {
name
population
}
}
}
HTTP POST
let us see how it works!
WYSIWYG
efficient fetching
easier to develop
analytics
any data source and transport
graphql-java
HTTP
Cart Service
Product Service
let us rock and roll!
running query
{
cart(id: 1) {
items {
product {
title
price
images(limit: 1)
sku
}
quantity
total
}
subTotal
}
}
1)
{
cart(id: 1) {
items {
product {
title
price
images(limit: 1)
sku
}
quantity
total
}
subTotal
}
}
2) SELECT ... FROM Cart
INNER JOIN Item ...
{
cart(id: 1) {
items {
product {
title
price
images(limit: 1)
sku
}
quantity
total
}
subTotal
}
}
3)
+ n x
product {
title
price
images(limit: 1)
sku
}
product {
title
price
images(limit: 1)
sku
}
GET /products/1
GET /products/2
GET /products/3
e x p e c t a t i o n s
R
e
a
l
i
t
y
{
cart(id: 1) {
items {
product {
title
price
images(limit: 1)
sku
}
quantity
total
}
subTotal
}
}
+
GET /products?ids=1,2,3
@Batched
let’s fix it!
Security
{
user(name: “Vanya Unicorn”) {
friends {
name
friends {
name
friends {
name
friends {
name
...
}
}
}
}
}
}
limit query depth
limit query complexity
let us defend!
throttling / rate limiting
set timeouts
pagination
schema {
query: Query
}
schema {
query: Query,
mutation: Mutation
}
type Mutation {
addProductToCart(cart: ID!,
product: ID!,
count: Int = 1): Cart
}
let us mutate!
+
+
I want it !!!
but let us see the BAD parts
caching
security
error handling
arbitrary resources / file uploads
operation idempotency?
operation naming
hypermedia
Java ecosystem
Alternatives
https://philsturgeon.uk/api/2017/01/24/graphql-vs-rest-overview/
https://blog.runscope.com/posts/you-might-not-need-graphql
NO !!!
but it shines
as an
integrated
solution
schema {
query: Query,
mutation: Mutation,
subscription: Subscription
}
type Subscription {
productAdded(cart: ID!): Cart
}
subscription {
productAdded(cart: 123) {
items {
product ...
}
subTotal
}
}
{
“data”: {
“productAdded”: {
“items”: [
{ “product”: ... },
{ “product”: ... },
{ “product”: ... },
{ “product”: ... }
]
“subTotal”: 289.33
}
}
}
://
{
“data”: {
“productAdded”: {
“items”: [
{ “product”: ... },
{ “product”: ... },
{ “product”: ... },
{ “product”: ... }
]
“subTotal”: 289.33
}
}
}
subscription {
productAdded(cart: 123) {
items {
product ...
}
subTotal
}
}
://
https://github.com/vtsukur/graphql-java-store
sample, not
production
ready code!
Questions?
volodymyrt@wix.com
flushdia vtsukur

Weitere ähnliche Inhalte

Was ist angesagt?

GPars howto - when to use which concurrency abstraction
GPars howto - when to use which concurrency abstractionGPars howto - when to use which concurrency abstraction
GPars howto - when to use which concurrency abstraction
Vaclav Pech
 
D3 Basic Tutorial
D3 Basic TutorialD3 Basic Tutorial
D3 Basic Tutorial
Tao Jiang
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVM
Vaclav Pech
 

Was ist angesagt? (19)

Eclipse Modeling Guided Tour - EcoreTools
Eclipse Modeling Guided Tour - EcoreToolsEclipse Modeling Guided Tour - EcoreTools
Eclipse Modeling Guided Tour - EcoreTools
 
D3.js workshop
D3.js workshopD3.js workshop
D3.js workshop
 
Introduction to d3js (and SVG)
Introduction to d3js (and SVG)Introduction to d3js (and SVG)
Introduction to d3js (and SVG)
 
コードで学ぶドメイン駆動設計入門
コードで学ぶドメイン駆動設計入門コードで学ぶドメイン駆動設計入門
コードで学ぶドメイン駆動設計入門
 
Pick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruitPick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruit
 
Fun with D3.js: Data Visualization Eye Candy with Streaming JSON
Fun with D3.js: Data Visualization Eye Candy with Streaming JSONFun with D3.js: Data Visualization Eye Candy with Streaming JSON
Fun with D3.js: Data Visualization Eye Candy with Streaming JSON
 
D3js learning tips
D3js learning tipsD3js learning tips
D3js learning tips
 
THE DATA DRIVEN WEB OF NOW: EXTENDING D3JS (Travis Smith)
THE DATA DRIVEN WEB OF NOW: EXTENDING D3JS (Travis Smith)THE DATA DRIVEN WEB OF NOW: EXTENDING D3JS (Travis Smith)
THE DATA DRIVEN WEB OF NOW: EXTENDING D3JS (Travis Smith)
 
Real-time collaboration in distributed systems for JavaScript developers. 
Real-time collaboration in distributed systems for JavaScript developers. Real-time collaboration in distributed systems for JavaScript developers. 
Real-time collaboration in distributed systems for JavaScript developers. 
 
Functional Javascript, CVjs
Functional Javascript, CVjsFunctional Javascript, CVjs
Functional Javascript, CVjs
 
Kotlin Mullets
Kotlin MulletsKotlin Mullets
Kotlin Mullets
 
GPars howto - when to use which concurrency abstraction
GPars howto - when to use which concurrency abstractionGPars howto - when to use which concurrency abstraction
GPars howto - when to use which concurrency abstraction
 
CS101- Introduction to Computing- Lecture 41
CS101- Introduction to Computing- Lecture 41CS101- Introduction to Computing- Lecture 41
CS101- Introduction to Computing- Lecture 41
 
D3 Basic Tutorial
D3 Basic TutorialD3 Basic Tutorial
D3 Basic Tutorial
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVM
 
Learn D3.js in 90 minutes
Learn D3.js in 90 minutesLearn D3.js in 90 minutes
Learn D3.js in 90 minutes
 
App bot
App botApp bot
App bot
 
Viewpic
ViewpicViewpic
Viewpic
 
Thunderstruck
ThunderstruckThunderstruck
Thunderstruck
 

Ähnlich wie GraphQL - APIs The New Way

Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Developing A Real World Logistic Application With Oracle Application - UKOUG ...Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Roel Hartman
 
Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011
Chris Alfano
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
FIWARE
 

Ähnlich wie GraphQL - APIs The New Way (20)

Presto anatomy
Presto anatomyPresto anatomy
Presto anatomy
 
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Developing A Real World Logistic Application With Oracle Application - UKOUG ...Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
 
HTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game TechHTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game Tech
 
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기
 
Html5 For Jjugccc2009fall
Html5 For Jjugccc2009fallHtml5 For Jjugccc2009fall
Html5 For Jjugccc2009fall
 
Map Reduce: Which Way To Go?
Map Reduce: Which Way To Go?Map Reduce: Which Way To Go?
Map Reduce: Which Way To Go?
 
Big Data Tools in AWS
Big Data Tools in AWSBig Data Tools in AWS
Big Data Tools in AWS
 
Reactive Type-safe WebComponents
Reactive Type-safe WebComponentsReactive Type-safe WebComponents
Reactive Type-safe WebComponents
 
e-suap - client technologies- english version
e-suap - client technologies- english versione-suap - client technologies- english version
e-suap - client technologies- english version
 
OpenStack API's and WSGI
OpenStack API's and WSGIOpenStack API's and WSGI
OpenStack API's and WSGI
 
Open Source Ajax Solution @OSDC.tw 2009
Open Source Ajax  Solution @OSDC.tw 2009Open Source Ajax  Solution @OSDC.tw 2009
Open Source Ajax Solution @OSDC.tw 2009
 
Qt Workshop
Qt WorkshopQt Workshop
Qt Workshop
 
Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Backbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVCBackbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVC
 
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
 
Sql Portfolio
Sql PortfolioSql Portfolio
Sql Portfolio
 
Reactive Type safe Webcomponents with skateJS
Reactive Type safe Webcomponents with skateJSReactive Type safe Webcomponents with skateJS
Reactive Type safe Webcomponents with skateJS
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
 
He stopped using for/while loops, you won't believe what happened next!
He stopped using for/while loops, you won't believe what happened next!He stopped using for/while loops, you won't believe what happened next!
He stopped using for/while loops, you won't believe what happened next!
 

Mehr von Vladimir Tsukur

Abstraction Classes in Software Design
Abstraction Classes in Software DesignAbstraction Classes in Software Design
Abstraction Classes in Software Design
Vladimir Tsukur
 
Acceptance Testing of Web UI
Acceptance Testing of Web UIAcceptance Testing of Web UI
Acceptance Testing of Web UI
Vladimir Tsukur
 
REpresentational State Transfer
REpresentational State TransferREpresentational State Transfer
REpresentational State Transfer
Vladimir Tsukur
 

Mehr von Vladimir Tsukur (11)

Hypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringHypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix Engineering
 
Hypermedia APIs and HATEOAS
Hypermedia APIs and HATEOASHypermedia APIs and HATEOAS
Hypermedia APIs and HATEOAS
 
Hot and spicy Java with Lombok. Live!
Hot and spicy Java with Lombok. Live!Hot and spicy Java with Lombok. Live!
Hot and spicy Java with Lombok. Live!
 
Building Awesome API with Spring
Building Awesome API with SpringBuilding Awesome API with Spring
Building Awesome API with Spring
 
From CRUD to Hypermedia APIs with Spring
From CRUD to Hypermedia APIs with SpringFrom CRUD to Hypermedia APIs with Spring
From CRUD to Hypermedia APIs with Spring
 
Together Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with HypermediaTogether Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with Hypermedia
 
Take a REST!
Take a REST!Take a REST!
Take a REST!
 
Law of Demeter & Objective Sense of Style
Law of Demeter & Objective Sense of StyleLaw of Demeter & Objective Sense of Style
Law of Demeter & Objective Sense of Style
 
Abstraction Classes in Software Design
Abstraction Classes in Software DesignAbstraction Classes in Software Design
Abstraction Classes in Software Design
 
Acceptance Testing of Web UI
Acceptance Testing of Web UIAcceptance Testing of Web UI
Acceptance Testing of Web UI
 
REpresentational State Transfer
REpresentational State TransferREpresentational State Transfer
REpresentational State Transfer
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

GraphQL - APIs The New Way