shlink/docs/swagger/paths/v1_short-urls_{shortCode}.json

370 lines
13 KiB
JSON
Raw Normal View History

{
"get": {
"operationId": "getShortUrl",
"tags": [
"Short URLs"
],
"summary": "Parse short code",
"description": "Get the long URL behind a short URL's short code.<br><br>**Important note**: Before shlink v1.13, this endpoint used to use the `/short-codes` path instead of `/short-urls`. Both of them will keep working, while the first one is considered deprecated.",
"parameters": [
2019-11-29 21:09:03 +03:00
{
"$ref": "../parameters/version.json"
},
{
"name": "shortCode",
"in": "path",
"description": "The short code to resolve.",
2018-02-03 11:53:40 +03:00
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "domain",
"in": "query",
"description": "The domain in which the short code should be searched for. Will fall back to default domain if not found.",
"required": false,
"schema": {
"type": "string"
}
2018-02-03 11:53:40 +03:00
}
],
"security": [
{
"ApiKey": []
},
{
2018-02-03 11:53:40 +03:00
"Bearer": []
}
],
"responses": {
"200": {
"description": "The URL info behind a short code.",
2018-02-03 11:53:40 +03:00
"content": {
"application/json": {
"schema": {
"$ref": "../definitions/ShortUrl.json"
}
}
},
"examples": {
"application/json": {
"shortCode": "12Kb3",
"shortUrl": "https://doma.in/12Kb3",
"longUrl": "https://shlink.io",
"dateCreated": "2016-05-01T20:34:16+02:00",
"visitsCount": 1029,
"tags": [
"shlink"
],
"meta": {
"validSince": "2017-01-21T00:00:00+02:00",
"validUntil": null,
"maxVisits": 100
}
}
}
},
"404": {
"description": "No URL was found for provided short code.",
2018-02-03 11:53:40 +03:00
"content": {
"application/problem+json": {
2018-02-03 11:53:40 +03:00
"schema": {
"$ref": "../definitions/Error.json"
}
}
}
},
"500": {
"description": "Unexpected error.",
2018-02-03 11:53:40 +03:00
"content": {
"application/problem+json": {
2018-02-03 11:53:40 +03:00
"schema": {
"$ref": "../definitions/Error.json"
}
}
}
}
}
},
"patch": {
"operationId": "editShortUrl",
"tags": [
"Short URLs"
],
"summary": "Edit short URL",
"description": "Update certain meta arguments from an existing short URL.<br><br>**Important note**: Before shlink v1.13, this endpoint used to use the `/short-codes` path instead of `/short-urls`. Both of them will keep working, while the first one is considered deprecated.",
"parameters": [
2019-11-29 21:09:03 +03:00
{
"$ref": "../parameters/version.json"
},
{
"name": "shortCode",
"in": "path",
"description": "The short code to edit.",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"description": "Request body.",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"validSince": {
"description": "The date (in ISO-8601 format) from which this short code will be valid",
"type": "string"
},
"validUntil": {
"description": "The date (in ISO-8601 format) until which this short code will be valid",
"type": "string"
},
"maxVisits": {
"description": "The maximum number of allowed visits for this short code",
"type": "number"
}
}
}
}
}
},
"security": [
{
"ApiKey": []
},
{
"Bearer": []
}
],
"responses": {
"204": {
"description": "The short code has been properly updated."
},
"400": {
"description": "Provided meta arguments are invalid.",
"content": {
"application/problem+json": {
"schema": {
2019-11-29 21:09:03 +03:00
"type": "object",
"allOf": [
{
"$ref": "../definitions/Error.json"
2019-11-29 21:09:03 +03:00
},
{
"type": "object",
"required": ["invalidElements"],
"properties": {
"invalidElements": {
"type": "array",
"items": {
"type": "string",
"enum": [
"validSince",
"validUntil",
"maxVisits"
]
}
}
}
}
]
}
}
}
},
"404": {
"description": "No short URL was found for provided short code.",
"content": {
"application/problem+json": {
"schema": {
"$ref": "../definitions/Error.json"
}
}
}
},
"500": {
"description": "Unexpected error.",
"content": {
"application/problem+json": {
"schema": {
"$ref": "../definitions/Error.json"
}
}
}
}
}
},
"put": {
"deprecated": true,
"operationId": "editShortUrlPut",
"tags": [
"Short URLs"
],
"summary": "[DEPRECATED] Edit short URL",
"description": "**[DEPRECATED]** Use [editShortUrl](#/Short_URLs/getShortUrl) instead",
"parameters": [
2019-11-29 21:09:03 +03:00
{
"$ref": "../parameters/version.json"
},
{
"name": "shortCode",
"in": "path",
"description": "The short code to edit.",
2018-02-03 11:53:40 +03:00
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"description": "Request body.",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"validSince": {
"description": "The date (in ISO-8601 format) from which this short code will be valid",
"type": "string"
},
"validUntil": {
"description": "The date (in ISO-8601 format) until which this short code will be valid",
"type": "string"
},
"maxVisits": {
"description": "The maximum number of allowed visits for this short code",
"type": "number"
}
}
}
}
}
},
"security": [
{
"ApiKey": []
},
{
2018-02-03 11:53:40 +03:00
"Bearer": []
}
],
"responses": {
"204": {
"description": "The short code has been properly updated."
},
"400": {
"description": "Provided meta arguments are invalid.",
2018-02-03 11:53:40 +03:00
"content": {
"application/problem+json": {
2018-02-03 11:53:40 +03:00
"schema": {
"$ref": "../definitions/Error.json"
}
}
}
},
"404": {
"description": "No short URL was found for provided short code.",
2018-02-03 11:53:40 +03:00
"content": {
"application/problem+json": {
2018-02-03 11:53:40 +03:00
"schema": {
"$ref": "../definitions/Error.json"
}
}
}
},
"500": {
"description": "Unexpected error.",
2018-02-03 11:53:40 +03:00
"content": {
"application/problem+json": {
2018-02-03 11:53:40 +03:00
"schema": {
"$ref": "../definitions/Error.json"
}
}
}
}
}
},
"delete": {
"operationId": "deleteShortUrl",
"tags": [
"Short URLs"
],
"summary": "Delete short URL",
"description": "Deletes the short URL for provided short code.<br><br>**Important note**: Before shlink v1.13, this endpoint used to use the `/short-codes` path instead of `/short-urls`. Both of them will keep working, while the first one is considered deprecated.",
"parameters": [
2019-11-29 21:09:03 +03:00
{
"$ref": "../parameters/version.json"
},
{
"name": "shortCode",
"in": "path",
"description": "The short code to edit.",
"required": true,
"schema": {
"type": "string"
}
}
],
"security": [
{
"ApiKey": []
},
{
"Bearer": []
}
],
"responses": {
"204": {
"description": "The short URL has been properly deleted."
},
"422": {
"description": "The visits threshold in shlink does not allow this short URL to be deleted.",
"content": {
"application/problem+json": {
"schema": {
"$ref": "../definitions/Error.json"
}
}
},
"examples": {
"application/problem+json": {
"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
}
}
},
"404": {
"description": "No short URL was found for provided short code.",
"content": {
"application/problem+json": {
"schema": {
"$ref": "../definitions/Error.json"
}
}
}
},
"500": {
"description": "Unexpected error.",
"content": {
"application/problem+json": {
"schema": {
"$ref": "../definitions/Error.json"
}
}
}
}
}
}
}