forked from thorsten/phpMyFAQ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yaml
1132 lines (1132 loc) · 44.3 KB
/
openapi.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
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
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
info:
title: 'REST API for phpMyFAQ 4.0'
description: 'phpMyFAQ includes a REST API and offers APIs for various services like fetching the phpMyFAQ version or doing a search against the phpMyFAQ installation.'
contact:
name: 'phpMyFAQ Team'
email: support@phpmyfaq.de
license:
name: 'Mozilla Public Licence 2.0'
url: 'https://www.mozilla.org/MPL/2.0/'
version: '3.0'
servers:
- url: 'https://localhost'
description: 'Local dockerized server'
paths:
'/api/v3.0/attachments/{faqId}':
get:
tags:
- 'Public Endpoints'
description: 'Returns a list of attachments for a given FAQ record ID.'
operationId: getAttachments
parameters:
- name: faqId
in: path
description: 'The FAQ record ID.'
required: true
schema:
type: integer
responses:
'200':
description: 'If the FAQ has at least one attached file.'
headers:
Accept-Language:
description: 'The language code for the attachment.'
schema:
type: string
content:
application/json:
schema: {}
example: "\n [\n {\n \"filename\": \"attachment-1.pdf\",\n \"url\": \"https://www.example.org/index.php?action=attachment&id=1\"\n },\n {\n \"filename\": \"attachment-2.pdf\",\n \"url\": \"https://www.example.org/index.php?action=attachment&id=2\"\n }\n ]"
'404':
description: 'If the FAQ has no attachments.'
headers:
Accept-Language:
description: 'The language code for the attachment.'
schema:
type: string
content:
application/json:
schema: {}
example: []
'/api/v3.0/backup/{type}':
get:
tags:
- 'Endpoints with Authentication'
operationId: createBackup
parameters:
- name: type
in: path
description: 'The backup type. Can be "data", "logs" or "content".'
required: true
schema:
type: string
responses:
'200':
description: 'The current backup as a file or ZipArchive in case of "content"-type.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
content:
application/octet-stream:
schema:
type: string
application/zip:
schema:
type: string
'400':
description: 'If the backup type is wrong'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
content:
application/octet-stream:
schema:
type: string
'401':
description: 'If the user is not authenticated and/or does not have sufficient permissions.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
/api/v3.0/categories:
get:
tags:
- 'Public Endpoints'
operationId: getCategories
responses:
'200':
description: 'Returns the the categories for the given language provided by "Accept-Language".'
headers:
Accept-Language:
description: 'The language code for the categories.'
schema:
type: string
content:
application/json:
schema: {}
example: "\n [\n {\n \"id\": 1,\n \"lang\": \"en\",\n \"parent_id\": 0,\n \"name\": \"Test\",\n \"description\": \"Hello, World! Hello, Tests!\",\n \"user_id\": 1,\n \"group_id\": 1,\n \"active\": 1,\n \"show_home\": 1,\n \"image\": \"category-1-en.png\",\n \"level\": 1\n }\n ]"
'404':
description: 'If no categories are found for the given language.'
headers:
Accept-Language:
description: 'The language code for the categories.'
schema:
type: string
content:
application/json:
schema: {}
example: []
/api/v3.0/category:
post:
tags:
- 'Endpoints with Authentication'
operationId: createCategory
requestBody:
description: 'The parent category ID is a required value, the parent category name is optional. If the parent category name is present and the ID can be mapped, the parent category ID from the name will be used. If the parent category name cannot be mapped, a 409 error is thrown'
required: true
content:
application/json:
schema:
required:
- language
- parent-id
- parent-category-name
- category-name
- description
- user-id
- group-id
- is-active
- show-on-homepage
properties:
language:
type: string
parent-id:
type: integer
parent-category-name:
type: string
category-name:
type: string
description:
type: string
user-id:
type: integer
group-id:
type: integer
is-active:
type: boolean
show-on-homepage:
type: boolean
type: object
example: "{\n \"language\": \"en\",\n \"parent-id\": 1,\n \"parent-category-name\": \"Test\",\n \"category-name\": \"Test 2\",\n \"description\": \"Hello, World! Hello, Tests!\",\n \"user-id\": 1,\n \"group-id\": 1,\n \"is-active\": true,\n \"show-on-homepage\": true\n }"
responses:
'201':
description: 'If all posted data is correct.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
content:
application/json:
schema: {}
example: '{ "stored": true }'
'400':
description: "If something didn't worked out."
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
content:
application/json:
schema: {}
example: '{ "stored": false, "error": "Cannot add category" }'
'409':
description: 'If the parent category name cannot be mapped.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
content:
application/json:
schema: {}
example: '{ "stored": false, "error": "The given parent category name was not found." }'
'401':
description: 'If the user is not authenticated.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
'/api/v3.0/comments/{faqId}':
get:
tags:
- 'Public Endpoints'
description: 'Returns a list of comments for a given FAQ record ID.'
operationId: getComments
parameters:
- name: faqId
in: path
description: 'The FAQ record ID.'
required: true
schema:
type: integer
responses:
'200':
description: 'If the FAQ has at least one comment.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
content:
application/json:
schema: {}
example: "\n [\n {\n \"id\": 2,\n \"recordId\": 142,\n \"categoryId\": null,\n \"type\": \"faq\",\n \"username\": \"phpMyFAQ User\",\n \"email\": \"user@example.org\",\n \"comment\": \"Foo! Bar?\",\n \"date\": \"2019-12-24T12:24:57+0100\",\n \"helped\": null\n }\n ]"
'404':
description: 'If the FAQ has no comments.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
content:
application/json:
schema: {}
example: []
'/api/v3.0/faqs/{categoryId}':
get:
tags:
- 'Public Endpoints'
description: 'This endpoint returns all the FAQs with a preview of the answer for the given category ID and the language provided by "Accept-Language".'
operationId: getByCategoryId
parameters:
- name: categoryId
in: path
description: 'The category ID.'
required: true
schema:
type: integer
responses:
'200':
description: 'If the category returns at least one FAQ.'
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: "[\n {\n \"record_id\": 1,\n \"record_lang\": \"en\",\n \"category_id\": 1,\n \"record_title\": \"Is there life after death?\",\n \"record_preview\": \"Maybe!\",\n \"record_link\": \"/phpmyfaq/phpmyfaq/index.php?action=faq&cat=1&id=1&artlang=en\",\n \"record_updated\": \"20191010175452\",\n \"visits\": 3,\n \"record_created\": \"2018-09-03T21:30:17+02:00\"\n }\n ]"
'404':
description: 'If the category has no FAQs.'
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: []
'/api/v3.0/faq/{categoryId}/{faqId}':
get:
tags:
- 'Public Endpoints'
description: 'This endpoint returns the FAQ for the given FAQ ID and the language provided by "Accept-Language".'
operationId: getFaqById
parameters:
- name: categoryId
in: path
description: 'The category ID.'
required: true
schema:
type: integer
- name: faqId
in: path
description: 'The FAQ ID.'
required: true
schema:
type: integer
responses:
'200':
description: 'If the FAQ exists.'
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: "{\n \"id\": 1,\n \"lang\": \"en\",\n \"solution_id\": 1000,\n \"revision_id\": 0,\n \"active\": \"yes\",\n \"sticky\": 0,\n \"keywords\": \"\",\n \"title\": \"Is there life after death?\",\n \"content\": \"Maybe!\",\n \"author\": \"phpMyFAQ User\",\n \"email\": \"user@example.org\",\n \"comment\": \"y\",\n \"date\": \"2019-10-10 17:54\",\n \"dateStart\": \"00000000000000\",\n \"dateEnd\": \"99991231235959\",\n \"created\": \"2019-09-03T21:30:17+02:00\"\n }"
'404':
description: 'If there are no FAQs for the given FAQ ID.'
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: []
'/api/v3.0/faqs/tags/{tagId}':
get:
tags:
- 'Public Endpoints'
description: "This endpoint returns all the FAQs for the given tag ID and the language provided by \n \"Accept-Language\""
operationId: getByTagId
parameters:
- name: tagId
in: path
description: 'The tag ID.'
required: true
schema:
type: integer
responses:
'200':
description: 'If the tag ID returns at least one FAQ.'
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: "[\n {\n \"record_id\": 1,\n \"record_lang\": \"en\",\n \"category_id\": 1,\n \"record_title\": \"Is there life after death?\",\n \"record_preview\": \"Maybe!\",\n \"record_link\": \"/phpmyfaq/phpmyfaq/index.php?action=faq&cat=1&id=1&artlang=en\",\n \"record_updated\": \"20191010175452\",\n \"visits\": 3,\n \"record_created\": \"2018-09-03T21:30:17+02:00\"\n }\n ]"
'404':
description: 'If the tag ID has no FAQs.'
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: []
/api/v3.0/faqs/popular:
get:
tags:
- 'Public Endpoints'
description: 'This endpoint returns the popular FAQs for the given language provided by "Accept-Language".'
operationId: getPopular
responses:
'200':
description: "If there's at least one popular FAQ."
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: "[\n {\n \"date\": \"2019-07-13T11:28:00+0200\",\n \"question\": \"How can I survive without phpMyFAQ?\",\n \"answer\": \"A good question!\",\n \"visits\": 10,\n \"url\": \"https://www.example.org/index.php?action=faq&cat=1&id=36&artlang=de\"\n }\n ]"
'404':
description: "If there's not a single popular FAQ."
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: []
/api/v3.0/faqs/latest:
get:
tags:
- 'Public Endpoints'
description: 'This endpoint returns the latest FAQs for the given language provided by "Accept-Language".'
operationId: getLatest
responses:
'200':
description: "If there's at least one latest FAQ."
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: "[\n {\n \"date\": \"2019-07-13T11:28:00+0200\",\n \"question\": \"How can I survive without phpMyFAQ?\",\n \"answer\": \"A good question!\",\n \"visits\": 10,\n \"url\": \"https://www.example.org/index.php?action=faq&cat=1&id=36&artlang=de\"\n }\n ]"
'404':
description: "If there's not one latest FAQ."
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: []
/api/v3.0/faqs/trending:
get:
tags:
- 'Public Endpoints'
description: 'This endpoint returns the trending FAQs for the given language provided by "Accept-Language".'
operationId: getTrending
responses:
'200':
description: "If there's at least one trending FAQ."
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: "[\n {\n \"date\": \"2019-07-13T11:28:00+0200\",\n \"question\": \"How can I survive without phpMyFAQ?\",\n \"answer\": \"A good question!\",\n \"visits\": 10,\n \"url\": \"https://www.example.org/index.php?action=faq&cat=1&id=36&artlang=de\"\n }\n ]"
'404':
description: "If there's not a single trending FAQ."
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: []
/api/v3.0/faqs/sticky:
get:
tags:
- 'Public Endpoints'
description: 'This endpoint returns the sticky FAQs for the given language provided by "Accept-Language".'
operationId: getSticky
responses:
'200':
description: "If there's at least one sticky FAQ."
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: "[\n {\n \"question\": \"How can I survive without phpMyFAQ?\",\n \"url\": \"https://www.example.org/index.php?action=faq&cat=1&id=36&artlang=de\",\n \"id\": \"8\",\n \"order\": \"1\"\n },\n {\n \"question\": \"Is there life after death?\",\n \"url\": \"https://www.example.org/index.php?action=faq&cat=1&id=1&artlang=en\",\n \"id\": \"10\",\n \"order\": \"2\"\n }\n ]"
'404':
description: "If there's not one sticky FAQ."
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: []
/api/v3.0/faqs:
get:
tags:
- 'Public Endpoints'
description: 'This endpoint returns all the FAQs for the given language provided by "Accept-Language".'
operationId: getAll
responses:
'200':
description: "If there's at least one FAQ."
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: "[\n {\n \"id\": \"1\",\n \"lang\": \"en\",\n \"solution_id\": \"1000\",\n \"revision_id\": \"0\",\n \"active\": \"yes\",\n \"sticky\": \"0\",\n \"keywords\": \"\",\n \"title\": \"Is there life after death?\",\n \"content\": \"Maybe!\",\n \"author\": \"phpMyFAQ User\",\n \"email\": \"user@example.org\",\n \"comment\": \"y\",\n \"updated\": \"2009-10-10 17:54:00\",\n \"dateStart\": \"00000000000000\",\n \"dateEnd\": \"99991231235959\",\n \"created\": \"2008-09-03T21:30:17+02:00\",\n \"notes\": \"\"\n }\n ]"
'404':
description: "If there's not one single FAQ."
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: []
/api/v3.0/faq/create:
post:
tags:
- 'Endpoints with Authentication'
operationId: createFaq
requestBody:
description: 'The category ID is a required value, the category name is optional. If the category name is present and the ID can be mapped, the category ID from the name will be used. If the category name cannot be mapped, a 409 error is thrown.'
required: true
content:
application/json:
schema:
required:
- language
- category-id
- category-name
- question
- answer
- keywords
- author
- email
- is-active
- is-sticky
properties:
language:
type: string
category-id:
type: integer
category-name:
type: string
question:
type: string
answer:
type: string
keywords:
type: string
author:
type: string
email:
type: string
is-active:
type: boolean
is-sticky:
type: boolean
type: object
example: "{\n \"language\": \"de\",\n \"category-id\": 1,\n \"category-name\": \"Queen Songs\",\n \"question\": \"Is this the world we created?\",\n \"answer\": \"What did we do it for, is this the world we invaded, against the law, so it seems in the end, is this what we're all living for today\",\n \"keywords\": \"phpMyFAQ, FAQ, Foo, Bar\",\n \"author\": \"Freddie Mercury\",\n \"email\": \"freddie.mercury@example.org\",\n \"is-active\": \"true\",\n \"is-sticky\": \"false\"\n }"
responses:
'201':
description: 'If all posted data is correct.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
content:
application/json:
schema: {}
example: '{ "stored": true }'
'400':
description: "If something didn't worked out."
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
content:
application/json:
schema: {}
example: '{ "stored": false, "error": "It is not allowed, that the question title contains a hash." }'
'409':
description: 'If the parent category name cannot be mapped.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
content:
application/json:
schema: {}
example: '{ "stored": false, "error": "The given category name was not found" }'
'401':
description: 'If the user is not authenticated.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
/api/v3.0/faq/update:
put:
tags:
- 'Endpoints with Authentication'
description: 'Used to update a FAQ in one existing category.'
operationId: updateFaq
requestBody:
required: true
content:
application/json:
schema:
required:
- faq-id
- language
- category-id
- question
- answer
- keywords
- author
- email
- is-active
- is-sticky
properties:
faq-id:
type: integer
language:
type: string
category-id:
type: integer
question:
type: string
answer:
type: string
keywords:
type: string
author:
type: string
email:
type: string
is-active:
type: boolean
is-sticky:
type: boolean
type: object
example: "{\n \"faq-id\": 1,\n \"language\": \"de\",\n \"category-id\": 1,\n \"question\": \"Is this the world we updated?\",\n \"answer\": \"What did we do it for, is this the world we invaded, against the law, so it seems in the end, is this what we're all living for today\",\n \"keywords\": \"phpMyFAQ, FAQ, Foo, Bar\",\n \"author\": \"Freddie Mercury\",\n \"email\": \"freddie.mercury@example.org\",\n \"is-active\": \"true\",\n \"is-sticky\": \"false\"\n }"
responses:
'200':
description: 'If all posted data is correct.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
content:
application/json:
schema: {}
example: '{ "stored": true }'
'400':
description: "If something didn't worked out."
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
content:
application/json:
schema: {}
example: '{ "stored": false, "error": "It is not allowed, that the question title contains a hash." }'
'401':
description: 'If the user is not authenticated.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
/api/v3.0/groups:
get:
tags:
- 'Endpoints with Authentication'
description: 'Used to fetch all group IDs.'
operationId: getGroups
responses:
'200':
description: 'Returns a list of group IDs.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
content:
application/json:
schema: {}
example: "\n [\n {\n \"group-id\": 1\n },\n {\n \"group-id\": 2\n }\n ]"
'401':
description: 'If the user is not authenticated.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
/api/v3.0/language:
get:
tags:
- 'Public Endpoints'
operationId: getLanguage
responses:
'200':
description: 'Returns the default language as language code.'
content:
application/json:
schema: {}
example: '"en"'
/api/v3.0/login:
post:
tags:
- 'Public Endpoints'
operationId: login
requestBody:
description: 'The username and password for the login.'
required: true
content:
application/json:
schema:
required:
- username
- password
properties:
username:
type: string
password:
type: string
type: object
responses:
'200':
description: 'If "username" and "password" combination are correct.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
content:
application/json:
schema: {}
example: '{ "loggedin": true }'
'400':
description: 'If "username" and "password" combination are wrong.'
headers:
Accept-Language:
description: 'The language code for the login.'
schema:
type: string
content:
application/json:
schema: {}
example: '{ "loggedin": false, "error": "Wrong username or password." }'
/api/v3.0/news:
get:
tags:
- 'Public Endpoints'
operationId: getNews
responses:
'200':
description: 'Returns the news for the given language provided by "Accept-Language".'
headers:
Accept-Language:
description: 'The language code for the open questions.'
schema:
type: string
content:
application/json:
schema: {}
example: "\n [\n {\n \"id\": 1,\n \"lang\": \"en\",\n \"date\": \"2019-08-23T20:43:00+0200\",\n \"header\": \"Hallo, World!\",\n \"content\": \"Hello, phpMyFAQ!\",\n \"authorName\": \"phpMyFAQ User\",\n \"authorEmail\": \"user@example.org\",\n \"dateStart\": \"0\",\n \"dateEnd\": \"99991231235959\",\n \"active\": true,\n \"allowComments\": true,\n \"link\": \"\",\n \"linkTitle\": \"\",\n \"target\": \"\",\n \"url\": \"https://www.example.org/?action=news&newsid=1&newslang=de\"\n }\n ]"
'404':
description: 'If no news are stored.'
headers:
Accept-Language:
description: 'The language code for the open questions.'
schema:
type: string
content:
application/json:
schema: {}
example: []
/api/v3.0/open-questions:
get:
tags:
- 'Public Endpoints'
operationId: getOpenQuestions
responses:
'200':
description: 'Returns the open questions for the given language provided by "Accept-Language".'
headers:
Accept-Language:
description: 'The language code for the open questions.'
schema:
type: string
content:
application/json:
schema: {}
example: "\n [\n {\n \"id\": 1,\n \"lang\": \"en\",\n \"username\": \"phpMyFAQ User\",\n \"email\": \"user@example.org\",\n \"categoryId\": 3,\n \"question\": \"Foo? Bar? Baz?\",\n \"created\": \"20190106180429\",\n \"answerId\": 0,\n \"isVisible\": \"N\"\n }\n ]"
'404':
description: 'If no open questions are stored.'
headers:
Accept-Language:
description: 'The language code for the open questions.'
schema:
type: string
content:
application/json:
schema: {}
example: []
'/api/v3.0/pdf/{categoryId}/{faqId}':
get:
tags:
- 'Public Endpoints'
description: 'This endpoint returns the URL to the PDF of FAQ for the given FAQ ID and the language provided by "Accept-Language".'
operationId: getPdfById
parameters:
- name: categoryId
in: path
description: 'The category ID.'
required: true
schema:
type: integer
- name: faqId
in: path
description: 'The FAQ ID.'
required: true
schema:
type: integer
responses:
'200':
description: 'If the PDF of the FAQ exists.'
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: '"https://www.example.org/pdf.php?cat=3&id=142&artlang=de"'
'404':
description: "If there's no FAQ and PDF for the given FAQ ID."
headers:
Accept-Language:
description: 'The language code for the FAQ.'
schema:
type: string
content:
application/json:
schema: {}
example: []
/api/v3.0/question:
post:
tags:
- 'Endpoints with Authentication'
operationId: createQuestion
requestBody:
required: true
content:
application/json:
schema:
required:
- category-id
- question
- author
- email
properties:
category-id:
type: integer
question:
type: string
author:
type: string
email:
type: string
type: object
example: "{\n \"category-id\": \"1\",\n \"question\": \"Is this the world we created?\",\n \"author\": \"Freddie Mercury\",\n \"email\": \"freddie.mercury@example.org\"\n }"
responses:
'201':
description: 'Used to add a new question in one existing category.'
headers:
Accept-Language:
description: 'The language code for the question.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
content:
application/json:
schema: {}
example: '{ "stored": true }'
'401':
description: 'If the user is not authenticated.'
headers:
Accept-Language:
description: 'The language code for the question.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
/api/v3.0/register:
post:
tags:
- 'Endpoints with Authentication'
operationId: createUser
requestBody:
required: true
content:
application/json:
schema:
required:
- username
- fullname
- email
- is-visible
properties:
username:
type: string
fullname:
type: string
email:
type: string
is-visible:
type: boolean
type: object
example: "{\n \"username\": \"ada\",\n \"fullname\": \"Ada Lovelace\",\n \"email\": \"ada.lovelace@example.org\",\n \"is-visible\": false\n }"
responses:
'201':
description: 'If "username", "fullname", "email", and "is-visible" combination is correct.'
headers:
Accept-Language:
description: 'The language code for the question.'
schema:
type: string
x-pmf-token:
description: 'phpMyFAQ client API Token, generated in admin backend'
schema:
type: string
content:
application/json:
schema: {}
example: '{ "registered": true, "success": "User created."}'
'400':
description: 'If "username", "fullname", "email", and "is-visible" combination is not correct.'
headers:
Accept-Language:
description: 'The language code for the question.'
schema:
type: string
x-pmf-token: