Better alternative for Restful apis
jaro@uber.com | @chompomonim | +JaroSatkevic
AGENDA
GET /hero/1
GET /hero/1/homeworld
GET /hero/1/starships
GET /hero/1
GET /hero/1/homeworld
GET /hero/1/starships
GET /hero/1?include=starships,homeworld
OR
GET /hero/1
GET /hero/1/homeworld
GET /hero/1/starships
GET /hero/1?include=starships,homeworld
OR
OR
GET /hero/1
GET /starship/10?heroId=1
GET /planet/6?heroId=1
{
person(personID: "1") {
name
birthYear
eyeColor
gender
homeworld {
name
population
}
starships (first: 2) {
name
model
}
}
}
GET /hero/1?include=name,birthYear,gender
GET /hero/1/homeworld
GET /starships?heroId=1&include=name,model
{
person(personID: "1") {
name
birthYear
eyeColor
gender
homeworld {
name
population
}
starships (first: 1) {
name
model
}
}
}
{"data": {
person: {
"name": "Luke Skywalker",
"birthYear": "19BBY",
"eyeColor": "blue",
"gender": "male",
"homeworld": {
"name": "Tatooine",
"population": 200000
},
"starships": [
{
"name": "X-wing",
"model": "T-65 X-wing"
}
]
}
}
type Person {
name: String!
gender: String
eyeColor: String
birthYear: String
homeplanet: Homeplanet
starships: [Starships]
}
type Starship {
name
model
speed
}
Relay
{
person(personID: "1") {
name
birthYear
eyeColor
gender
homeworld {
name
population
}
starships (first: 10) {
name
model
}
}
}
{
persons {
name
birthYear
eyeColor
gender
homeworld {
name
population
}
starships (first: 10) {
name
model
passangers {
name
gender
homeworld {
name
}
}
}
}
}
jaro@uber.com | @chompomonim | +JaroSatkevic