-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
api.yaml
127 lines (118 loc) · 3.59 KB
/
api.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
openapi: 3.0.1
servers:
- url: http://127.0.0.1:7070/api
description: Local server
- url: https://shortlink.best/api
description: Production server
- url: https://shortlink.best/mock
description: Mock server
# Available options: https://github.com/json-schema-faker/json-schema-faker/tree/master/docs#available-options
x-json-schema-faker:
locale: en
min-items: 2
max-items: 5
resolve-json-path: true
useExamplesValue: true
info:
version: 0.1.0
title: ShortLink API
description: |
ShortLink API for managing and retrieving short links.
contact:
email: support@shortlink.best
name: ShortLink repository
url: https://github.com/shortlink-org/shortlink/issues
license:
name: MIT
url: http://www.opensource.org/licenses/MIT
paths:
/links:
get:
summary: List links
description: Retrieve a list of all short links with pagination.
operationId: getLinks
tags:
- Link
parameters:
- $ref: 'base.yaml#/components/parameters/LimitParam'
- $ref: 'base.yaml#/components/parameters/CursorParam'
- in: query
name: filter
schema:
$ref: 'link.yaml#/components/schemas/LinkFilter'
responses:
'200':
$ref: 'link.yaml#/components/responses/PaginatedLinksResponse'
'500':
$ref: 'base.yaml#/components/responses/InternalServerError'
post:
summary: Add link
description: Add a new short link.
operationId: addLink
tags:
- Link
requestBody:
$ref: 'link.yaml#/components/requestBodies/AddLinkRequest'
responses:
'201':
$ref: 'link.yaml#/components/responses/LinkCreated'
'400':
$ref: 'base.yaml#/components/responses/BadRequest'
put:
summary: Update links
description: Update existing links based on a filter. Updates a single link if the 'id' field is specified in the filter.
operationId: updateLinks
tags:
- Link
requestBody:
$ref: 'link.yaml#/components/requestBodies/UpdateLinkRequest'
responses:
'200':
$ref: 'link.yaml#/components/responses/LinksUpdated'
'400':
$ref: 'base.yaml#/components/responses/BadRequest'
'404':
$ref: 'base.yaml#/components/responses/NotFound'
/links/{hash}:
get:
summary: Get link
description: Retrieve a specific link by its hash.
operationId: getLink
tags:
- Link
parameters:
- $ref: 'link.yaml#/components/parameters/LinkHashParam'
responses:
'200':
$ref: 'link.yaml#/components/responses/LinkDetails'
'404':
$ref: 'base.yaml#/components/responses/NotFound'
delete:
summary: Delete link
description: Delete a specific link by its hash.
operationId: deleteLink
tags:
- Link
parameters:
- $ref: 'link.yaml#/components/parameters/LinkHashParam'
responses:
'204':
$ref: 'link.yaml#/components/responses/LinkDeleted'
'404':
$ref: 'base.yaml#/components/responses/NotFound'
/sitemap:
post:
summary: Add Sitemap
description: Add a new sitemap.
operationId: addSitemap
tags:
- Sitemap
requestBody:
$ref: 'sitemap.yaml#/components/requestBodies/SitemapRequest'
responses:
'200':
$ref: 'sitemap.yaml#/components/responses/SitemapProcessed'
'400':
$ref: 'base.yaml#/components/responses/BadRequest'
'500':
$ref: 'base.yaml#/components/responses/InternalServerError'