mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-25 16:31:16 -06:00
Merge pull request #318 from acelaya/feature/document-non-rest
Feature/document non rest
This commit is contained in:
commit
fb705b44a4
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,5 +6,5 @@ vendor/
|
|||||||
.env
|
.env
|
||||||
data/database.sqlite
|
data/database.sqlite
|
||||||
data/GeoLite2-City.mmdb
|
data/GeoLite2-City.mmdb
|
||||||
docs/swagger-ui
|
docs/swagger-ui*
|
||||||
docker-compose.override.yml
|
docker-compose.override.yml
|
||||||
|
@ -8,7 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
|
|
||||||
#### Added
|
#### Added
|
||||||
|
|
||||||
* *Nothing*
|
* [#162](https://github.com/shlinkio/shlink/issues/162) Added non-rest endpoints to swagger definition.
|
||||||
|
|
||||||
#### Changed
|
#### Changed
|
||||||
|
|
||||||
|
36
docs/swagger/paths/{shortCode}.json
Normal file
36
docs/swagger/paths/{shortCode}.json
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"get": {
|
||||||
|
"operationId": "shortUrl",
|
||||||
|
"tags": [
|
||||||
|
"URL Shortener"
|
||||||
|
],
|
||||||
|
"summary": "Short URL",
|
||||||
|
"description": "Represents a short URL. Tracks the visit and redirects tio the corresponding long URL",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "shortCode",
|
||||||
|
"in": "path",
|
||||||
|
"description": "The short code to resolve.",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"302": {
|
||||||
|
"description": "Visit properly tracked and redirected"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Unexpected error.",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "../definitions/Error.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
44
docs/swagger/paths/{shortCode}_preview.json
Normal file
44
docs/swagger/paths/{shortCode}_preview.json
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"get": {
|
||||||
|
"operationId": "shortUrlPreview",
|
||||||
|
"tags": [
|
||||||
|
"URL Shortener"
|
||||||
|
],
|
||||||
|
"summary": "Short URL preview image",
|
||||||
|
"description": "Returns the preview of the page behind a short URL",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "shortCode",
|
||||||
|
"in": "path",
|
||||||
|
"description": "The short code to resolve.",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Image in PNG format",
|
||||||
|
"content": {
|
||||||
|
"image/png": {
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "binary"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Unexpected error.",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "../definitions/Error.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
56
docs/swagger/paths/{shortCode}_qr-code.json
Normal file
56
docs/swagger/paths/{shortCode}_qr-code.json
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"get": {
|
||||||
|
"operationId": "shortUrlQrCode",
|
||||||
|
"tags": [
|
||||||
|
"URL Shortener"
|
||||||
|
],
|
||||||
|
"summary": "Short URL QR code",
|
||||||
|
"description": "Generates a QR code image pointing to a short URL",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "shortCode",
|
||||||
|
"in": "path",
|
||||||
|
"description": "The short code to resolve.",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "size",
|
||||||
|
"in": "path",
|
||||||
|
"description": "The size of the image to be returned.",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 50,
|
||||||
|
"maximum": 1000,
|
||||||
|
"default": 300
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "QR code in PNG format",
|
||||||
|
"content": {
|
||||||
|
"image/png": {
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "binary"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Unexpected error.",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "../definitions/Error.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
44
docs/swagger/paths/{shortCode}_track.json
Normal file
44
docs/swagger/paths/{shortCode}_track.json
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"get": {
|
||||||
|
"operationId": "trackShortUrl",
|
||||||
|
"tags": [
|
||||||
|
"URL Shortener"
|
||||||
|
],
|
||||||
|
"summary": "Short URL tracking pixel",
|
||||||
|
"description": "Generates a 1px transparent image which can be used to track emails with a short URL",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "shortCode",
|
||||||
|
"in": "path",
|
||||||
|
"description": "The short code to resolve.",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Image in GIF format",
|
||||||
|
"content": {
|
||||||
|
"image/gif": {
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "binary"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Unexpected error.",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "../definitions/Error.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,15 +6,20 @@
|
|||||||
"version": "1.0"
|
"version": "1.0"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"externalDocs": {
|
||||||
|
"url": "https://shlink.io/api-docs",
|
||||||
|
"description": "Find more info on how to start using this API here"
|
||||||
|
},
|
||||||
|
|
||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
"url": "{schema}://{server}/rest",
|
"url": "{scheme}://{host}",
|
||||||
"variables": {
|
"variables": {
|
||||||
"schema": {
|
"scheme": {
|
||||||
"default": "https",
|
"default": "https",
|
||||||
"enum": ["https", "http"]
|
"enum": ["https", "http"]
|
||||||
},
|
},
|
||||||
"server": {
|
"host": {
|
||||||
"default": ""
|
"default": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -51,35 +56,52 @@
|
|||||||
"name": "Visits",
|
"name": "Visits",
|
||||||
"description": "Operations to manage visits on short URLs"
|
"description": "Operations to manage visits on short URLs"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "URL Shortener",
|
||||||
|
"description": "Non-rest endpoints, used to be publicly exposed"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Authentication",
|
"name": "Authentication",
|
||||||
"description": "Authentication-related endpoints"
|
"description": "**[Deprecated]** Authentication-related endpoints"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
"paths": {
|
"paths": {
|
||||||
"/v1/short-urls": {
|
"/rest/v1/short-urls": {
|
||||||
"$ref": "paths/v1_short-urls.json"
|
"$ref": "paths/v1_short-urls.json"
|
||||||
},
|
},
|
||||||
"/v1/short-urls/shorten": {
|
"/rest/v1/short-urls/shorten": {
|
||||||
"$ref": "paths/v1_short-urls_shorten.json"
|
"$ref": "paths/v1_short-urls_shorten.json"
|
||||||
},
|
},
|
||||||
"/v1/short-urls/{shortCode}": {
|
"/rest/v1/short-urls/{shortCode}": {
|
||||||
"$ref": "paths/v1_short-urls_{shortCode}.json"
|
"$ref": "paths/v1_short-urls_{shortCode}.json"
|
||||||
},
|
},
|
||||||
"/v1/short-urls/{shortCode}/tags": {
|
"/rest/v1/short-urls/{shortCode}/tags": {
|
||||||
"$ref": "paths/v1_short-urls_{shortCode}_tags.json"
|
"$ref": "paths/v1_short-urls_{shortCode}_tags.json"
|
||||||
},
|
},
|
||||||
|
|
||||||
"/v1/tags": {
|
"/rest/v1/tags": {
|
||||||
"$ref": "paths/v1_tags.json"
|
"$ref": "paths/v1_tags.json"
|
||||||
},
|
},
|
||||||
|
|
||||||
"/v1/short-urls/{shortCode}/visits": {
|
"/rest/v1/short-urls/{shortCode}/visits": {
|
||||||
"$ref": "paths/v1_short-urls_{shortCode}_visits.json"
|
"$ref": "paths/v1_short-urls_{shortCode}_visits.json"
|
||||||
},
|
},
|
||||||
|
|
||||||
"/v1/authenticate": {
|
"/{shortCode}": {
|
||||||
|
"$ref": "paths/{shortCode}.json"
|
||||||
|
},
|
||||||
|
"/{shortCode}/track": {
|
||||||
|
"$ref": "paths/{shortCode}_track.json"
|
||||||
|
},
|
||||||
|
"/{shortCode}/qr-code": {
|
||||||
|
"$ref": "paths/{shortCode}_qr-code.json"
|
||||||
|
},
|
||||||
|
"/{shortCode}/preview": {
|
||||||
|
"$ref": "paths/{shortCode}_preview.json"
|
||||||
|
},
|
||||||
|
|
||||||
|
"/rest/v1/authenticate": {
|
||||||
"$ref": "paths/v1_authenticate.json"
|
"$ref": "paths/v1_authenticate.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user