Skip to content

Instantly share code, notes, and snippets.

@FotieMConstant
Last active April 1, 2024 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FotieMConstant/7493727586ac086fd737edb3790de7bb to your computer and use it in GitHub Desktop.
Save FotieMConstant/7493727586ac086fd737edb3790de7bb to your computer and use it in GitHub Desktop.
This is a sample of an open api specification in json format
{
"openapi": "3.0.0",
"info": {
"title": "Geek Quote API",
"version": "1.0.0",
"description": "The Quote API is a service that provides a collection of inspirational quotes. You can use this API to retrieve random quotes, filter quotes by keywords, and explore the wisdom of known authors.",
"termsOfService": "https://example.com/terms",
"contact": {
"name": "John Doe",
"email": "contact@example.com",
"url": "https://example.com"
},
"license": {
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0"
}
},
"servers": [
{
"url": "https://geek-quote-api.vercel.app",
"description": "Production server"
},
{
"url": "https://localhost:3000",
"description": "Development server"
}
],
"paths": {
"/v1/quotes": {
"get": {
"summary": "Get all quotes",
"description": "Retrieves all available quotes.",
"responses": {
"200": {
"description": "Successful operation"
}
}
}
},
"/v1/quote": {
"get": {
"summary": "Get a single random quote",
"description": "Retrieve a single random quote.",
"responses": {
"200": {
"description": "Successful operation"
}
}
}
},
"/v1/quote/{count}": {
"get": {
"summary": "Get specified number of quotes",
"description": "Retrieve a specified number of random quotes.",
"parameters": [
{
"name": "count",
"in": "path",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Successful operation"
}
}
}
},
"/v1/quote/filter/known": {
"get": {
"summary": "Get a single quote from known author",
"description": "Retrieve a single random quote from a known author.",
"responses": {
"200": {
"description": "Successful operation"
}
}
}
},
"/v1/quote/filter/known/{count}": {
"get": {
"summary": "Get specified number of quotes from known authors",
"description": "Retrieve a specified number of random quotes from known authors.",
"parameters": [
{
"name": "count",
"in": "path",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Successful operation"
}
}
}
},
"/v1/quote/filter/{keyword}": {
"get": {
"summary": "Get single quote by keyword",
"description": "Retrieve a single random quote matching the provided keyword.",
"parameters": [
{
"name": "keyword",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful operation"
}
}
}
},
"/v1/quote/filter/all/{keyword}": {
"get": {
"summary": "Get all quotes by keyword",
"description": "Retrieve all quotes matching the provided keyword.",
"parameters": [
{
"name": "keyword",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful operation"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment