Fixed existing examples for API

This commit is contained in:
Alejandro Celaya 2021-12-09 15:27:18 +01:00
parent ada8d18fa1
commit 808ae6a442
13 changed files with 417 additions and 423 deletions

View File

@ -13,19 +13,17 @@
"application/json": {
"schema": {
"$ref": "../definitions/Health.json"
}
}
},
"examples": {
"application/json": {
"example": {
"status": "pass",
"version": "1.16.0",
"version": "2.10.0",
"links": {
"about": "https://shlink.io",
"project": "https://github.com/shlinkio/shlink"
}
}
}
}
},
"503": {
"description": "The failing health status",
@ -33,19 +31,17 @@
"application/json": {
"schema": {
"$ref": "../definitions/Health.json"
}
}
},
"examples": {
"application/json": {
"example": {
"status": "fail",
"version": "1.16.0",
"version": "2.10.0",
"links": {
"about": "https://shlink.io",
"project": "https://github.com/shlinkio/shlink"
}
}
}
}
},
"500": {
"description": "Unexpected error.",

View File

@ -117,11 +117,8 @@
}
}
}
}
}
},
"examples": {
"application/json": {
"example": {
"shortUrls": {
"data": [
{
@ -188,6 +185,7 @@
}
}
}
}
},
"500": {
"description": "Unexpected error.",
@ -267,11 +265,8 @@
"application/json": {
"schema": {
"$ref": "../definitions/ShortUrl.json"
}
}
},
"examples": {
"application/json": {
"example": {
"shortCode": "12C18",
"shortUrl": "https://doma.in/12C18",
"longUrl": "https://store.steampowered.com",
@ -291,6 +286,7 @@
"crawlable": false
}
}
}
},
"400": {
"description": "Some of provided data is invalid. Check extra fields to know exactly what.",
@ -330,6 +326,13 @@
}
}
]
},
"example": {
"title": "Invalid URL",
"type": "INVALID_URL",
"detail": "Provided URL foo is invalid. Try with a different one.",
"status": 400,
"url": "https://invalid-url.com"
}
}
}

View File

@ -49,16 +49,8 @@
"application/json": {
"schema": {
"$ref": "../definitions/ShortUrl.json"
}
},
"text/plain": {
"schema": {
"type": "string"
}
}
},
"examples": {
"application/json": {
"example": {
"longUrl": "https://github.com/shlinkio/shlink",
"shortUrl": "https://doma.in/abc123",
"shortCode": "abc123",
@ -76,8 +68,14 @@
"domain": null,
"title": null,
"crawlable": false
}
},
"text/plain": "https://doma.in/abc123"
"text/plain": {
"schema": {
"type": "string"
},
"example": "https://doma.in/abc123"
}
}
},
"400": {
@ -86,23 +84,21 @@
"application/problem+json": {
"schema": {
"$ref": "../definitions/Error.json"
}
},
"text/plain": {
"schema": {
"type": "string"
}
}
},
"examples": {
"application/problem+json": {
"example": {
"title": "Invalid URL",
"type": "INVALID_URL",
"detail": "Provided URL foo is invalid. Try with a different one.",
"status": 400,
"url": "https://invalid-url.com"
}
},
"text/plain": "INVALID_URL"
"text/plain": {
"schema": {
"type": "string"
},
"example": "INVALID_URL"
}
}
},
"500": {
@ -118,13 +114,6 @@
"type": "string"
}
}
},
"examples": {
"application/problem+json": {
"error": "INTERNAL_SERVER_ERROR",
"message": "Unexpected error occurred"
},
"text/plain": "INTERNAL_SERVER_ERROR"
}
}
}

View File

@ -35,11 +35,8 @@
"application/json": {
"schema": {
"$ref": "../definitions/ShortUrl.json"
}
}
},
"examples": {
"application/json": {
"example": {
"shortCode": "12Kb3",
"shortUrl": "https://doma.in/12Kb3",
"longUrl": "https://shlink.io",
@ -58,6 +55,7 @@
"crawlable": false
}
}
}
},
"404": {
"description": "No URL was found for provided short code.",
@ -129,11 +127,8 @@
"application/json": {
"schema": {
"$ref": "../definitions/ShortUrl.json"
}
}
},
"examples": {
"application/json": {
"example": {
"shortCode": "12Kb3",
"shortUrl": "https://doma.in/12Kb3",
"longUrl": "https://shlink.io",
@ -152,6 +147,7 @@
"crawlable": false
}
}
}
},
"400": {
"description": "Provided meta arguments are invalid.",
@ -247,16 +243,38 @@
"content": {
"application/problem+json": {
"schema": {
"allOf": [
{
"$ref": "../definitions/Error.json"
}
}
},
"examples": {
"application/problem+json": {
{
"type": "object",
"required": ["shortCode", "threshold"],
"properties": {
"shortCode": {
"type": "string",
"description": "The short code with which we tried to find the short URL to delete"
},
"domain": {
"type": "string",
"description": "The domain with which we tried to find the short URL to delete"
},
"threshold": {
"type": "number",
"description": "The amount of visits currently configured as threshold to allow deleting short UYRLs or not"
}
}
}
]
},
"example": {
"title": "Cannot delete short URL",
"type": "INVALID_SHORTCODE_DELETION",
"detail": "It is not possible to delete URL with short code \"abc123\" because it has reached more than \"15\" visits.",
"status": 422
"detail": "Impossible to delete short URL with short code \"abc123\", since it has more than \"15\" visits.",
"status": 422,
"shortCode": "abc123",
"threshold": 15
}
}
}
},

