REST API

REST API Guide

Request single quote

Request

curl -X GET https://stoic-api.vercel.app/api/quote \
  -H "Content-Type: application/json" \
  -d '{"id": 0}'

Response

{
  "data": {
    "quote": "What decides whether a sum of money is good? The money is not going to tell you; it must be the faculty that makes use of such impressions – reason.",
    "author": "Epictetus",
    "source": "Discourses I, 1.5",
    "id": 0
  }
}

Request multiple quotes

Request

curl -X GET https://stoic-api.vercel.app/api/quotes \
  -H "Content-Type: application/json" \
  # "page" and "pageSize" are optional parameters
  # default value for "page" is 0
  # default value for "pageSize" is 10
  -d '{ "page": 0, "pageSize": 10 }'

Response

{
  "data": {
    "quotes": [
      {
        "quote": "What decides whether a sum of money is good? The money is not going to tell you; it must be the faculty that makes use of such impressions – reason.",
        "author": "Epictetus",
        "source": "Discourses I, 1.5",
        "id": 0
      },
      {
        "quote": "Being attached to many things, we are weighed down and dragged along with them.",
        "author": "Epictetus",
        "source": "Discourses I, 1.15",
        "id": 1
      },
      {
        "quote": "What should we do then? Make the best use of what is in our power, and treat the rest in accordance with its nature.",
        "author": "Epictetus",
        "source": "Discourses I, 1.17",
        "id": 2
      },
      {
        "quote": "What should we have ready at hand in a situation like this? The knowledge of what is mine and what is not mine, what I can and cannot do.",
        "author": "Epictetus",
        "source": "Discourses I, 1.21",
        "id": 3
      }
      // ...
    ],
    "previousPage": null,
    "nextPage": 1
  }
}
Previous
REST API Overview