· 5 years ago · Feb 21, 2021, 12:30 PM
1openapi: 3.0.3
2
3info:
4 title: REST API Server
5 description: Endpoint definitions for system resources
6 version: 1.0.0
7
8paths:
9 /api/v1/access-tokens/register:
10 post:
11 tags:
12 - Access Tokens
13 summary: Register
14 requestBody:
15 content:
16 application/json:
17 schema:
18 type: object
19 properties:
20 email:
21 type: string
22 password:
23 type: string
24 required:
25 - email
26 - password
27 description: Registrating new user and generating access tokens for it
28 responses:
29 200:
30 description: Returns a refresh_token and jwt token for the registered user
31 content:
32 application/json:
33 schema:
34 type: object
35 properties:
36 meta:
37 $ref: '#/components/schemas/response_meta'
38 result:
39 type: object
40 properties:
41 user:
42 $ref: '#/components/schemas/user_document'
43 jwt:
44 type: string
45 refresh_token:
46 type: string
47 400:
48 description: Invalid Request
49 content:
50 application/json:
51 schema:
52 type: object
53 properties:
54 meta:
55 $ref: '#/components/schemas/response_meta'
56 error:
57 type: array
58 items:
59 $ref: '#/components/schemas/message_document_400'
60 500:
61 description: Internal Server Error
62 content:
63 application/json:
64 schema:
65 type: object
66 properties:
67 meta:
68 $ref: '#/components/schemas/response_meta'
69 error:
70 type: array
71 items:
72 $ref: '#/components/schemas/message_document_500'
73 /api/v1/access-tokens/login:
74 post:
75 tags:
76 - Access Tokens
77 summary: Login
78 description: Logs an user into session and sets new refresh_token and new jwt token
79 requestBody:
80 content:
81 application/json:
82 schema:
83 type: object
84 properties:
85 email:
86 type: string
87 password:
88 type: string
89 required:
90 - email
91 - password
92 responses:
93 200:
94 description: Returns a refresh_token and jwt token for the logged user
95 content:
96 application/json:
97 schema:
98 type: object
99 properties:
100 meta:
101 $ref: '#/components/schemas/response_meta'
102 result:
103 type: object
104 properties:
105 jwt:
106 type: string
107 refresh_token:
108 type: string
109 400:
110 description: Invalid Request
111 content:
112 application/json:
113 schema:
114 type: object
115 properties:
116 meta:
117 $ref: '#/components/schemas/response_meta'
118 error:
119 type: array
120 items:
121 $ref: '#/components/schemas/message_document_400'
122 500:
123 description: Internal Server Error
124 content:
125 application/json:
126 schema:
127 type: object
128 properties:
129 meta:
130 $ref: '#/components/schemas/response_meta'
131 error:
132 type: array
133 items:
134 $ref: '#/components/schemas/message_document_500'
135 /api/v1/access-tokens:
136 get:
137 tags:
138 - Access Tokens
139 summary: Obtain new JWT Token
140 description: Sing a new jwt token by providing refresh_token as an session key
141 security:
142 - RefreshToken: []
143 parameters:
144 - name: Language
145 in: header
146 schema:
147 $ref: '#/components/schemas/header_language_enum'
148 - name: X-Refresh-Token
149 in: header
150 schema:
151 type: string
152 responses:
153 200:
154 description: Returns a new jwt token
155 content:
156 application/json:
157 schema:
158 type: object
159 properties:
160 jwt:
161 type: string
162 400:
163 description: Invalid Request
164 content:
165 application/json:
166 schema:
167 type: object
168 properties:
169 meta:
170 $ref: '#/components/schemas/response_meta'
171 error:
172 type: array
173 items:
174 $ref: '#/components/schemas/message_document_400'
175 500:
176 description: Internal Server Error
177 content:
178 application/json:
179 schema:
180 type: object
181 properties:
182 meta:
183 $ref: '#/components/schemas/response_meta'
184 error:
185 type: array
186 items:
187 $ref: '#/components/schemas/message_document_500'
188 post:
189 tags:
190 - Access Tokens
191 summary: Obtain new Refresh Token
192 description: Send an old refresh_token and if it's still valid, you'll get a new one with new expiry date.
193 parameters:
194 - name: Language
195 in: header
196 schema:
197 $ref: '#/components/schemas/header_language_enum'
198 requestBody:
199 content:
200 application/json:
201 schema:
202 type: object
203 properties:
204 token:
205 type: string
206 responses:
207 200:
208 description: Returns a new refresh_token
209 content:
210 application/json:
211 schema:
212 type: object
213 properties:
214 jwt:
215 type: string
216 400:
217 description: Invalid Request
218 content:
219 application/json:
220 schema:
221 type: object
222 properties:
223 meta:
224 $ref: '#/components/schemas/response_meta'
225 error:
226 type: array
227 items:
228 $ref: '#/components/schemas/message_document_400'
229 500:
230 description: Internal Server Error
231 content:
232 application/json:
233 schema:
234 type: object
235 properties:
236 meta:
237 $ref: '#/components/schemas/response_meta'
238 error:
239 type: array
240 items:
241 $ref: '#/components/schemas/message_document_500'
242
243components:
244 schemas: {}
245