View File

@ -69,14 +69,6 @@
}
}
}
},
"examples": {
"application/json": {
"tags": [
"games",
"tech"
]
}
}
},
"400": {

View File

@ -97,11 +97,8 @@
}
}
}
}
}
},
"examples": {
"application/json": {
"example": {
"visits": {
"data": [
{
@ -144,6 +141,7 @@
}
}
}
}
},
"404": {
"description": "The short code does not belong to any short URL.",

View File

@ -57,11 +57,10 @@
}
}
}
}
}
},
"examples": {
"application/json": {
"Without stats": {
"value": {
"tags": {
"data": [
"games",
@ -71,6 +70,31 @@
]
}
}
},
"With stats": {
"value": {
"tags": {
"data": [
"games",
"shlink"
],
"stats": [
{
"tag": "games",
"shortUrlsCount": 10,
"visitsCount": 521
},
{
"tag": "shlink",
"shortUrlsCount": 7,
"visitsCount": 1087
}
]
}
}
}
}
}
}
},
"500": {
@ -149,18 +173,6 @@
}
}
}
},
"examples": {
"application/json": {
"tags": {
"data": [
"games",
"php",
"shlink",
"tech"
]
}
}
}
},
"500": {

View File

@ -53,11 +53,8 @@
}
}
}
}
}
},
"examples": {
"application/json": {
"example": {
"domains": {
"data": [
{
@ -96,6 +93,7 @@
}
}
}
}
},
"500": {
"description": "Unexpected error.",

View File

@ -55,16 +55,14 @@
"$ref": "../definitions/NotFoundRedirects.json"
}
]
}
}
},
"examples": {
"application/json": {
"example": {
"baseUrlRedirect": "https://example.com/my-landing-page",
"regular404Redirect": null,
"invalidShortUrlRedirect": "https://example.com/invalid-url"
}
}
}
},
"400": {
"description": "Provided data is invalid.",

View File

@ -23,16 +23,14 @@
"application/json": {
"schema": {
"$ref": "../definitions/MercureInfo.json"
}
}
},
"examples": {
"application/json": {
"example": {
"mercureHubUrl": "https://example.com/.well-known/mercure",
"jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJTaGxpbmsiLCJpYXQiOjE1ODY2ODY3MzIsImV4cCI6MTU4Njk0NTkzMiwibWVyY3VyZSI6eyJzdWJzY3JpYmUiOltdfX0.P-519lgU7dFz0bbNlRG1CXyqugGbaHon4kw6fu4QBdQ",
"jwtExpiration": "2020-04-15T12:18:52+02:00"
}
}
}
},
"501": {
"description": "This Shlink instance is not integrated with a mercure hub",
@ -40,17 +38,15 @@
"application/problem+json": {
"schema": {
"$ref": "../definitions/Error.json"
}
}
},
"examples": {
"application/json": {
"example": {
"title": "Mercure integration not configured",
"type": "MERCURE_NOT_CONFIGURED",
"detail": "This Shlink instance is not integrated with a mercure hub.",
"status": 501
}
}
}
},
"500": {
"description": "Unexpected error.",

View File

@ -94,11 +94,8 @@
}
}
}
}
}
},
"examples": {
"application/json": {
"example": {
"visits": {
"data": [
{
@ -141,6 +138,7 @@
}
}
}
}
},
"404": {
"description": "The tag does not exist.",

View File

@ -28,17 +28,15 @@
"$ref": "../definitions/VisitStats.json"
}
}
}
}
},
"examples": {
"application/json": {
"example": {
"visits": {
"visitsCount": 1569874,
"orphanVisitsCount": 71345
}
}
}
}
},
"500": {
"description": "Unexpected error.",

View File

@ -85,11 +85,8 @@
}
}
}
}
}
},
"examples": {
"application/json": {
"example": {
"visits": {
"data": [
{
@ -138,6 +135,7 @@
}
}
}
}
},
"500": {
"description": "Unexpected error.",