Repository navigation
Expand file tree
/
Copy pathopenapi.yml
More file actions
1537 lines (1536 loc) · 57.8 KB
/
Copy pathopenapi.yml
File metadata and controls
1537 lines (1536 loc) · 57.8 KB
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
servers:
- url: https://api.wp1.openzim.org/v1
description: Production server HTTPS
- url: http://api.wp1.openzim.org/v1
description: Production server HTTP
info:
description: 'Wikipedia 1.0 is an editing project on Wikipedia. It includes a bot, called the WP 1.0 bot, and a frontend web interface for that bot which lives at https://wp1.openzim.org. This document describes the server that acts as the API backend for that frontend server. Generally speaking, it contains only features which are useful to that frontend. However it is documented here and made available without restriction in the hopes that it may be useful.'
version: 'v1'
title: 'WP 1.0 Frontend'
contact:
name: 'Travis Briggs'
email: 'audiodude@gmail.com'
license:
name: 'GPL v2 or greater'
url: 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html'
tags:
- name: Projects
description: 'WikiProjects that the WP 1.0 bot tracks, and their article ratings.'
- name: Articles
description: 'Utilities for linking to articles on Wikipedia.'
- name: Sites
description: 'The list of MediaWiki sites that Selections can be built against.'
- name: Builders
description: 'Builders are the user-owned specifications that produce Selections (article lists) and ZIM files.'
- name: Selections
description: 'Materialized article lists belonging to a Builder.'
- name: ZIM
description: 'ZIM file generation via the Zimfarm, and the email notifications for it.'
- name: OAuth
description: 'Login/logout via MediaWiki OAuth. Sessions are held in a cookie.'
- name: Meta
description: 'Endpoints describing the API itself.'
paths:
/openapi.yml:
get:
summary: 'This OpenAPI document, which is rendered by the swagger-ui frontend hosted at the root of this server.'
operationId: openapiSpec
tags:
- Meta
responses:
'200':
description: 'Successful operation'
content:
application/yaml:
schema:
type: string
/articles/redirect:
get:
summary: 'Redirect to the given Wikipedia article at the revision that was current at the given timestamp'
operationId: articleRedirect
tags:
- Articles
responses:
'302':
description: 'Successful operation, redirect to the article revision on Wikipedia'
'404':
description: 'No revision of that article could be found for that timestamp'
parameters:
- name: name
in: query
required: true
description: 'The name of the article, with namespace if required, as it appears on Wikipedia'
schema:
type: string
- name: timestamp
in: query
required: true
description: 'A timestamp like 2020-06-22T10:55:10Z which represents the time of the revision to be redirected to'
schema:
type: string
/projects/:
get:
summary: 'List all projects that the WP 1.0 bot updates'
operationId: listProjects
tags:
- Projects
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Project'
/projects/count:
get:
summary: 'Count of the total number of projects'
operationId: countProjects
tags:
- Projects
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
type: object
properties:
count:
type: integer
/projects/assessments:
get:
summary: 'The number of assessed and unassessed articles in every project, ordered by number of unassessed articles descending.'
description: 'This data is expensive to compute and is served from a cache that is warmed by a recurring job, so it may lag behind the ratings tables by up to a day.'
operationId: projectAssessments
tags:
- Projects
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
type: array
description: 'Each entry is a fixed length triple of [project name, unassessed count, assessed count].'
items:
type: array
minItems: 3
maxItems: 3
items:
oneOf:
- type: string
- type: integer
/projects/{projectId}:
get:
summary: 'Retrieve the entry for a specific project'
operationId: getProject
tags:
- Projects
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
$ref: '#/components/schemas/Project'
'404':
description: 'No project with that projectId was found'
parameters:
- name: projectId
in: path
required: true
description: 'The name of the project, with spaces replaced by "_"'
schema:
type: string
/projects/{projectId}/table:
get:
summary: 'Data for building a summary table for a given project'
operationId: projectTable
tags:
- Projects
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
type: object
properties:
table_data:
type: object
description: 'The various data needed to construct the table'
'404':
description: 'No project with that projectId was found'
parameters:
- name: projectId
in: path
required: true
description: 'The name of the project, with spaces replaced by "_"'
schema:
type: string
/projects/{projectId}/articles:
get:
summary: 'List of articles for a project, optionally filtered by quality/importance'
description: 'If the projectB parameter is provided, this endpoint instead compares two projects, and each entry of the returned articles array is a two element array of the matching article in project A and project B. If format=tsv is given, the full filtered article list (ignoring page and numRows) is returned as a tab-separated-values download instead of JSON; this is not supported together with projectB.'
operationId: projectArticles
tags:
- Projects
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
type: object
properties:
pagination:
type: object
properties:
page:
description: 'The current page of results. This echoes back the page query parameter verbatim, as a string, or is the number 1 if no page was specified.'
oneOf:
- type: string
- type: integer
total:
type: number
description: 'The total number of results for the query'
total_pages:
type: number
description: 'The total number of pages of results, given the current page size'
display:
type: object
properties:
start:
type: number
description: 'The article number at which the returned page of results starts'
end:
type: number
description: 'The article number at which the returned page of results ends'
num_rows:
type: number
description: 'The page size that was applied to this query. Defaults to 100 and is capped at 500.'
articles:
type: array
items:
oneOf:
- $ref: '#/components/schemas/Article'
- type: array
description: 'Returned when projectB is specified: the article in project A followed by the article in project B.'
minItems: 2
maxItems: 2
items:
$ref: '#/components/schemas/Article'
text/tab-separated-values:
schema:
type: string
description: 'Returned when format=tsv: a TSV document with a header row, containing every article matching the filters (page and numRows are ignored).'
'400':
description: 'The page or numRows parameter was either not a number or less than 1, the format parameter was not one of "json" or "tsv", or format=tsv was combined with projectB'
'404':
description: 'No project with that projectId (or projectB) was found'
parameters:
- name: projectId
in: path
required: true
description: 'The name of the project, with spaces replaced by "_"'
schema:
type: string
- name: quality
in: query
required: false
description: 'The quality class of articles, used to filter the results. Eg: "FA-Class"'
schema:
type: string
- name: importance
in: query
required: false
description: 'The importance class of articles, used to filter the results. Eg: "High-Class"'
schema:
type: string
- name: page
in: query
required: false
description: 'The page to retrieve results starting with. The first page is page 1.'
schema:
type: number
- name: numRows
in: query
required: false
description: 'The number of rows (results) to return. Defaults to 100, values above 500 are clamped to 500.'
schema:
type: number
- name: articlePattern
in: query
required: false
description: 'A string to match the article name against. If the article title is LIKE "%articlePattern%", the article is returned.'
schema:
type: string
- name: format
in: query
required: false
description: 'The response format, either "json" (the default) or "tsv". With "tsv", the full filtered article list is returned as a tab-separated-values download and the page and numRows parameters are ignored. Not supported together with projectB.'
schema:
type: string
enum: [json, tsv]
default: json
- name: projectB
in: query
required: false
description: 'The name of a second project to compare against. When given, only articles that appear in both projects are returned, and each entry of the articles array is a two element array.'
schema:
type: string
- name: qualityB
in: query
required: false
description: 'The quality class used to filter the projectB side of a comparison. Ignored unless projectB is given.'
schema:
type: string
- name: importanceB
in: query
required: false
description: 'The importance class used to filter the projectB side of a comparison. Ignored unless projectB is given.'
schema:
type: string
/projects/{projectId}/articles/random:
get:
summary: 'Get a random article for a project, optionally filtered by quality/importance'
operationId: projectRandomArticle
tags:
- Projects
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
type: string
description: 'A URL to the random article on Wikipedia'
'204':
description: 'No article could be found matching the given criteria'
'404':
description: 'No project with that projectId was found'
parameters:
- name: projectId
in: path
required: true
description: 'The name of the project, with spaces replaced by "_"'
schema:
type: string
- name: quality
in: query
required: false
description: 'The quality class of articles, used to filter possible articles. Eg: "FA-Class"'
schema:
type: string
- name: importance
in: query
required: false
description: 'The importance class of articles, used to filter possible articles. Eg: "High-Class"'
schema:
type: string
/projects/{projectId}/category_links:
get:
summary: 'Get a mapping of category names (such as "A-Class") to an href on Wikipedia to link to and the text of such a link. The mapping can also be to simply a string which means no link is possible and the string itself should be displayed.'
operationId: projectCategoryLinks
tags:
- Projects
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
$ref: '#/components/schemas/CategoryLinkMap'
'404':
description: 'No project with that projectId was found'
parameters:
- name: projectId
in: path
required: true
description: 'The name of the project, with spaces replaced by "_"'
schema:
type: string
/projects/{projectId}/category_links/sorted:
get:
summary: 'The same as category_links, but the result is sorted into quality/importance designations.'
operationId: projectCategoryLinksSorted
tags:
- Projects
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
type: object
properties:
quality:
$ref: '#/components/schemas/CategoryLinkMap'
importance:
$ref: '#/components/schemas/CategoryLinkMap'
'404':
description: 'No project with that projectId was found'
parameters:
- name: projectId
in: path
required: true
description: 'The name of the project, with spaces replaced by "_"'
schema:
type: string
/projects/{projectId}/update:
post:
summary: 'Schedule a manual update of a project. This includes fetching new assessments from Wikipedia, and updating Wikipedia with assessment and log tables. This can only be done once per hour.'
operationId: projectUpdate
tags:
- Projects
security:
- sessionCookie: []
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
$ref: '#/components/schemas/NextUpdateTime'
'400':
description: 'The update could not be performed because it is too soon after another update. Check the next_update_time value in the returned response.'
content:
application/json:
schema:
$ref: '#/components/schemas/NextUpdateTime'
'401':
description: 'Unauthorized. You must be logged in to perform a project update.'
'404':
description: 'No project with that projectId was found'
parameters:
- name: projectId
in: path
required: true
description: 'The name of the project, with spaces replaced by "_"'
schema:
type: string
/projects/{projectId}/update/time:
get:
summary: 'Get the time at which the given project can next be scheduled for a manual update, or null if the project is currently eligible for a manual update.'
operationId: projectNextUpdateTime
tags:
- Projects
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
$ref: '#/components/schemas/NextUpdateTime'
'404':
description: 'No project with that projectId was found'
parameters:
- name: projectId
in: path
required: true
description: 'The name of the project, with spaces replaced by "_"'
schema:
type: string
/projects/{projectId}/update/progress:
get:
summary: 'Get the status/progress of a manual update job. If there is no manual update job, or if its status has expired, the "queue" and "job" keys will have null values.'
operationId: projectUpdateProgress
tags:
- Projects
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
type: object
properties:
queue:
type: object
nullable: true
properties:
status:
type: string
description: 'One of "queued", "started" or "finished" based on the state of the manual update in the job queue'
ended_at:
type: string
description: 'A datetime string representing when this job finished. Only available if the status key has a value of "finished"'
job:
type: object
nullable: true
description: 'The progress of the update job, or null if no progress has been reported.'
properties:
progress:
type: integer
description: 'An abstract number representing the amount of progress that has been made on a manual update job'
total:
type: integer
description: 'An abstract number representing the total amount of progress that must be made for this job to be considered complete. Note that it is considered reasonable for the progress number to reach a value higher than this total.'
'404':
description: 'No project with that projectId was found'
parameters:
- name: projectId
in: path
required: true
description: 'The name of the project, with spaces replaced by "_"'
schema:
type: string
/sites/:
get:
summary: 'Get lists of mediawiki projects through mediawiki API'
operationId: getWikiProjects
tags:
- Sites
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
type: object
properties:
sites:
type: array
items:
type: string
dbnames:
type: object
additionalProperties:
type: string
/builders/:
post:
summary: 'Save a new Builder, validating it first and returning invalid items if they exist'
operationId: createBuilder
tags:
- Builders
security:
- sessionCookie: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BuilderSpec'
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
$ref: '#/components/schemas/CreateOrUpdateListResponse'
'400':
description: 'The request was missing a name, project, model or params, or the model could not be resolved.'
'401':
description: 'Unauthorized. You must be logged in to save a list.'
/builders/{builderId}:
get:
summary: 'Return the builder with the given id'
operationId: getBuilder
tags:
- Builders
security:
- sessionCookie: []
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
$ref: '#/components/schemas/BuilderSpec'
'401':
description: 'Unauthorized. You must be logged in.'
'403':
description: 'The logged in user does not own the given Builder.'
'404':
description: 'Not found. No Builder with the given ID exists.'
parameters:
- name: builderId
in: path
required: true
description: 'The id of the Builder to retrieve.'
schema:
type: string
post:
summary: 'Update the Builder with the given id'
operationId: updateBuilder
tags:
- Builders
security:
- sessionCookie: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BuilderSpec'
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
$ref: '#/components/schemas/CreateOrUpdateListResponse'
'400':
description: 'The request was missing a name, project, model or params, or the model could not be resolved.'
'401':
description: 'Unauthorized. You must be logged in to update a Builder.'
'403':
description: 'The logged in user does not own the given Builder.'
'404':
description: 'Not found. No Builder with the given ID exists.'
parameters:
- name: builderId
in: path
required: true
description: 'The id of the builder to update.'
schema:
type: string
/builders/{builderId}/delete-impact:
get:
summary: 'Describe what else would be deleted or changed if the given Builder were deleted.'
description: 'Combinator Builders can reference other Builders. This endpoint reports which Combinators reference this Builder, and which of them would be deleted outright because this Builder is their only remaining input.'
operationId: builderDeleteImpact
tags:
- Builders
security:
- sessionCookie: []
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
type: object
properties:
builder:
type: object
properties:
id:
type: string
name:
type: string
project:
type: string
model:
type: string
affected_combinators:
type: array
items:
type: object
properties:
id:
type: string
name:
type: string
project:
type: string
referenced_in:
type: string
description: 'The param of the Combinator that references the Builder being deleted.'
remaining_include_builder_count:
type: integer
description: 'How many input Builders this Combinator would have left after the deletion.'
will_be_auto_deleted:
type: boolean
description: 'True when the Combinator would be deleted along with this Builder, because it would have no inputs left.'
'401':
description: 'Unauthorized. You must be logged in.'
'403':
description: 'The logged in user does not own the given Builder.'
'404':
description: 'No Builder with the given ID exists.'
parameters:
- name: builderId
in: path
required: true
description: 'The id of the Builder that would be deleted.'
schema:
type: string
/builders/{builderId}/delete:
post:
summary: 'Delete a Builder, its Selections and its ZIM files.'
operationId: deleteBuilder
tags:
- Builders
security:
- sessionCookie: []
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
confirm_builder_name:
type: string
description: 'The name of the Builder, which must be provided and match when the deletion would cascade to Combinators. See /builders/{builderId}/delete-impact.'
delete_combinator_ids:
type: array
description: 'The ids of the Combinator Builders that the caller has agreed to delete along with this one.'
items:
type: string
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: 'Always the string "204".'
'400':
description: 'delete_combinator_ids was not an array of strings, or the confirmation of the Builder name was missing or did not match.'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessages'
'401':
description: 'Unauthorized. You must be logged in.'
'403':
description: 'The logged in user does not own the given Builder.'
'404':
description: 'No Builder with the given ID exists.'
'500':
description: 'The Builder could not be deleted from the database.'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessages'
parameters:
- name: builderId
in: path
required: true
description: 'The id of the Builder to delete.'
schema:
type: string
/builders/{builderId}/selection/latest.{ext}:
get:
summary: 'Return a redirect to the Selection (latest materialization) of the given Builder in the given format.'
operationId: getBuilderSelectionLatest
tags:
- Selections
responses:
'302':
description: 'Successful operation, redirect to the Selection in the s3-like storage.'
'404':
description: 'No Selection with that extension exists for that Builder.'
parameters:
- name: builderId
in: path
required: true
description: 'The id of the Builder whose latest Selection should be retrieved.'
schema:
type: string
- name: ext
in: path
required: true
description: 'The requested extension of the Selection list to be redirected to. One of "tsv" or "xls".'
schema:
type: string
enum: ['tsv', 'xls']
/builders/{builderId}/selection/zimfarm/latest.{ext}:
get:
summary: 'The same as selection/latest.{ext}, but redirects to the URL that the Zimfarm uses to fetch the Selection.'
operationId: getBuilderZimfarmSelectionLatest
tags:
- Selections
responses:
'302':
description: 'Successful operation, redirect to the Selection in the s3-like storage.'
'404':
description: 'No Selection with that extension exists for that Builder.'
parameters:
- name: builderId
in: path
required: true
description: 'The id of the Builder whose latest Selection should be retrieved.'
schema:
type: string
- name: ext
in: path
required: true
description: 'The requested extension of the Selection list to be redirected to. One of "tsv" or "xls".'
schema:
type: string
enum: ['tsv', 'xls']
/builders/{builderId}/selection/latest/article_count:
get:
summary: 'The number of articles in the latest Selection of a Builder, and the maximum number that can be turned into a ZIM file.'
operationId: getBuilderSelectionArticleCount
tags:
- Selections
security:
- sessionCookie: []
responses:
'200':
description: 'Successful operation'
content:
application/json:
schema:
type: object
properties:
selection:
type: object
properties:
id:
type: string
article_count:
type: integer
nullable: true
max_article_count:
type: integer
description: 'The maximum number of articles the Zimfarm will accept for a single ZIM file.'
'401':
description: 'Unauthorized. You must be logged in.'
'403':
description: 'The logged in user does not own the given Builder.'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessages'
'404':
description: 'No Builder with the given ID exists, or it has no materialized Selection.'
parameters:
- name: builderId
in: path
required: true
description: 'The id of the Builder whose latest Selection should be measured.'
schema:
type: string
/builders/{builderId}/zim:
post:
summary: 'Request a ZIM file for the latest Selection of a Builder from the Zimfarm.'
operationId: builderCreateZim
tags:
- ZIM
security:
- sessionCookie: []
responses:
'204':
description: 'ZIM file successfully requested from Zimfarm.'
'400':
description: 'The title or description was missing or invalid, the flavour was not recognized, scheduled_repetitions was malformed, or the Selection has too many articles.'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessages'
'401':
description: 'Unauthorized. You must be logged in to request a ZIM file.'
'403':
description: 'Logged in user is not authorized to request ZIM for given Builder.'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessages'
'404':
description: 'Builder not found with that id.'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessages'
'500':
description: 'The Zimfarm rejected the request or was unreachable.'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessages'
parameters:
- name: builderId
in: path
required: true
description: 'The id of the Builder to request as ZIM file for.'
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- title
- description
properties:
title:
type: string
description:
type: string
long_description:
type: string
flavour:
type: string
description: 'The MediaWiki scraper flavour to use. Omit or leave empty for the default, full content.'
enum: ['mini', 'nopic', 'maxi']
scheduled_repetitions:
type: object
description: 'When present, the ZIM file is regenerated on a recurring schedule. Omit, or send an empty object, for a one off ZIM file.'
required:
- repetition_period_in_months
- number_of_repetitions
properties:
repetition_period_in_months:
type: integer
description: 'The number of months between regenerations.'
number_of_repetitions:
type: integer
description: 'The total number of generations, including the one being requested now.'
email:
type: string
description: 'An optional address to notify when each scheduled ZIM file is ready. A confirmation email is sent to addresses that have not been confirmed before.'
/builders/{builderId}/zim/status:
get:
summary: 'Get the status of the currently requested ZIM file for a Builder.'
description: 'Build status is public. Active schedule metadata, including recipient email and schedule ID, is returned only for the authenticated Builder owner; it is null for anonymous users and non-owners. Browser clients must include session credentials to receive owner details.'
security:
- {}
- sessionCookie: []
operationId: builderZimStatus
tags:
- ZIM
responses:
'200':
description: 'Successful operation.'
content:
application/json:
schema:
type: object
properties:
status:
type: string
nullable: true
description: 'One of: NOT_REQUESTED, REQUESTED, FILE_READY, CANCELLED, or FAILED. Null if the Builder has never had a ZIM file requested.'
error_url:
type: string
nullable: true
description: 'The URL of a resource on the Zimfarm that may provide more context for a failed ZIM.'
is_deleted:
type: boolean
nullable: true
description: 'True once the ZIM file is old enough that the Zimfarm has deleted it.'
title:
type: string
nullable: true
description:
type: string
nullable: true
long_description:
type: string
nullable: true
flavour:
type: string
nullable: true
active_schedule:
$ref: '#/components/schemas/ActiveSchedule'
parameters:
- name: builderId
in: path
required: true
description: 'The id of the Builder to get the ZIM status for.'
schema:
type: string
/builders/{builderId}/zim/latest:
get:
summary: 'Get the actual ZIM file for a Builder.'
operationId: builderLatestZim
tags:
- ZIM
responses:
'302':
description: 'Successful operation, redirect to the URL of the ZIM file.'
'404':
description: 'Builder or ZIM file not found.'
'410':
description: 'The ZIM file existed but has since been deleted from storage.'
parameters:
- name: builderId
in: path
required: true
description: 'The id of the Builder to get the ZIM file for.'
schema:
type: string
/builders/zim/status:
post:
summary: 'Webhook called by the Zimfarm when the status of a requested ZIM task changes.'
description: 'This endpoint is not intended for general use. It is registered with the Zimfarm when a task is requested, and is authenticated with a shared secret in the token query parameter.'
operationId: updateZimfarmStatus
tags:
- ZIM
responses:
'204':
description: 'The status was recorded.'
'400':
description: 'The request body did not contain a task id.'
'403':
description: 'The token query parameter did not match the configured Zimfarm hook token.'
'500':
description: 'No ZIM schedule could be found for the given task id.'
parameters:
- name: token
in: query
required: true
description: 'The shared secret configured for the Zimfarm webhook.'
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- id
properties:
id:
type: string
description: 'The id of the Zimfarm task.'
status:
type: string
description: 'The Zimfarm task status. The values "failed", "cancelled" and null all mark the ZIM file as FAILED.'
files:
type: object
description: 'A mapping of file name to file info. A file whose name ends in ".zim" and whose status is "uploaded" marks the ZIM file as FILE_READY.'
additionalProperties:
type: object
properties:
status: