short/openapi.yaml

68 lines
1.8 KiB
YAML
Raw Normal View History

2024-01-29 18:19:50 +00:00
openapi: 3.0.3
info:
title: URL shortener
version: 0.1.0
description: An URL shortener service.
paths:
2024-01-29 21:23:23 +00:00
"/{hash}":
2024-01-29 18:19:50 +00:00
get:
responses:
2024-01-29 21:23:23 +00:00
"307":
2024-01-29 18:19:50 +00:00
description: Redirect client to long URL.
headers:
Location:
schema:
type: string
description: Long URL
2024-01-29 21:23:23 +00:00
"404":
2024-01-29 18:19:50 +00:00
description: Not Found
description: Redirect client to long URL.
operationId: redirectLongURL
2024-01-29 18:19:50 +00:00
parameters:
- schema:
type: string
name: hash
in: path
required: true
description: Hash of shorten URL.
/create:
post:
requestBody:
description: Create a shorten URL
required: true
content:
application/json:
schema:
type: object
properties:
url:
type: string
description: URL to shorten
2024-01-29 21:23:23 +00:00
example: "https://example.com"
2024-01-29 18:19:50 +00:00
required:
- url
responses:
2024-01-29 21:23:23 +00:00
"201":
2024-01-29 18:19:50 +00:00
description: Succesfully created shorten URL.
content:
application/json:
schema:
type: object
properties:
shorten:
type: string
description: Created shorten URL. Going to this URL should redirect to URL from request body.
2024-01-29 20:21:23 +00:00
required:
- shorten
2024-01-29 21:23:23 +00:00
"400":
2024-01-29 18:19:50 +00:00
description: Bad Request
content:
application/json:
schema:
type: object
properties:
message:
type: string
description: Create a shorten URL.
operationId: createShortURL