14. GET https://api.xyz/v1/products/123456789?arg1=value1&arg2=value2
GET https://api.xyz/v2/products/123456789?arg1=value1&arg2=value2
GET https://api.xyz/v3/products/123456789?arg1=value1&arg2=value2
GET https://api-v1.xyz/products/123456789?arg1=value1&arg2=value2
GET https://api-v2.xyz/products/123456789?arg1=value1&arg2=value2
GET https://api.xyz/products/123456789?arg1=value1&arg2=value2&version=1
GET https://api.xyz/products/123456789?arg1=value1&arg2=value2&version=2
GET https://api.xyz/products/123456789?arg1=value1&arg2=value2
Accept: application/api.version.v1 + json
Accept: application/api.version.v2 + json
24. 4
No more underfetching
GraphQL clients can retrieve all the
data they need into a single HTTP
call : no more chained and/or
parallel HTTP requests
32. {
getLocation(ip: “172.59.226.170") {
country {
names {
en
}
geoname_id
iso_code
}
location {
latitude
longitude
}
}
}
"For the available data, return the
English name for the country"
33. {
getLocation(ip: “172.59.226.170") {
country {
names {
en
}
geoname_id
iso_code
}
location {
latitude
longitude
}
}
}
"For the available data, return the latitude and
the longitude from the geolocation info"
36. MORE ABOUT OPERATIONS
• Data payload will mirror the type hierarchy defined on schema
• All data types for queries/mutations must be defined on schema
• Operation can accept parameters and/or variables
• We can form better, readable blocks for operations using aliases and
fragments
• Etc
37. CLIENT INTENT REST + HTTP GraphQL + HTTP GraphQL Operation
READ RESOURCE GET POST QUERY
CREATE RESOURCE POST POST MUTATION
UPDATE RESOURCE PUT POST MUTATION
REMOVE RESOURCE DELETE POST MUTATION
49. REMEMBER, FOLKS
• GraphQL is just a spec
• GraphQL aims to solve some of well know issues from REST
• There are lots of great options for clients and servers for GraphQL APIs
• GraphQL is mobile friendly, but it brings its own set of challenges
• GraphQL no longer uses the Triple-BSD + Patents licensing model