123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- {
- "get": {
- "operationId": "shortenUrl",
- "tags": [
- "Short URLs"
- ],
- "summary": "Create a short URL",
- "description": "Creates a short URL in a single API call. Useful for third party integrations.",
- "parameters": [
- {
- "$ref": "../parameters/version.json"
- },
- {
- "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": {
- "$ref": "../definitions/ShortUrl.json"
- }
- },
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- },
- "examples": {
- "application/json": {
- "longUrl": "https://github.com/shlinkio/shlink",
- "shortUrl": "https://doma.in/abc123",
- "shortCode": "abc123",
- "dateCreated": "2016-08-21T20:34:16+02:00",
- "visitsCount": 0,
- "tags": [
- "games",
- "tech"
- ],
- "meta": {
- "validSince": "2017-01-21T00:00:00+02:00",
- "validUntil": null,
- "maxVisits": 100
- },
- "domain": null,
- "title": null
- },
- "text/plain": "https://doma.in/abc123"
- }
- },
- "400": {
- "description": "The long URL was not provided or is invalid.",
- "content": {
- "application/problem+json": {
- "schema": {
- "$ref": "../definitions/Error.json"
- }
- },
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- },
- "examples": {
- "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"
- },
- "text/plain": "INVALID_URL"
- }
- },
- "500": {
- "description": "Unexpected error.",
- "content": {
- "application/problem+json": {
- "schema": {
- "$ref": "../definitions/Error.json"
- }
- },
- "text/plain": {
- "schema": {
- "type": "string"
- }
- }
- },
- "examples": {
- "application/problem+json": {
- "error": "INTERNAL_SERVER_ERROR",
- "message": "Unexpected error occurred"
- },
- "text/plain": "INTERNAL_SERVER_ERROR"
- }
- }
- }
- }
- }
|