diff --git a/docs/swagger/definitions/Health.json b/docs/swagger/definitions/Health.json new file mode 100644 index 00000000..3683989a --- /dev/null +++ b/docs/swagger/definitions/Health.json @@ -0,0 +1,31 @@ +{ + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "pass", + "fail" + ], + "description": "The status of the service" + }, + "version": { + "type": "string", + "description": "Shlink version" + }, + "links": { + "type": "object", + "properties": { + "about": { + "type": "string", + "description": "About shlink" + }, + "project": { + "type": "string", + "description": "Shlink project repository" + } + }, + "description": "A list of links" + } + } +} diff --git a/docs/swagger/paths/health.json b/docs/swagger/paths/health.json new file mode 100644 index 00000000..60d96ccc --- /dev/null +++ b/docs/swagger/paths/health.json @@ -0,0 +1,62 @@ +{ + "get": { + "operationId": "health", + "tags": [ + "Monitoring" + ], + "summary": "Check healthiness", + "description": "Checks the healthiness of the service, making sure it can access required resources.", + "responses": { + "200": { + "description": "The passing health status", + "content": { + "application/json": { + "schema": { + "$ref": "../definitions/Health.json" + } + } + }, + "examples": { + "application/json": { + "status": "pass", + "version": "1.16.0", + "links": { + "about": "https://shlink.io", + "project": "https://github.com/shlinkio/shlink" + } + } + } + }, + "503": { + "description": "The failing health status", + "content": { + "application/json": { + "schema": { + "$ref": "../definitions/Health.json" + } + } + }, + "examples": { + "application/json": { + "status": "fail", + "version": "1.16.0", + "links": { + "about": "https://shlink.io", + "project": "https://github.com/shlinkio/shlink" + } + } + } + }, + "500": { + "description": "Unexpected error.", + "content": { + "application/json": { + "schema": { + "$ref": "../definitions/Error.json" + } + } + } + } + } + } +} diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index 0ba8231d..8f996886 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -56,6 +56,10 @@ "name": "Visits", "description": "Operations to manage visits on short URLs" }, + { + "name": "Monitoring", + "description": "Public endpoints designed to monitor the service" + }, { "name": "URL Shortener", "description": "Non-rest endpoints, used to be publicly exposed" @@ -88,6 +92,10 @@ "$ref": "paths/v1_short-urls_{shortCode}_visits.json" }, + "/rest/health": { + "$ref": "paths/health.json" + }, + "/{shortCode}": { "$ref": "paths/{shortCode}.json" },