-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiscourse_swagger.yml
833 lines (761 loc) · 18.4 KB
/
discourse_swagger.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
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
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
swagger: '2.0'
#Basic information
info:
version: 1.5.0-beta14
title: Discourse REST API Specificatiom
description: This specification describes the [Discourse](http://discourse.org) REST API and can be used to generate clients using the [Swagger](http://swagger.io) toolset.
#Meta types for API
produces:
- application/json
consumes:
- application/json
#Defines available security objects
securityDefinitions:
api_username:
name: api_username
type: apiKey
in: query
description: Username of user making request
api_key:
name: api_key
type: apiKey
in: query
description: Generated API key. Must have been generated for the username passed as `api_username`
#Defines default security objects for operations
security:
- api_username: []
- api_key: []
#List of operations available for the Discourse REST API
paths:
#Request site information
/site.json:
get:
operationId: getSite
description: |
Gets site information, including
1. Categories
2. Groups
3. Post action types
4. Topic flag types
and many other properties related to how the Discourse site is set up
security:
- api_username: []
- api_key: []
responses:
200:
description: Successful response
schema:
$ref: '#/definitions/Site'
/categories.json:
get:
operationId: getCategories
description: |
Gets detailed information about all categories available to the user making the request
security:
- api_username: []
- api_key: []
responses:
200:
description: Successful response
schema:
$ref: '#/definitions/CategoriesResponse'
/c/{id}.json:
get:
operationId: getCategory
description: |
Gets detailed information and topics for a specific category
parameters:
- name: id
type: string
description: Category slug
in: path
required: true
security:
- api_username: []
- api_key: []
responses:
200:
description: Successful response
schema:
$ref: '#/definitions/CategoryResponse'
/t/{id}.json:
get:
operationId: getTopic
description: |
Gets detailed information and posts for a specific topic
parameters:
- name: id
type: string
description: Topic slug
in: path
required: true
security:
- api_username: []
- api_key: []
responses:
200:
description: Successful response
schema:
$ref: '#/definitions/TopicView'
#Definitions of types used in the REST calls (parameters and responses)
definitions:
#Serialized by site_serializer.rb
Site:
properties:
archetypes:
description: Describes the available post archetypes
type: array
items:
$ref: '#/definitions/Archetype'
default_archetype:
description: The post archetype used by default
type: string
categories:
type: array
items:
$ref: '#/definitions/BasicCategory'
uncategorized_category_id:
description: The category ID used for uncategorized posts
type: integer
notification_types:
description: Map of string to integer listing the available notification types
type: object
additionalProperties:
type: integer
post_types:
description: Map of string to integer listing the available post types
type: object
additionalProperties:
type: integer
groups:
description: Lists the available groups
type: array
items:
type: object
properties:
id:
type: integer
name:
type: string
filters:
description: Lists the available post filters (latest, new, unread etc.)
type: array
items:
type: string
periods:
description: Lists the available time periods for filtering posts (all, yearly, daily etc.)
type: array
items:
type: string
top_menu_items:
description: Lists the menu items shown at the top of the page for logged in users
type: array
items:
type: string
anonymous_top_menu_items:
description: Lists the menu items shown at the top of the page for anonomous visitors
type: array
items:
type: string
is_readonly:
description: Indicates whether the site is in read-only mode
type: boolean
disabled_plugins:
description: Lists the plugins that are currently disabled
type: array
items:
type: string
suppressed_from_homepage_category_ids:
description: Declares which categories are suppressed from the front page
type: array
items:
type: integer
post_action_types:
description: Lists the actions users can apply to posts (like, bookmark, off_topic etc.)
type: array
items:
$ref: '#/definitions/PostActionType'
topic_flag_types:
description: Lists the flags that can be applied to topics (inappropriate, spam etc.)
type: array
items:
$ref: '#/definitions/TopicFlagType'
trust_levels:
type: array
items:
type: object
properties:
id:
type: integer
name:
type: string
user_fields:
type: array
items:
$ref: '#/definitions/UserField'
user_field_max_length:
type: integer
#Serialized by archetype_serializer.rb
Archetype:
properties:
id:
type: string
name:
type: string
options:
type: array
items:
type: string
#Serialized by basic_category_serializer.rb
BasicCategory:
properties:
id:
type: integer
name:
type: string
color:
type: string
text_color:
type: string
slug:
type: string
topic_count:
type: integer
post_count:
type: integer
position:
type: integer
description:
type: string
description_text:
type: string
topic_url:
type: string
logo_url:
type: string
background_url:
type: string
read_restricted:
type: boolean
permission:
type: integer
notification_level:
type: integer
can_edit:
type: boolean
topic_template:
type: string
has_children:
type: boolean
#Serialized by category_detailed_serializer.rb
CategoryDetailed:
allOf:
- $ref: '#/definitions/BasicCategory'
- type: object
properties:
topics_day:
type: integer
topics_week:
type: integer
topics_month:
type: integer
topics_year:
type: integer
posts_day:
type: integer
posts_week:
type: integer
posts_month:
type: integer
posts_year:
type: integer
description_excerpt:
type: string
featured_user_ids:
type: array
items:
type: integer
#Serialized by post_action_type_serializer.rb
PostActionType:
properties:
name_key:
type: string
name:
type: string
description:
type: string
long_form:
type: string
is_flag:
type: boolean
icon:
type: string
id:
type: integer
is_custom_flag:
type: boolean
#Serialized by post_action_type_serializer.rb
TopicFlagType:
allOf:
- $ref: '#/definitions/PostActionType'
#Serialized by user_field_serializer.rb
UserField:
properties:
id:
type: integer
name:
type: string
description:
type: string
field_type:
type: string
editable:
type: boolean
required:
type: boolean
show_on_profile:
type: boolean
position:
type: integer
options:
description: Only available when 'field_type' is 'dropdown'
type: array
items:
type: string
#Serialized by category_list_serializer.rb
CategoryList:
properties:
can_create_category:
type: boolean
can_create_topic:
type: boolean
draft:
type: string
draft_key:
type: string
draft_sequence:
type: integer
categories:
type: array
items:
$ref: '#/definitions/CategoryDetailed'
#Serialized by basic_user_serializer.rb
BasicUser:
properties:
id:
type: integer
username:
type: string
avatar_template:
type: string
#Not sure who serializes this
CategoriesResponse:
properties:
featured_users:
type: array
items:
$ref: '#/definitions/BasicUser'
category_list:
$ref: '#/definitions/CategoryList'
#Not sure who serializes this
CategoryResponse:
properties:
users:
type: array
items:
$ref: '#/definitions/BasicUser'
topic_list:
$ref: '#/definitions/TopicList'
#Serialized by topic_list_serializer.rb
TopicList:
properties:
properties:
can_create_topic:
type: boolean
draft:
type: string
draft_key:
type: string
draft_sequence:
type: integer
per_page:
type: integer
topics:
type: array
items:
$ref: '#/definitions/TopicListItem'
#Serialized by basic_topic_serializer.rb
BasicTopic:
properties:
id:
type: integer
title:
type: string
fancy_title:
type: string
slug:
type: string
posts_count:
type: integer
#Serialized by listable_topic_serializer.rb
ListableTopic:
allOf:
- $ref: '#/definitions/BasicTopic'
- type: object
properties:
reply_count:
type: integer
highest_post_number:
type: integer
image_url:
type: string
created_at:
type: string
last_posted_at:
type: string
bumped:
type: boolean
bumped_at:
type: string
unseen:
type: boolean
last_read_post_number:
type: integer
unread:
type: integer
new_posts:
type: integer
pinned:
type: boolean
unpinned:
type: boolean
visible:
type: boolean
closed:
type: boolean
archived:
type: boolean
notification_level:
type: integer
bookmarked:
type: boolean
liked:
type: boolean
#Serialized by topic_list_item_serializer.rb
TopicListItem:
allOf:
- $ref: '#/definitions/ListableTopic'
- type: object
properties:
views:
type: integer
like_count:
type: integer
has_summary:
type: boolean
archetype:
type: string
last_poster_username:
type: string
category_id:
type: integer
pinned_globally:
type: boolean
posters:
type: array
items:
$ref: '#/definitions/TopicPoster'
participants:
type: array
items:
$ref: '#/definitions/TopicPoster'
#Serialized by topic_poster_serializer.rb
TopicPoster:
properties:
extras:
type: string
description:
type: string
user_id:
type: integer
#Serialized by topic_view_serializer.rb
TopicView:
properties:
post_stream:
$ref: '#/definitions/PostStream'
id:
type: integer
title:
type: string
fancy_title:
type: string
posts_count:
type: integer
created_at:
type: string
views:
type: integer
reply_count:
type: integer
participant_count:
type: integer
like_count:
type: integer
last_posted_at:
type: string
visible:
type: boolean
closed:
type: boolean
archived:
type: boolean
has_summary:
type: boolean
archetype:
type: string
slug:
type: string
category_id:
type: integer
word_count:
type: integer
deleted_at:
type: string
user_id:
type: integer
draft:
type: string
draft_key:
type: string
draft_sequence:
type: integer
posted:
type: boolean
unpinned:
type: boolean
pinned_globally:
type: boolean
pinned:
type: boolean
pinned_at:
type: string
pinned_until:
type: string
#There is a TODO in the source code to move this to its own serializer, but for now we'll leave it here
details:
type: object
properties:
auto_close_at:
type: string
auto_close_hours:
type: string
auto_close_based_on_last_post:
type: boolean
created_by:
$ref: '#/definitions/BasicUser'
last_poster:
$ref: '#/definitions/BasicUser'
participants:
type: array
items:
$ref: '#/definitions/TopicPostCount'
suggested_topics:
type: array
items:
$ref: '#/definitions/SuggestedTopic'
links:
type: array
items:
$ref: '#/definitions/TopicLink'
notification_level:
type: integer
notifications_reason_id:
type: integer
can_move_posts:
type: boolean
can_edit:
type: boolean
can_recover:
type: boolean
can_remove_allowed_users:
type: boolean
can_invite_to:
type: boolean
can_create_post:
type: boolean
can_reply_as_new_topic:
type: boolean
can_flag_topic:
type: boolean
#END details
highest_post_number:
type: integer
last_read_post_number:
type: integer
deleted_by:
type: string
has_deleted:
type: boolean
actions_summary:
type: array
items:
type: object
properties:
id:
type: integer
count:
type: integer
hidden:
type: boolean
can_act:
type: boolean
chunk_size:
type: integer
bookmarked:
type: boolean
#Serialized by post_stream_serializer_mixin.rb
PostStream:
properties:
posts:
type: array
items:
$ref: '#/definitions/Post'
#Serialized by basic_post_serializer.rb
BasicPost:
properties:
id:
type: integer
name:
type: string
username:
type: string
avatar_template:
type: string
created_at:
type: string
cooked:
type: string
#Serialized by post_serializer.rb
Post:
allOf:
- $ref: '#/definitions/BasicPost'
- type: object
properties:
post_number:
type: integer
post_type:
type: integer
updated_at:
type: string
reply_count:
type: integer
reply_to_post_number:
type: integer
quote_count:
type: integer
avg_time:
type: string
incoming_link_count:
type: integer
reads:
type: integer
score:
type: number
yours:
type: boolean
topic_id:
type: integer
topic_slug:
type: string
display_username:
type: string
primary_group_name:
type: string
version:
type: integer
can_edit:
type: boolean
can_delete:
type: boolean
can_recover:
type: boolean
can_wiki:
type: boolean
read:
type: boolean
user_title:
type: string
actions_summary:
type: array
items:
type: object
properties:
id:
type: integer
can_act:
type: boolean
moderator:
type: boolean
admin:
type: boolean
staff:
type: boolean
user_id:
type: integer
hidden:
type: boolean
hidden_reason_id:
type: integer
trust_level:
type: integer
deleted_at:
type: string
user_deleted:
type: boolean
edit_reason:
type: string
can_view_edit_history:
type: boolean
wiki:
type: boolean
#Serialized by suggested_topic_serializer.rb
SuggestedTopic:
allOf:
- $ref: '#/definitions/ListableTopic'
- type: object
properties:
archetype:
type: string
like_count:
type: integer
views:
type: integer
category_id:
type: integer
TopicPostCount:
allOf:
- $ref: '#/definitions/BasicUser'
- type: object
properties:
post_count:
type: integer
TopicLink:
properties:
url:
type: string
title:
type: string
fancy_title:
type: string
internal:
type: boolean
attachment:
type: boolean
reflection:
type: boolean
clicks:
type: integer
user_id:
type: integer
domain:
type: string