GraphQL API
GraphQL API Overview
Request single quote
Query
query getQuote($id: Int!) {
getQuote(id: $id) {
id
author
quote
source
}
}
Variables
{
"id": 10
}
Response
{
"data": {
"getQuote": {
"id": 10,
"author": "Epictetus",
"quote": "If a man objects to truths that are all too evident, it is no easy task finding arguments that will change his mind. This is proof neither of his own strength nor of his teacher’s weakness. When someone caught in an argument hardens to stone, there is just no more reasoning with them.",
"source": "Discourses I, 5.1"
}
}
}
Request multiple quotes
Query
query getQuotes($author: String, $source: String, $page: Int, $pageSize: Int) {
getQuotes(
author: $author
source: $source
page: $page
pageSize: $pageSize
) {
id
author
quote
source
previousPage
nextPage
}
}
Variables
{
"author": "Epictetus",
"page": 1,
"pageSize": 10
}
Response
{
"data": {
"getQuotes": [
{
"id": 4,
"author": "Epictetus",
"quote": "‘I will throw you into prison.’ ‘Correction – it is my body you will throw there.’",
"source": "Discourses I, 1.24",
"previousPage": 0,
"nextPage": 2
},
{
"id": 5,
"author": "Epictetus",
"quote": "I have to die. If it is now, well then I die now; if later, then now I will take my lunch, since the hour for lunch has arrived – and dying I will tend to later.",
"source": "Discourses I, 1.32",
"previousPage": 0,
"nextPage": 2
},
{
"id": 6,
"author": "Epictetus",
"quote": "Consider at what price you sell your integrity; but please, for God’s sake, don’t sell it cheap.",
"source": "Discourses I, 2.33",
"previousPage": 0,
"nextPage": 2
},
{
"id": 7,
"author": "Epictetus",
"quote": "What is the goal of virtue, after all, except a life that flows smoothly?",
"source": "Discourses I, 4.5",
"previousPage": 0,
"nextPage": 2
}
]
}
}