Skip to content

Instantly share code, notes, and snippets.

@coopr
Created October 16, 2018 20:47
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save coopr/1928323d2460b71e42b5d4d85e019e61 to your computer and use it in GitHub Desktop.
Save coopr/1928323d2460b71e42b5d4d85e019e61 to your computer and use it in GitHub Desktop.
Swagger (OpenAPI) specification file for part of Kong's Admin API
{
"swagger": "2.0",
"info": {
"version": "13.1.0",
"description": "A Swagger definition for the Kong Admin API",
"title": "Kong-Admin"
},
"host": "127.0.0.1:8001",
"basePath": "/",
"tags": [
{
"name": "Status",
"description": "Kong node status"
},
{
"name": "Services",
"description": "Group Routes and apply Plugins"
},
{
"name": "Routes",
"description": "Route to upstream service endpoints"
},
{
"name": "Consumers",
"description": "Entities which can consume APIs from Kong"
},
{
"name": "Plugins",
"description": "Code which adds functionality to Kong"
},
{
"name": "Certificates",
"description": "Certificates for use in Kong"
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/": {
"get": {
"tags": [
"Status"
],
"description": "Get details about a node",
"responses": {
"200": {
"description": "Node information returned",
"schema": {
"type": "object",
"properties": {
"hostname": {
"type": "string"
},
"node_id": {
"type": "string"
},
"lua_version": {
"type": "string"
},
"plugins": {
"type": "array",
"items": {
"type": "object",
"properties": {
"available_on_server": {
"type": "array",
"items": {
"type": "string"
}
},
"installed_on_server": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"configuration": {
"type": "object"
},
"tagline": {
"type": "string"
},
"version": {
"type": "number"
}
}
}
}
}
}
},
"/status": {
"get": {
"tags": [
"Status"
],
"description": "Get status of a node",
"responses": {
"200": {
"description": "Node status information returned",
"schema": {
"type": "object",
"properties": {
"service": {
"type": "array",
"items": {
"type": "object",
"properties": {
"total_requests": {
"type": "integer"
},
"connections_active": {
"type": "integer"
},
"connections_accepted": {
"type": "integer"
},
"connections_handled": {
"type": "integer"
},
"connections_reading": {
"type": "integer"
},
"connections_writing": {
"type": "integer"
},
"connections_waiting": {
"type": "integer"
}
}
}
},
"database": {
"type": "array",
"items": {
"type": "object",
"properties": {
"reachable": {
"type": "boolean"
}
}
}
}
}
}
}
}
}
},
"/services/": {
"get": {
"tags": [
"Services"
],
"description": "Get details about a service",
"operationId": "getServices",
"parameters": [
{
"name": "service_id",
"in": "path",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "Service was found",
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"created_at": {
"type": "number"
},
"updated_at": {
"type": "number"
},
"connect_timeout": {
"type": "integer"
},
"protocol": {
"type": "string"
},
"host": {
"type": "string"
},
"port": {
"type": "number"
},
"path": {
"type": "string"
},
"name": {
"type": "string"
},
"retries": {
"type": "number"
},
"read_timeout": {
"type": "number"
},
"write_timeout": {
"type": "number"
}
}
}
},
"404": {
"description": "No such service found"
}
}
},
"post": {
"tags": [
"Services"
],
"description": "Create a service",
"operationId": "postServices",
"responses": {
"201": {
"description": "Service was created",
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"created_at": {
"type": "number"
},
"updated_at": {
"type": "number"
},
"connect_timeout": {
"type": "integer"
},
"protocol": {
"type": "string"
},
"host": {
"type": "string"
},
"port": {
"type": "number"
},
"path": {
"type": "string"
},
"name": {
"type": "string"
},
"retries": {
"type": "number"
},
"read_timeout": {
"type": "number"
},
"write_timeout": {
"type": "number"
}
}
}
}
}
},
"patch": {
"tags": [
"Services"
],
"description": "Update a service",
"operationId": "pathServices",
"parameters": [
{
"name": "service_id",
"in": "path",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "Service was updated",
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"created_at": {
"type": "number"
},
"updated_at": {
"type": "number"
},
"connect_timeout": {
"type": "integer"
},
"protocol": {
"type": "string"
},
"host": {
"type": "string"
},
"port": {
"type": "number"
},
"path": {
"type": "string"
},
"name": {
"type": "string"
},
"retries": {
"type": "number"
},
"read_timeout": {
"type": "number"
},
"write_timeout": {
"type": "number"
}
}
}
}
}
},
"delete": {
"tags": [
"Services"
],
"description": "delete a service",
"operationId": "deleteServices",
"parameters": [
{
"name": "service_id",
"in": "path",
"type": "string",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
}
}
}
},
"/routes/": {
"get": {
"tags": [
"Routes"
],
"description": "Get details about a route",
"operationId": "getRoute",
"parameters": [
{
"name": "route_id",
"in": "path",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "Route was found",
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"created_at": {
"type": "number"
},
"updated_at": {
"type": "number"
},
"connect_timeout": {
"type": "integer"
},
"protocol": {
"type": "string"
},
"host": {
"type": "string"
},
"port": {
"type": "number"
},
"path": {
"type": "string"
},
"name": {
"type": "string"
},
"retries": {
"type": "number"
},
"read_timeout": {
"type": "number"
},
"write_timeout": {
"type": "number"
}
}
}
},
"404": {
"description": "No such service found"
}
}
},
"post": {
"tags": [
"Routes"
],
"description": "Create a Route",
"operationId": "portRoute",
"responses": {
"201": {
"description": "Route was created",
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"created_at": {
"type": "number"
},
"updated_at": {
"type": "number"
},
"connect_timeout": {
"type": "integer"
},
"protocol": {
"type": "string"
},
"host": {
"type": "string"
},
"port": {
"type": "number"
},
"path": {
"type": "string"
},
"name": {
"type": "string"
},
"retries": {
"type": "number"
},
"read_timeout": {
"type": "number"
},
"write_timeout": {
"type": "number"
}
}
}
}
}
},
"patch": {
"tags": [
"Routes"
],
"description": "Update a route",
"operationId": "patchRoute",
"parameters": [
{
"name": "route_id",
"in": "path",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "Route was updated",
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"created_at": {
"type": "number"
},
"updated_at": {
"type": "number"
},
"connect_timeout": {
"type": "integer"
},
"protocol": {
"type": "string"
},
"host": {
"type": "string"
},
"port": {
"type": "number"
},
"path": {
"type": "string"
},
"name": {
"type": "string"
},
"retries": {
"type": "number"
},
"read_timeout": {
"type": "number"
},
"write_timeout": {
"type": "number"
}
}
}
}
}
},
"delete": {
"tags": [
"Routes"
],
"description": "Delete a Route",
"operationId": "deleteRoute",
"parameters": [
{
"name": "route_id",
"in": "path",
"type": "string",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
}
}
}
},
"/consumers/{id_or_name}": {
"get": {
"description": "Get details about a consumer",
"tags": [
"Consumers"
],
"operationId": "getConsumersByIdName",
"parameters": [
{
"name": "id_or_name",
"in": "path",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "Consumer was found",
"schema": {
"type": "object",
"properties": {
"custom_id": {
"type": "string"
},
"username": {
"type": "string"
},
"created_at": {
"type": "integer"
}
}
}
},
"404": {
"description": "No such consumer found"
}
}
}
},
"/consumers/": {
"post": {
"description": "Create a consumer",
"operationId": "postConsumers",
"tags": [
"Consumers"
],
"consumes": [
"application/x-www-form-urlencoded"
],
"parameters": [
{
"name": "username",
"in": "formData",
"type": "string",
"required": true
},
{
"name": "custom_id",
"in": "formData",
"type": "string",
"required": true
}
],
"responses": {
"201": {
"description": "Consumer created",
"schema": {
"type": "object",
"properties": {
"custom_id": {
"type": "string"
},
"username": {
"type": "string"
},
"created_at": {
"type": "integer"
}
}
}
}
}
},
"patch": {
"description": "Update a consumer",
"operationId": "patchConsumers",
"consumes": [
"application/x-www-form-urlencoded"
],
"tags": [
"Consumers"
],
"parameters": [
{
"name": "username",
"in": "formData",
"type": "string",
"required": true
},
{
"name": "custom_id",
"in": "formData",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "Consumer was updated",
"schema": {
"type": "object",
"properties": {
"custom_id": {
"type": "string"
},
"username": {
"type": "string"
},
"created_at": {
"type": "integer"
}
}
}
}
}
},
"delete": {
"description": "Delete a consumer",
"operationId": "deleteConsumers",
"tags": [
"Consumers"
],
"parameters": [
{
"name": "id_or_name",
"in": "path",
"type": "string",
"required": true
}
],
"responses": {
"204": {
"description": "No content"
},
"404": {
"description": "No such consumer found"
}
}
}
},
"/plugins/{id_or_name}": {
"get": {
"tags": [
"Plugins"
],
"operationId": "getPluginsByIdName",
"parameters": [
{
"name": "id_or_name",
"in": "path",
"type": "string",
"required": true
}
],
"description": "Get details about a plugin",
"responses": {
"200": {
"description": "Plugin information returned",
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"service_id": {
"type": "string"
},
"consumer_id": {
"type": "string"
},
"name": {
"type": "string"
},
"config": {
"type": "array",
"items": {
"type": "object",
"properties": {
"minute": {
"type": "number"
},
"hour": {
"type": "number"
}
}
}
},
"enabled": {
"type": "boolean"
},
"created_at": {
"type": "number"
}
}
}
}
}
},
"patch": {
"tags": [
"Plugins"
],
"description": "Update details about a plugin",
"operationId": "patchPluginsByIdName",
"consumes": [
"application/x-www-form-urlencoded"
],
"parameters": [
{
"name": "name",
"in": "formData",
"type": "string",
"required": true
},
{
"name": "consumer_id",
"in": "formData",
"type": "string",
"required": false
},
{
"name": "config.{property}",
"description": "The configuration properties for the Plugin which can be found on the plugins documentation page in the Plugin Gallery",
"in": "formData",
"type": "string",
"required": false
}
],
"responses": {
"200": {
"description": "Plugin information updated",
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"service_id": {
"type": "string"
},
"consumer_id": {
"type": "string"
},
"name": {
"type": "string"
},
"config": {
"type": "array",
"items": {
"type": "object",
"properties": {
"minute": {
"type": "number"
},
"hour": {
"type": "number"
}
}
}
},
"enabled": {
"type": "boolean"
},
"created_at": {
"type": "number"
}
}
}
}
}
},
"delete": {
"tags": [
"Plugins"
],
"parameters": [
{
"name": "id_or_name",
"in": "path",
"type": "string",
"required": true
}
],
"description": "Delete a plugin",
"operationId": "deletePluginByIdName",
"responses": {
"204": {
"description": "No content"
}
}
}
},
"/plugins/": {
"get": {
"tags": [
"Plugins"
],
"description": "Get details about a plugin",
"operationId": "getPlugin",
"parameters": [
{
"name": "id",
"in": "query",
"type": "string",
"required": false
},
{
"name": "name",
"in": "query",
"type": "string",
"required": false
},
{
"name": "service_id",
"in": "query",
"type": "string",
"required": false
},
{
"name": "route_id",
"in": "query",
"type": "string",
"required": false
},
{
"name": "consumer_id",
"in": "query",
"type": "string",
"required": false
},
{
"name": "size",
"in": "query",
"type": "integer",
"required": false
},
{
"name": "offset",
"description": "",
"in": "query",
"type": "string",
"required": false
}
],
"responses": {
"200": {
"description": "Plugin information returned",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "integer"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"service_id": {
"type": "string"
},
"config": {
"type": "object",
"properties": {
"minute": {
"type": "integer"
},
"hour": {
"type": "integer"
}
}
}
}
}
},
"enabled": {
"type": "boolean"
},
"created_at": {
"type": "number"
}
}
}
}
}
},
"post": {
"description": "Add a plugin to a route or service or consumer",
"operationId": "postPlugin",
"tags": [
"Plugins"
],
"consumes": [
"application/x-www-form-urlencoded"
],
"parameters": [
{
"name": "name",
"in": "formData",
"type": "string",
"required": true
},
{
"name": "consumer_id",
"in": "formData",
"type": "string",
"required": false
},
{
"name": "config.{property}",
"description": "The configuration properties for the Plugin which can be found on the plugins documentation page in the Plugin Gallery",
"in": "formData",
"type": "string",
"required": false
}
],
"responses": {
"201": {
"description": "Plugin created",
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"service_id": {
"type": "string"
},
"consumer_id": {
"type": "string"
},
"name": {
"type": "string"
},
"config": {
"type": "object",
"properties": {
"minute": {
"type": "number"
},
"hour": {
"type": "number"
}
}
},
"enabled": {
"type": "boolean"
},
"created_at": {
"type": "number"
}
}
}
}
}
},
"put": {
"tags": [
"Plugins"
],
"description": "Update or create a plugin",
"operationId": "putPlugin",
"consumes": [
"application/x-www-form-urlencoded"
],
"parameters": [
{
"name": "name",
"in": "formData",
"type": "string",
"required": true
},
{
"name": "consumer_id",
"in": "formData",
"type": "string",
"required": false
},
{
"name": "config.{property}",
"description": "The configuration properties for the Plugin which can be found on the plugins documentation page in the Plugin Gallery",
"in": "formData",
"type": "string",
"required": false
}
],
"responses": {
"200": {
"description": "Plugin information updated"
},
"201": {
"description": "Plugin created"
}
}
}
},
"/plugins/enabled": {
"get": {
"description": "List enabled Plugins",
"operationId": "getPluginsEnabled",
"tags": [
"Plugins"
],
"responses": {
"200": {
"description": "Plugin list returned",
"schema": {
"type": "object",
"properties": {
"config": {
"type": "array",
"items": {
"type": "object",
"properties": {
"enabled_plugins": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
},
"/plugins/schema/{plugin_name}": {
"get": {
"description": "Get the schema for a plugin",
"operationId": "getPluginSchemaByName",
"tags": [
"Plugins"
],
"parameters": [
{
"name": "plugin_name",
"in": "path",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "Plugin schema returned",
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"service_id": {
"type": "string"
},
"consumer_id": {
"type": "string"
},
"name": {
"type": "string"
},
"config": {
"type": "object",
"properties": {
"minute": {
"type": "number"
},
"hour": {
"type": "number"
}
}
}
}
}
}
}
}
},
"/certificates/{sni_or_id}": {
"get": {
"tags": [
"Certificates"
],
"description": "Get details about a certificate by SNI or ID",
"operationId": "getCertBySNIorID",
"parameters": [
{
"name": "sni_or_id",
"in": "path",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "Certificate information returned",
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"cert": {
"type": "string"
},
"key": {
"type": "string"
},
"snis": {
"type": "array",
"items": {
"type": "string"
}
},
"created_at": {
"type": "number"
}
}
}
}
}
}
},
"/certificates/": {
"get": {
"tags": [
"Certificates"
],
"operationId": "getCertificates",
"description": "Get details about a certificate",
"parameters": [
{
"name": "sni_or_id",
"in": "path",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "Certificate information returned",
"schema": {
"type": "object",
"properties": {
"total": {
"type": "integer"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"cert": {
"type": "string"
},
"key": {
"type": "string"
},
"snis": {
"type": "array",
"items": {
"type": "string"
}
},
"created_at": {
"type": "number"
}
}
}
}
}
}
}
}
},
"post": {
"tags": [
"Certificates"
],
"operationId": "postCertificates",
"description": "Create a certificate",
"consumes": [
"application/x-www-form-urlencoded"
],
"parameters": [
{
"name": "cert",
"in": "formData",
"type": "string",
"required": true
},
{
"name": "key",
"in": "formData",
"type": "string",
"required": true
},
{
"name": "sni",
"in": "formData",
"type": "string",
"required": false
}
],
"responses": {
"201": {
"description": "Certificate created",
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"cert": {
"type": "string"
},
"key": {
"type": "string"
},
"snis": {
"type": "array",
"items": {
"type": "string"
}
},
"created_at": {
"type": "number"
}
}
}
}
}
}
}
}
}
@raelmax
Copy link

raelmax commented Feb 28, 2019

Where this spec come from? I'm looking for Kong Api specs but I'm not able to find any official source. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment