Skip to content

Instantly share code, notes, and snippets.

@joshtwist
Last active September 3, 2024 03:41
Show Gist options
  • Save joshtwist/ea85296ff9bfa145b268328aef9ff056 to your computer and use it in GitHub Desktop.
Save joshtwist/ea85296ff9bfa145b268328aef9ff056 to your computer and use it in GitHub Desktop.
{
"openapi": "3.1.0",
"info": {
"title": "The Rick and Morty API (via a Zuplo Gateway)",
"version": "1.0.0",
"description": "This is an example API proxied via Zuplo. These docs are generated based on the gateway configuration. Full credit to the original and upstream API, available at rickandmortyapi.com. \n\n The source for the gateway is available on GitHub [here](https://github.com/zuplo-samples/rick-and-morty).",
"x-logo": "https://storage.googleapis.com/cdn.zuplo.com/uploads/rick-and-morty.jpeg"
},
"paths": {
"/v1/characters": {
"get": {
"summary": "Get all characters",
"description": "Retrieve a list of all characters. Supports pagination via `?page=2` and filtering by `name`, `status`, `species`, `type`, and `gender` query parameters.",
"operationId": "a079709e-683f-4580-ab6b-59ebcb3508cb",
"parameters": [
{
"name": "Authorization",
"in": "header",
"required": true,
"example": "Bearer YOUR_KEY_HERE",
"schema": {
"type": "string"
},
"description": "The `Authorization` header is used to authenticate with the API using your API key. Value is of the format `Bearer YOUR_KEY_HERE`."
},
{
"name": "page",
"in": "query",
"required": false,
"description": "Pagination index",
"schema": {
"type": "integer",
"example": 1
}
},
{
"name": "name",
"in": "query",
"required": false,
"description": "Filter characters by name.",
"schema": {
"type": "string",
"example": "Rick"
}
},
{
"name": "status",
"in": "query",
"required": false,
"description": "Filter characters by status. Valid values are `dead`, `alive`, or `unknown`.",
"schema": {
"type": "string",
"example": "alive"
}
},
{
"name": "species",
"in": "query",
"required": false,
"description": "Filter characters by species.",
"schema": {
"type": "string",
"example": "Human"
}
},
{
"name": "type",
"in": "query",
"required": false,
"description": "Filter characters by type.",
"schema": {
"type": "string",
"example": ""
}
},
{
"name": "gender",
"in": "query",
"required": false,
"description": "Filter characters by gender. Valid values are `female`, `male`, `genderless`, or `unknown`.",
"schema": {
"type": "string",
"example": "male"
}
}
],
"responses": {
"200": {
"description": "A list of characters.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CharacterList"
},
"examples": {
"example-1": {
"summary": "Sample response",
"value": {
"info": {
"count": 826,
"pages": 42,
"next": "https://rickandmorty.zuplo.io/v1/characters/?page=2",
"prev": null
},
"results": [
{
"id": 1,
"name": "Rick Sanchez",
"status": "Alive",
"species": "Human",
"type": "",
"gender": "Male",
"origin": {
"name": "Earth",
"url": "https://rickandmorty.zuplo.io/v1/locations/1"
},
"location": {
"name": "Earth",
"url": "https://rickandmorty.zuplo.io/v1/locations/20"
},
"image": "https://rickandmorty.zuplo.io/v1/characters/avatar/1.jpeg",
"episode": [
"https://rickandmorty.zuplo.io/v1/episode/1",
"https://rickandmorty.zuplo.io/v1/episode/2"
],
"url": "https://rickandmorty.zuplo.io/v1/characters/1",
"created": "2017-11-04T18:48:46.250Z"
}
]
}
}
}
}
}
}
},
"tags": ["Characters"],
"security": [
{
"api_key": []
}
]
}
},
"/v1/characters/{characterId}": {
"get": {
"summary": "Get a character by ID(s)",
"description": "Retrieve a single character by ID or multiple characters by providing a list of IDs: `/characters/[1,2,3]` or `/characters/1,2,3`.",
"operationId": "e6df88e1-c847-43ef-b8d3-aa897dcb6f11",
"parameters": [
{
"name": "Authorization",
"in": "header",
"required": true,
"example": "Bearer YOUR_KEY_HERE",
"schema": {
"type": "string"
},
"description": "The `Authorization` header is used to authenticate with the API using your API key. Value is of the format `Bearer YOUR_KEY_HERE`."
},
{
"name": "characterId",
"in": "path",
"required": true,
"description": "A single numeric ID or multiple IDs, e.g., `[1,2,3]` or `1,2`.",
"schema": {
"type": "string",
"example": "1"
}
}
],
"responses": {
"200": {
"description": "A character object or a list of character objects.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Character"
},
"examples": {
"example-1": {
"summary": "Single character response",
"value": {
"id": 2,
"name": "Morty Smith",
"status": "Alive",
"species": "Human",
"type": "",
"gender": "Male",
"origin": {
"name": "Earth",
"url": "https://rickandmorty.zuplo.io/v1/locations/1"
},
"location": {
"name": "Earth",
"url": "https://rickandmorty.zuplo.io/v1/locations/20"
},
"image": "https://rickandmorty.zuplo.io/v1/characters/avatar/2.jpeg",
"episode": [
"https://rickandmorty.zuplo.io/v1/episodes/1",
"https://rickandmorty.zuplo.io/v1/episodes/2"
],
"url": "https://rickandmorty.zuplo.io/v1/characters/2",
"created": "2017-11-04T18:50:21.651Z"
}
}
}
}
}
}
},
"tags": ["Characters"],
"security": [
{
"api_key": []
}
]
}
},
"/v1/locations": {
"get": {
"summary": "Get all locations",
"description": "Retrieve a list of all locations. Supports filtering by `name`, `type`, and `dimension` query parameters.",
"operationId": "90fc0a35-405e-4713-8094-91117bbf74dd",
"parameters": [
{
"name": "Authorization",
"in": "header",
"required": true,
"example": "Bearer YOUR_KEY_HERE",
"schema": {
"type": "string"
},
"description": "The `Authorization` header is used to authenticate with the API using your API key. Value is of the format `Bearer YOUR_KEY_HERE`."
},
{
"name": "page",
"in": "query",
"required": false,
"description": "Pagination index.",
"schema": {
"type": "integer",
"example": 1
}
},
{
"name": "name",
"in": "query",
"required": false,
"description": "Filter locations by name.",
"schema": {
"type": "string",
"example": "Earth"
}
},
{
"name": "type",
"in": "query",
"required": false,
"description": "Filter locations by type.",
"schema": {
"type": "string",
"example": "Planet"
}
},
{
"name": "dimension",
"in": "query",
"required": false,
"description": "Filter locations by dimension.",
"schema": {
"type": "string",
"example": "Dimension C-137"
}
}
],
"responses": {
"200": {
"description": "A list of locations.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LocationList"
},
"examples": {
"example-1": {
"summary": "Sample response",
"value": {
"info": {
"count": 126,
"pages": 7,
"next": null,
"prev": null
},
"results": [
{
"id": 1,
"name": "Earth",
"type": "Planet",
"dimension": "Dimension C-137",
"residents": [
"https://rickandmorty.zuplo.io/v1/characters/1",
"https://rickandmorty.zuplo.io/v1/characters/2"
],
"url": "https://rickandmorty.zuplo.io/v1/locations/1",
"created": "2017-11-10T12:42:04.162Z"
}
]
}
}
}
}
}
}
},
"tags": ["Locations"],
"security": [
{
"api_key": []
}
]
}
},
"/v1/locations/{locationId}": {
"get": {
"summary": "Get location(s) by ID(s)",
"description": "Retrieve a single location by ID or multiple locations by providing a list of IDs: `/locations/[1,2,3]` or `/locations/1,2,3`.",
"operationId": "9fd9bea1-568e-44a7-8be2-e435d5457207",
"parameters": [
{
"name": "Authorization",
"in": "header",
"required": true,
"example": "Bearer YOUR_KEY_HERE",
"schema": {
"type": "string"
},
"description": "The `Authorization` header is used to authenticate with the API using your API key. Value is of the format `Bearer YOUR_KEY_HERE`."
},
{
"name": "locationId",
"in": "path",
"required": true,
"description": "A single numeric ID or multiple IDs, e.g., `[1,2,3]` or `1,2`.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "A location object or a list of location objects.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Location"
},
"examples": {
"example-1": {
"summary": "Single location response",
"value": {
"id": 3,
"name": "Citadel of Ricks",
"type": "Space station",
"dimension": "unknown",
"residents": [
"https://rickandmorty.zuplo.io/v1/characters/8",
"https://rickandmorty.zuplo.io/v1/characters/14"
],
"url": "https://rickandmorty.zuplo.io/locations/3",
"created": "2017-11-10T13:08:13.191Z"
}
}
}
}
}
}
},
"tags": ["Locations"],
"security": [
{
"api_key": []
}
]
}
},
"/v1/episodes": {
"get": {
"summary": "Get all episodes",
"description": "Retrieve a list of all episodes. Supports pagination and filtering by `name`.",
"operationId": "6aa12d8c-6132-4161-9e7c-acccbc891bfc",
"parameters": [
{
"name": "Authorization",
"in": "header",
"required": true,
"example": "Bearer YOUR_KEY_HERE",
"schema": {
"type": "string"
},
"description": "The `Authorization` header is used to authenticate with the API using your API key. Value is of the format `Bearer YOUR_KEY_HERE`."
},
{
"name": "page",
"in": "query",
"required": false,
"description": "Pagination index.",
"schema": {
"type": "integer",
"example": 1
}
},
{
"name": "name",
"in": "query",
"required": false,
"description": "Filter episodes by name.",
"schema": {
"type": "string",
"example": "Pilot"
}
}
],
"responses": {
"200": {
"description": "A list of episodes.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EpisodeList"
},
"examples": {
"example-1": {
"summary": "Sample response",
"value": {
"info": {
"count": 51,
"pages": 3,
"next": "https://rickandmorty.zuplo.io/v1/episodes?page=2",
"prev": null
},
"results": [
{
"id": 1,
"name": "Pilot",
"air_date": "December 2, 2013",
"episode": "S01E01",
"characters": [
"https://rickandmorty.zuplo.io/v1/characters/1",
"https://rickandmorty.zuplo.io/v1/characters/2"
],
"url": "https://rickandmorty.zuplo.io/v1/episodes/1",
"created": "2017-11-10T12:56:33.798Z"
}
]
}
}
}
}
}
}
},
"tags": ["Episodes"],
"security": [
{
"api_key": []
}
]
}
},
"/v1/episodes/{episodeId}": {
"get": {
"summary": "Get episode(s) by ID(s)",
"description": "Retrieve a single episode by ID or multiple episodes by providing a list of IDs: `/episodes/[1,2,3]` or `/episodes/1,2,3`.",
"operationId": "98dd71d5-4217-412a-b873-146b4e8b1c60",
"parameters": [
{
"name": "Authorization",
"in": "header",
"required": true,
"example": "Bearer YOUR_KEY_HERE",
"schema": {
"type": "string"
},
"description": "The `Authorization` header is used to authenticate with the API using your API key. Value is of the format `Bearer YOUR_KEY_HERE`."
},
{
"name": "episodeId",
"in": "path",
"required": true,
"description": "A single numeric ID or multiple IDs, e.g., `[1,2,3]` or `1,2`.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "An episode object or a list of episode objects.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Episode"
},
"examples": {
"example-1": {
"summary": "Single episode response",
"value": {
"id": 28,
"name": "The Ricklantis Mixup",
"air_date": "September 10, 2017",
"episode": "S03E07",
"characters": [
"https://rickandmorty.zuplo.io/v1/characters/1",
"https://rickandmorty.zuplo.io/v1/characters/2"
],
"url": "https://rickandmorty.zuplo.io/v1/episodes/28",
"created": "2017-11-10T12:56:36.618Z"
}
}
}
}
}
}
},
"tags": ["Episodes"],
"security": [
{
"api_key": []
}
]
}
},
"/openapi.json": {
"get": {
"summary": "OpenAPI File",
"description": "Returns the OpenAPI file of this API.",
"operationId": "f45b4333-54c1-450d-87f1-b02a6b508ae3",
"responses": {
"200": {
"description": "OpenAPI file.",
"content": {
"application/json": {
"schema": {
"type": "string"
},
"examples": {
"example-1": {
"summary": "Sample OpenAPI file response",
"value": "{...OpenAPI JSON...}"
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Character": {
"type": "object",
"properties": {
"id": { "type": "integer", "example": 1 },
"name": { "type": "string", "example": "Rick Sanchez" },
"status": { "type": "string", "example": "Alive" },
"species": { "type": "string", "example": "Human" },
"type": { "type": "string", "example": "" },
"gender": { "type": "string", "example": "Male" },
"origin": {
"type": "object",
"properties": {
"name": { "type": "string", "example": "Earth" },
"url": { "type": "string", "example": "https://rickandmorty.zuplo.io/v1/locations/1" }
}
},
"location": {
"type": "object",
"properties": {
"name": { "type": "string", "example": "Earth" },
"url": { "type": "string", "example": "https://rickandmorty.zuplo.io/v1/locations/20" }
}
},
"image": { "type": "string", "example": "https://rickandmorty.zuplo.io/v1/characters/avatar/1.jpeg" },
"episode": { "type": "array", "items": { "type": "string" } },
"url": { "type": "string", "example": "https://rickandmorty.zuplo.io/v1/characters/1" },
"created": { "type": "string", "example": "2017-11-04T18:48:46.250Z" }
}
},
"CharacterList": {
"type": "object",
"properties": {
"info": {
"type": "object",
"properties": {
"count": { "type": "integer", "example": 826 },
"pages": { "type": "integer", "example": 42 },
"next": { "type": "string", "nullable": true, "example": "https://rickandmorty.zuplo.io/v1/characters/?page=2" },
"prev": { "type": "string", "nullable": true, "example": null }
}
},
"results": {
"type": "array",
"items": { "$ref": "#/components/schemas/Character" }
}
}
},
"Location": {
"type": "object",
"properties": {
"id": { "type": "integer", "example": 1 },
"name": { "type": "string", "example": "Earth" },
"type": { "type": "string", "example": "Planet" },
"dimension": { "type": "string", "example": "Dimension C-137" },
"residents": {
"type": "array",
"items": { "type": "string" }
},
"url": { "type": "string", "example": "https://rickandmorty.zuplo.io/v1/locations/1" },
"created": { "type": "string", "example": "2017-11-10T12:42:04.162Z" }
}
},
"LocationList": {
"type": "object",
"properties": {
"info": {
"type": "object",
"properties": {
"count": { "type": "integer", "example": 126 },
"pages": { "type": "integer", "example": 7 },
"next": { "type": "string", "nullable": true, "example": null },
"prev": { "type": "string", "nullable": true, "example": null }
}
},
"results": {
"type": "array",
"items": { "$ref": "#/components/schemas/Location" }
}
}
},
"Episode": {
"type": "object",
"properties": {
"id": { "type": "integer", "example": 1 },
"name": { "type": "string", "example": "Pilot" },
"air_date": { "type": "string", "example": "December 2, 2013" },
"episode": { "type": "string", "example": "S01E01" },
"characters": {
"type": "array",
"items": { "type": "string" }
},
"url": { "type": "string", "example": "https://rickandmorty.zuplo.io/v1/episodes/1" },
"created": { "type": "string", "example": "2017-11-10T12:56:33.798Z" }
}
},
"EpisodeList": {
"type": "object",
"properties": {
"info": {
"type": "object",
"properties": {
"count": { "type": "integer", "example": 51 },
"pages": { "type": "integer", "example": 3 },
"next": { "type": "string", "nullable": true, "example": "https://rickandmorty.zuplo.io/v1/episodes?page=2" },
"prev": { "type": "string", "nullable": true, "example": null }
}
},
"results": {
"type": "array",
"items": { "$ref": "#/components/schemas/Episode" }
}
}
}
},
"securitySchemes": {
"api_key": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
},
"servers": [
{
"url": "https://rickandmorty.zuplo.io"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment