-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yml
193 lines (188 loc) · 5.16 KB
/
openapi.yml
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
openapi: 3.0.0
info:
description: |
RESTful API to manage a safebox system
version: 1.0.0
title: Safebox API
paths:
/safebox:
post:
summary: Creates a new safebox
description: |
Creates a new safebox based on a non-empty name and a password.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
description: Safebox Name
type: string
password:
description: Safebox Password
type: string
required:
- name
- password
example:
name: Adsmurai Safebox 01
password: adsmuraiExamplePassword
responses:
'200':
description: Safebox correctly created
content:
application/json:
schema:
type: object
properties:
id:
description: Safebox id
type: string
required:
- id
example:
id: f626c808-648c-41fe-865d-c6062f3e0899
'409':
description: Safebox already exists
'422':
description: Malformed expected data
'500':
description: Unexpected API error
/safebox/{id}:
get:
summary: Retrieves the content of a safebox
description: |
Retrieves the currently stored contents in the safebox identified by the
given ID and with the given opening token.
security:
- token: []
parameters:
- in: path
name: id
description: Safebox Id
required: true
schema:
type: string
responses:
'200':
description: Safebox contents correctly retrieved
content:
application/json:
schema:
type: object
properties:
items:
description: Safebox items
type: array
items:
type: string
required:
- items
example:
items:
- Safebox content 03
- Safebox content 02
- Safebox content 01
'401':
description: Specified token does not match
'404':
description: Requested safebox does not exist
'422':
description: Malformed expected data
'423':
description: Requested safebox is locked
'500':
description: Unexpected API error
post:
summary: Add an items to a Safebox
description: |
Inserts new contents in the safebox identified by the given ID and wit
the given opening token.
security:
- token: []
parameters:
- in: path
name: id
description: Safebox id
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
item:
description: Safebox item
type: string
example:
item: New safebox content
responses:
'200':
description: Content correctly added to the safebox
'401':
description: Specified token does not match
'404':
description: Requested safebox does not exist
'422':
description: Malformed expected data
'423':
description: Requested safebox is locked
'500':
description: Unexpected API error
/safebox/{id}/open:
get:
summary: Open a safebox
description: >
Opens the safebox identified by the given ID and with the specified password.
security:
- password: []
parameters:
- in: path
name: id
description: Safebox id
required: true
schema:
type: string
- in: query
name: expirationTime
schema:
type: integer
default: 180
required: false
description: Expiration time in seconds
responses:
'200':
description: Safebox correctly opened
content:
application/json:
schema:
type: object
properties:
token:
description: Token for future actions over an opening safebox
type: string
required:
- id
example:
token: RkbfZSW5MmcK3b7kcgg
'404':
description: Requested safebox does not exist
'422':
description: Malformed expected data
'423':
description: Requested safebox is locked
'500':
description: Unexpected API error
components:
securitySchemes:
token:
type: http
scheme: bearer
password:
type: http
scheme: bearer