Livoa LogoLivoa
REST - Multiple Requests

1. GET /users/<id>


{

"user": {

"id": "er3tg439frjw",

"name": "Mary",

"address": { ... },

"birthday": "July 26, 1982"

}

}

2. GET /users/<id>/posts


{

"posts": [

{ "id": "ncwcon3ce89hs",

"title": "Learn GraphQL today",

"content": "Lorem ipsum ...",

"comments": [ ... ]

}

]

}

3. GET /users/<id>/followers


{

"followers": [

{ "id": "U58h2dojsu",

"name": "John",

"address": { ... },

"birthday": "July 26, 1982"

}

]

}

{REST API}
GraphQL - Single Request
query {


User(id: "er3tg439frjw") {

name

posts {

title

}

followers(last: 3) {

name

}

}

}

{GraphQL API}
{


"data": {

"User": {

"name": "Mary",

"posts": [

{ "title": "Learn GraphQL today" }

],

"followers": [

{ "name": "John" },

{ "name": "Alice" },

{ "name": "Sarah" }

]

}

}

}

s

by shir

0
0 uses