2018-05-06 13:19:08 +03:00
{
"get" : {
2018-09-20 21:52:27 +03:00
"operationId" : "shortenUrl" ,
2018-05-06 13:19:08 +03:00
"tags" : [
2018-09-20 21:52:27 +03:00
"Short URLs"
2018-05-06 13:19:08 +03:00
] ,
"summary" : "Create a short URL" ,
2018-09-24 23:49:30 +03:00
"description" : "Creates a short URL in a single API call. Useful for third party integrations.<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." ,
2018-05-06 13:19:08 +03:00
"parameters" : [
{
"name" : "apiKey" ,
"in" : "query" ,
"description" : "The API key used to authenticate the request" ,
"required" : true ,
"schema" : {
"type" : "string"
}
} ,
{
"name" : "longUrl" ,
"in" : "query" ,
"description" : "The URL to be shortened" ,
"required" : true ,
"schema" : {
"type" : "string"
}
} ,
{
"name" : "format" ,
"in" : "query" ,
"description" : "The format in which you want the response to be returned. You can also use the \"Accept\" header instead of this" ,
"required" : false ,
"schema" : {
"type" : "string" ,
"enum" : [
"txt" ,
"json"
]
}
}
] ,
"responses" : {
"200" : {
"description" : "The list of short URLs" ,
"content" : {
"application/json" : {
"schema" : {
2018-11-16 18:57:18 +03:00
"$ref" : "../definitions/ShortUrl.json"
2018-05-06 13:19:08 +03:00
}
} ,
"text/plain" : {
"schema" : {
"type" : "string"
}
}
} ,
"examples" : {
"application/json" : {
"longUrl" : "https://github.com/shlinkio/shlink" ,
2018-11-16 18:57:18 +03:00
"shortUrl" : "https://doma.in/abc123" ,
"shortCode" : "abc123" ,
"dateCreated" : "2016-08-21T20:34:16+02:00" ,
"visitsCount" : 0 ,
"tags" : [
"games" ,
"tech"
2019-07-08 19:42:53 +03:00
] ,
"meta" : {
"validSince" : "2017-01-21T00:00:00+02:00" ,
"validUntil" : null ,
"maxVisits" : 100
}
2018-05-06 13:19:08 +03:00
} ,
2018-11-16 18:57:18 +03:00
"text/plain" : "https://doma.in/abc123"
2018-05-06 13:19:08 +03:00
}
} ,
"400" : {
"description" : "The long URL was not provided or is invalid." ,
"content" : {
2019-11-28 21:37:22 +03:00
"application/problem+json" : {
2018-05-06 13:19:08 +03:00
"schema" : {
"$ref" : "../definitions/Error.json"
}
} ,
"text/plain" : {
"schema" : {
"type" : "string"
}
}
} ,
"examples" : {
2019-11-28 21:37:22 +03:00
"application/problem+json" : {
"title" : "Invalid URL" ,
"type" : "INVALID_URL" ,
"detail" : "Provided URL foo is invalid. Try with a different one." ,
"status" : 400 ,
"url" : "https://invalid-url.com"
2018-05-06 13:19:08 +03:00
} ,
"text/plain" : "INVALID_URL"
}
} ,
"500" : {
"description" : "Unexpected error." ,
"content" : {
2019-11-28 21:37:22 +03:00
"application/problem+json" : {
2018-05-06 13:19:08 +03:00
"schema" : {
"$ref" : "../definitions/Error.json"
}
} ,
"text/plain" : {
"schema" : {
"type" : "string"
}
}
} ,
"examples" : {
2019-11-28 21:37:22 +03:00
"application/problem+json" : {
2019-11-25 21:15:46 +03:00
"error" : "INTERNAL_SERVER_ERROR" ,
2018-05-06 13:19:08 +03:00
"message" : "Unexpected error occurred"
} ,
2019-11-25 21:15:46 +03:00
"text/plain" : "INTERNAL_SERVER_ERROR"
2018-05-06 13:19:08 +03:00
}
}
}
}
}