-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.yaml
567 lines (564 loc) · 17.1 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
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
openapi: 3.0.3
info:
title: The JAW API
description: The JAW API reference file.
version: 1.0.0
servers:
- url: '/api/v1'
components:
parameters:
userId:
description: 'The user identifier number'
in: path
name: userId
required: true
schema:
type: integer
securitySchemes:
apiKey:
description: |
All the endpoints require to be authenticated as a user of the Blog administration.
For that you will need to provide a `Authorization` header with a valid **user API token**:
```
X-AUTH-TOKEN: user_api_key_here
```
in: header
name: X-AUTH-TOKEN
type: apiKey
schemas:
Configuration:
properties:
title:
description: 'The title of the blog.'
example: My awesome blog.
type: string
description:
description: 'The summary of the blog.'
example: MyBlog
type: string
callbackUrl:
description: 'The callback URL for the webhooks, if defined'
type: string
format: uri
webhooksEnabled:
description: 'Are the webhooks enabled or not'
type: boolean
createdAt:
description: 'Date of the creation of the configuration.'
example: 2022-04-28T14:03:09+00:00
type: string
format: date
updatedAt:
description: 'Date of the last update of the configuration.'
example: 2022-04-28T14:03:09+00:00
type: string
format: date
copyrightMessage:
description: 'The copyright message of the blog (can be use for anything else).'
example: Some message
type: string
copyrightExtraMessage:
description: 'The copyright extra message of the blog (can be use for anything else).'
example:
- null
- Some extra message
type: string
githubUserName:
description: 'The github username, if defined.'
example:
- null
- Some username
type: string
linkedinUserName:
description: 'The linkedin username, if defined.'
example:
- null
- Some username
type: string
googleAnalyticsId:
description: 'The google analytics, if defined.'
example:
- null
- Some id
type: string
User:
properties:
id:
description: 'The id of the user.'
example: 3.
type: integer
createdAt:
description: 'Date of the creation of the user.'
example: 2022-04-28T14:03:09+00:00
type: string
format: date
updatedAt:
description: 'Date of the last update of the user.'
example: 2022-04-28T14:03:09+00:00
type: string
format: date
username:
description: 'The username.'
example: SomePseudo
type: string
fullName:
description: 'The full name of the user.'
example: Foo Bar
type: string
email:
description: 'The email of the user'
example: [email protected]
type: string
format: email
token:
description: 'The API token of the user.'
example: token124356
type: string
Category:
properties:
id:
description: 'The id of the category.'
example: 3.
type: integer
title:
description: 'The title of the category.'
example: The Title
type: string
summary:
description: 'The summary of the category.'
example: The summary
type: string
slug:
description: 'The slug of the category.'
example: the-slug
type: string
postCount:
description: 'How many posts the category have.'
example: 3.
type: integer
createdAt:
description: 'Date of the creation of the category.'
example: 2022-04-28T14:03:09+00:00
type: string
format: date
updatedAt:
description: 'Date of the last update of the category.'
example: 2022-04-28T14:03:09+00:00
type: string
format: date
Post:
properties:
id:
description: 'The id of the post.'
example: 3.
type: integer
title:
description: 'The title of the post.'
example: The Title
type: string
summary:
description: 'The summary of the post.'
example: The summary
type: string
slug:
description: 'The slug of the post.'
example: the-slug
type: string
online:
description: 'Is the post set to online?'
example: true
type: boolean
language:
description: 'The language of the post.'
example: en
type: string
obsolete:
description: 'Is the post set as obsolete?'
example: true
type: boolean
content:
description: 'The content of the post.'
example: This is an amazing post I wrote.
type: string
createdAt:
description: 'Date of the creation of the post.'
example: 2022-04-28T14:03:09+00:00
type: string
format: date
updatedAt:
description: 'Date of the last update of the post.'
example: 2022-04-28T14:03:09+00:00
type: string
format: date
publishedAt:
description: 'Date of the last time when the post was set to Online.'
example: 2022-04-28T14:03:09+00:00
type: string
format: date
topPost:
description: 'Is the post set as top post?'
example: true
type: boolean
categoryId:
description: 'The id of the category the post belongs to.'
example: 3.
type: integer
authorId:
description: 'The id of the user who wrote this post.'
example: 5.
type: integer
paths:
/configuration:
get:
description: 'Get the configuration of the blog.'
responses:
'403':
description: The user is not authenticated.
'200':
description: Response will always return a 200 unless server error.
content:
application/json:
schema:
$ref: '#/components/schemas/Configuration'
example:
title: My blog
description: This my blog
callbackUrl: null
webhooksEnabled: false
createdAt: '2022-04-28T14:03:09+00:00'
updatedAt: '2022-04-28T14:03:09+00:00'
copyrightMessage: Do not copy my stuff.
copyrightExtraMessage: Or I will unleash my poodle.
githubUserName: somePseudo
linkedinUserName: null
googleAnalyticsId: null
tags:
- Configuration
/user/{userId}:
get:
description: 'Get the user. Need an admin API Token.'
parameters:
- $ref: '#/components/parameters/userId'
responses:
'403':
description: The token does not belong to an administrator.
content:
application/json:
example:
message: Route only accessible to admin users.
'404':
description: User does not exist.
content:
application/json:
example:
message: User not found.
'200':
description: The user exists.
content:
application/json:
schema:
$ref: '#/components/schemas/User'
example:
id : 3,
createdAt: '2022-04-28T14:03:09+00:00'
updatedAt: '2022-04-28T14:03:09+00:00'
userName: SuperJohn
fullName: John Doe
email: [email protected]
token: thisIsMyToken
tags:
- User
/category:
get:
description: 'Get the category by id or slug.'
parameters:
- in: query
name: id
schema:
type: integer
description: The id of the category.
- in: query
name: slug
schema:
type: string
description: The slug of the category.
responses:
'400':
description: Invalid filter given.
content:
application/json:
example:
message: "No supported filter was given. Available filters are: id, slug."
'403':
description: The user is not authenticated.
'404':
description: The category does not exists.
content:
application/json:
example:
message: No result found.
'200':
description: The category exists.
content:
application/json:
schema:
$ref: '#/components/schemas/Category'
example:
id : 3,
title: My favorite category
summary: Only good content!
slug: my-favorite-category
postCount: 8
createdAt: '2022-04-28T14:03:09+00:00'
updatedAt: '2022-04-28T14:03:09+00:00'
tags:
- Category
/category/search:
get:
description: 'Search categories using filters.'
parameters:
- in: query
name: id
schema:
type: integer
description: The id of the category.
- in: query
name: slug
schema:
type: string
description: The slug of the category.
- in: query
name: title
schema:
type: string
description: The title of the category.
- in: query
name: summary
schema:
type: string
description: The summary of the category.
- in: query
name: postCount
schema:
type: string
description: 'How many posts the category have.'
- in: query
name: page
schema:
type: integer
description: The results page offset.
- in: query
name: onlinePosts
schema:
type: integer
description: If set to 1, the categories posts count only represents online posts.
- in: query
name: offset
schema:
type: integer
description: The first offset of the results.
- in: query
name: keywords
schema:
type: string
description: The keywords to look for in the category title and summary.
- in: query
name: orderByField
schema:
type: array
items:
type: string
description: "Allows to order results according to some criteria (fields) by sorting them (ASC or DESC). Example: ?orderByField[title]=DESC"
responses:
'403':
description: The user is not authenticated.
'200':
description: Results.
content:
application/json:
schema:
$ref: '#/components/schemas/Category'
example:
resultCount: 1
totalResultCount: 2
page: 1
totalPageCount: 2
results:
id : 3,
title: My favorite category
summary: Only good content!
slug: my-favorite-category
postCount: 8
createdAt: '2022-04-28T14:03:09+00:00'
updatedAt: '2022-04-28T14:03:09+00:00'
tags:
- Category
/post:
get:
description: 'Get the post by id or slug.'
parameters:
- in: query
name: id
schema:
type: integer
description: The id of the post.
- in: query
name: slug
schema:
type: string
description: The slug of the post.
responses:
'400':
description: Invalid filter given.
content:
application/json:
example:
message: "No supported filter was given. Available filters are: id, slug."
'403':
description: The user is not authenticated.
'404':
description: The post does not exists.
content:
application/json:
example:
message: No result found.
'200':
description: The post exists.
content:
application/json:
schema:
$ref: '#/components/schemas/Post'
example:
id: 1,
title: My first post,
summary: The summary 1 keyword,
slug: my-first-post,
online: true,
language: en,
obsolete: false,
content: Then content 1,
createdAt: 2022-05-03T10:05:53+00:00,
updatedAt: 2022-05-03T10:05:53+00:00,
publishedAt: 2022-05-03T10:05:53+00:00,
topPost: false,
categoryId: 1,
authorId: 2
tags:
- Post
/post/search:
get:
description: 'Search posts using filters.'
parameters:
- in: query
name: id
schema:
type: integer
description: The id of the post.
- in: query
name: author
schema:
type: integer
description: The id of the user who wrote the post.
- in: query
name: category
schema:
type: integer
description: The id of the category the post belongs to.
- in: query
name: title
schema:
type: string
description: The title of the post.
- in: query
name: slug
schema:
type: string
description: The slug of the post.
- in: query
name: publishedAt
schema:
type: string
description: The date of the last time when the post was set to published.
- in: query
name: language
schema:
type: string
description: The language of the post.
- in: query
name: online
schema:
type: boolean
description: Is the post set to online?
- in: query
name: topPost
schema:
type: boolean
description: Is the post set to top post?
- in: query
name: obsolete
schema:
type: boolean
description: Is the post set to obsolete?
- in: query
name: createdAt
schema:
type: string
description: The date of when the post was created.
- in: query
name: updatedAt
schema:
type: string
description: The date of when the last time when post was updated.
- in: query
name: page
schema:
type: integer
description: The results page offset.
- in: query
name: offset
schema:
type: integer
description: The first offset of the results.
- in: query
name: keywords
schema:
type: string
description: The keywords to look for in the post title, summary and content.
- in: query
name: orderByField
schema:
type: array
items:
type: string
description: "Allows to order results according to some criteria (fields) by sorting them (ASC or DESC). Example: ?orderByField[title]=DESC"
responses:
'403':
description: The user is not authenticated.
'200':
description: Results.
content:
application/json:
schema:
$ref: '#/components/schemas/Post'
example:
resultCount: 1
totalResultCount: 2
page: 1
totalPageCount: 2
results:
id: 1,
title: My first post,
summary: The summary 1 keyword,
slug: my-first-post,
online: true,
language: en,
obsolete: false,
content: Then content 1,
createdAt: 2022-05-03T10:05:53+00:00,
updatedAt: 2022-05-03T10:05:53+00:00,
publishedAt: 2022-05-03T10:05:53+00:00,
topPost: false,
categoryId: 1,
authorId: 2
tags:
- Post