2016-10-22 16:44:14 -05:00
{
"get" : {
2018-09-20 13:52:27 -05:00
"operationId" : "listShortUrls" ,
2016-10-22 17:07:31 -05:00
"tags" : [
2018-09-20 13:52:27 -05:00
"Short URLs"
2016-10-22 17:07:31 -05:00
] ,
"summary" : "List short URLs" ,
2019-12-31 09:05:02 -06:00
"description" : "Returns the list of short URLs." ,
2016-10-22 16:44:14 -05:00
"parameters" : [
2019-11-29 12:09:03 -06:00
{
"$ref" : "../parameters/version.json"
} ,
2016-10-22 16:44:14 -05:00
{
"name" : "page" ,
"in" : "query" ,
"description" : "The page to be displayed. Defaults to 1" ,
"required" : false ,
2018-02-03 02:53:40 -06:00
"schema" : {
"type" : "integer"
}
2016-10-22 16:44:14 -05:00
} ,
2021-01-24 02:27:40 -06:00
{
"name" : "itemsPerPage" ,
"in" : "query" ,
"description" : "The amount of items to return on every page. Defaults to 10" ,
"required" : false ,
"schema" : {
"type" : "number"
}
} ,
2016-10-22 16:44:14 -05:00
{
"name" : "searchTerm" ,
"in" : "query" ,
"description" : "A query used to filter results by searching for it on the longUrl and shortCode fields. (Since v1.3.0)" ,
"required" : false ,
2018-02-03 02:53:40 -06:00
"schema" : {
"type" : "string"
}
2016-10-22 16:44:14 -05:00
} ,
{
2018-08-04 09:15:09 -05:00
"name" : "tags[]" ,
2016-10-22 16:44:14 -05:00
"in" : "query" ,
2020-09-21 15:03:43 -05:00
"description" : "A list of tags used to filter the result set. Only short URLs tagged with at least one of the provided tags will be returned. (Since v1.3.0)" ,
2016-10-22 16:44:14 -05:00
"required" : false ,
2018-02-03 02:53:40 -06:00
"schema" : {
"type" : "array" ,
"items" : {
"type" : "string"
}
2016-10-22 16:44:14 -05:00
}
} ,
{
"name" : "orderBy" ,
"in" : "query" ,
"description" : "The field from which you want to order the result. (Since v1.3.0)" ,
"required" : false ,
2018-02-03 02:53:40 -06:00
"schema" : {
"type" : "string" ,
"enum" : [
2020-09-21 15:03:43 -05:00
"longUrl-ASC" ,
"longUrl-DESC" ,
"shortCode-ASC" ,
"shortCode-DESC" ,
"dateCreated-ASC" ,
"dateCreated-DESC" ,
"visits-ASC" ,
2021-02-04 15:07:54 -06:00
"visits-DESC" ,
"title-ASC" ,
"title-DESC"
2018-02-03 02:53:40 -06:00
]
}
2019-12-14 15:42:02 -06:00
} ,
{
"name" : "startDate" ,
"in" : "query" ,
"description" : "The date (in ISO-8601 format) from which we want to get short URLs." ,
"required" : false ,
"schema" : {
"type" : "string"
}
} ,
{
"name" : "endDate" ,
"in" : "query" ,
"description" : "The date (in ISO-8601 format) until which we want to get short URLs." ,
"required" : false ,
"schema" : {
"type" : "string"
}
2018-02-03 02:53:40 -06:00
}
] ,
"security" : [
2018-09-20 14:15:17 -05:00
{
"ApiKey" : [ ]
2016-10-22 16:44:14 -05:00
}
] ,
"responses" : {
"200" : {
"description" : "The list of short URLs" ,
2018-02-03 02:53:40 -06:00
"content" : {
"application/json" : {
"schema" : {
2016-10-22 16:44:14 -05:00
"type" : "object" ,
"properties" : {
2018-02-03 02:53:40 -06:00
"shortUrls" : {
"type" : "object" ,
"properties" : {
"data" : {
"type" : "array" ,
"items" : {
"$ref" : "../definitions/ShortUrl.json"
}
} ,
"pagination" : {
"$ref" : "../definitions/Pagination.json"
}
2016-10-22 16:44:14 -05:00
}
}
}
}
}
2017-04-16 03:27:27 -05:00
} ,
"examples" : {
"application/json" : {
"shortUrls" : {
"data" : [
{
2017-04-16 03:45:52 -05:00
"shortCode" : "12C18" ,
2018-08-13 09:17:43 -05:00
"shortUrl" : "https://doma.in/12C18" ,
"longUrl" : "https://store.steampowered.com" ,
2017-04-16 03:27:27 -05:00
"dateCreated" : "2016-08-21T20:34:16+02:00" ,
"visitsCount" : 328 ,
"tags" : [
"games" ,
"tech"
2019-07-08 11:42:53 -05:00
] ,
"meta" : {
"validSince" : "2017-01-21T00:00:00+02:00" ,
"validUntil" : null ,
"maxVisits" : 100
2020-02-02 01:57:04 -06:00
} ,
2021-02-02 13:51:28 -06:00
"domain" : null ,
"title" : "Welcome to Steam"
2017-04-16 03:45:52 -05:00
} ,
{
"shortCode" : "12Kb3" ,
2018-08-13 09:17:43 -05:00
"shortUrl" : "https://doma.in/12Kb3" ,
"longUrl" : "https://shlink.io" ,
2017-04-16 03:45:52 -05:00
"dateCreated" : "2016-05-01T20:34:16+02:00" ,
"visitsCount" : 1029 ,
"tags" : [
"shlink"
2019-07-08 11:42:53 -05:00
] ,
"meta" : {
"validSince" : null ,
"validUntil" : null ,
"maxVisits" : null
2020-02-02 01:57:04 -06:00
} ,
2021-02-02 13:51:28 -06:00
"domain" : null ,
"title" : null
2017-04-16 03:45:52 -05:00
} ,
{
"shortCode" : "123bA" ,
2020-02-02 01:57:04 -06:00
"shortUrl" : "https://example.com/123bA" ,
2018-08-13 09:17:43 -05:00
"longUrl" : "https://www.google.com" ,
2017-04-16 03:45:52 -05:00
"dateCreated" : "2015-10-01T20:34:16+02:00" ,
"visitsCount" : 25 ,
2019-07-08 11:42:53 -05:00
"tags" : [ ] ,
"meta" : {
"validSince" : "2017-01-21T00:00:00+02:00" ,
"validUntil" : null ,
"maxVisits" : null
2020-02-02 01:57:04 -06:00
} ,
2021-02-02 13:51:28 -06:00
"domain" : "example.com" ,
"title" : null
2017-04-16 03:27:27 -05:00
}
] ,
"pagination" : {
"currentPage" : 5 ,
2018-06-17 11:29:40 -05:00
"pagesCount" : 12 ,
"itemsPerPage" : 10 ,
"itemsInCurrentPage" : 10 ,
"totalItems" : 115
2017-04-16 03:27:27 -05:00
}
}
}
2016-10-22 16:44:14 -05:00
}
} ,
"500" : {
"description" : "Unexpected error." ,
2018-02-03 02:53:40 -06:00
"content" : {
2019-11-28 12:37:22 -06:00
"application/problem+json" : {
2018-02-03 02:53:40 -06:00
"schema" : {
"$ref" : "../definitions/Error.json"
}
}
2016-10-22 16:44:14 -05:00
}
}
}
} ,
2018-01-07 13:54:02 -06:00
2016-10-22 16:44:14 -05:00
"post" : {
2018-09-20 13:52:27 -05:00
"operationId" : "createShortUrl" ,
2016-10-22 17:07:31 -05:00
"tags" : [
2018-09-20 13:52:27 -05:00
"Short URLs"
2016-10-22 17:07:31 -05:00
] ,
"summary" : "Create short URL" ,
2021-01-04 05:44:29 -06:00
"description" : "Creates a new short URL.<br></br>**Param findIfExists**: This new param allows to force shlink to return existing short URLs when found based on provided params, instead of creating a new one. However, it might add complexity and have unexpected outputs.\n\nThese are the use cases:\n* Only the long URL is provided: It will return the newest match or create a new short URL if none is found.\n* Long url and custom slug are provided: It will return the short URL when both params match, return an error when the slug is in use for another long URL, or create a new short URL otherwise.\n* Any of the above but including other params (tags, validSince, validUntil, maxVisits): It will behave the same as the previous two cases, but it will try to exactly match existing results using all the params. If any of them does not match, it will try to create a new short URL." ,
2018-02-03 02:53:40 -06:00
"security" : [
2018-09-20 14:15:17 -05:00
{
"ApiKey" : [ ]
2016-10-22 16:44:14 -05:00
}
] ,
2019-11-29 12:09:03 -06:00
"parameters" : [
{
"$ref" : "../parameters/version.json"
}
] ,
2018-02-03 02:53:40 -06:00
"requestBody" : {
"description" : "Request body." ,
"required" : true ,
"content" : {
"application/json" : {
"schema" : {
"type" : "object" ,
"required" : [
"longUrl"
] ,
"properties" : {
"longUrl" : {
"description" : "The URL to parse" ,
"type" : "string"
} ,
"tags" : {
"description" : "The URL to parse" ,
"type" : "array" ,
"items" : {
"type" : "string"
}
} ,
"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"
} ,
"customSlug" : {
"description" : "A unique custom slug to be used instead of the generated short code" ,
"type" : "string"
} ,
"maxVisits" : {
"description" : "The maximum number of allowed visits for this short code" ,
"type" : "number"
2019-02-03 04:01:38 -06:00
} ,
"findIfExists" : {
"description" : "Will force existing matching URL to be returned if found, instead of creating a new one" ,
"type" : "boolean"
2019-10-04 14:17:02 -05:00
} ,
"domain" : {
"description" : "The domain to which the short URL will be attached" ,
"type" : "string"
2020-02-18 12:21:34 -06:00
} ,
"shortCodeLength" : {
"description" : "The length for generated short code. It has to be at least 4 and defaults to 5. It will be ignored when customSlug is provided" ,
"type" : "number"
2020-09-23 12:24:15 -05:00
} ,
"validateUrl" : {
"description" : "Tells if the long URL should or should not be validated as a reachable URL. If not provided, it will fall back to app-level config" ,
"type" : "boolean"
2021-02-02 13:51:28 -06:00
} ,
"title" : {
"type" : "string" ,
"description" : "A descriptive title of the short URL."
2018-02-03 02:53:40 -06:00
}
}
}
}
}
} ,
2016-10-22 16:44:14 -05:00
"responses" : {
"200" : {
"description" : "The result of parsing the long URL" ,
2018-02-03 02:53:40 -06:00
"content" : {
"application/json" : {
"schema" : {
2018-11-16 09:57:18 -06:00
"$ref" : "../definitions/ShortUrl.json"
2016-10-22 16:44:14 -05:00
}
}
2018-11-16 09:57:18 -06:00
} ,
"examples" : {
"application/json" : {
"shortCode" : "12C18" ,
"shortUrl" : "https://doma.in/12C18" ,
"longUrl" : "https://store.steampowered.com" ,
"dateCreated" : "2016-08-21T20:34:16+02:00" ,
"visitsCount" : 0 ,
"tags" : [
"games" ,
"tech"
2019-07-08 11:42:53 -05:00
] ,
"meta" : {
"validSince" : "2017-01-21T00:00:00+02:00" ,
"validUntil" : null ,
"maxVisits" : 500
2020-02-02 01:57:04 -06:00
} ,
"domain" : null
2018-11-16 09:57:18 -06:00
}
2016-10-22 16:44:14 -05:00
}
} ,
"400" : {
2019-11-28 12:37:22 -06:00
"description" : "Some of provided data is invalid. Check extra fields to know exactly what." ,
2018-02-03 02:53:40 -06:00
"content" : {
2019-11-28 12:37:22 -06:00
"application/problem+json" : {
2018-02-03 02:53:40 -06:00
"schema" : {
2019-11-28 12:37:22 -06:00
"type" : "object" ,
"allOf" : [
{
2019-11-29 12:24:04 -06:00
"$ref" : "../definitions/Error.json"
2019-11-28 12:37:22 -06:00
} ,
{
"type" : "object" ,
"properties" : {
"invalidElements" : {
2019-11-29 12:09:03 -06:00
"type" : "array" ,
"items" : {
"type" : "string" ,
"enum" : [
"validSince" ,
"validUntil" ,
"customSlug" ,
"maxVisits" ,
"findIfExists" ,
"domain"
]
}
2019-11-28 12:37:22 -06:00
} ,
"url" : {
"type" : "string" ,
"description" : "A URL that could not be verified, if the error type is INVALID_URL"
} ,
"customSlug" : {
"type" : "string" ,
"description" : "Provided custom slug when the error type is INVALID_SLUG"
}
}
}
]
2018-02-03 02:53:40 -06:00
}
}
2016-10-22 16:44:14 -05:00
}
} ,
"500" : {
"description" : "Unexpected error." ,
2018-02-03 02:53:40 -06:00
"content" : {
2019-11-28 12:37:22 -06:00
"application/problem+json" : {
2018-02-03 02:53:40 -06:00
"schema" : {
"$ref" : "../definitions/Error.json"
}
}
2016-10-22 16:44:14 -05:00
}
}
}
}
}