-
Notifications
You must be signed in to change notification settings - Fork 0
/
Contest_API_2019.mw
2535 lines (2284 loc) · 65.9 KB
/
Contest_API_2019.mw
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
'''This is the version of the Contest API that was used at WF 2019.'''
== Introduction ==
This page describes an API for accessing information provided by a [[Contest_Control_System|Contest Control System]] or [[CDS|Contest Data Server]].
Such an API can be used by a multitude of clients:
* an external scoreboard
* a scoreboard resolver application
* contest analysis software, such as the [[ICAT]] toolset
* another "shadow" CCS, providing forwarding of submissions and all relevant information
* internally, to interface between the CCS server and judging instances
This API is meant to be useful, not only at the ICPC World Finals, but more generally in any ICPC-style contest setup. It is meant to incorporate and supersede the [[JSON_Scoreboard_2016|JSON Scoreboard]], the [[Draft_2014_REST_interface_for_source_code_fetching|REST interface for source code fetching]], and the [[Contest_Start_Interface|Contest start interface]]. This REST interface is specified in conjunction with a new [[#Event feed|NDJSON event feed]], which provides all changes to this interface as CRUD-style events and is meant to supersede the old XML [[Event Feed]].
=== Changes within this document ===
* [[#Contests|Contests]]
** The attribute <tt>countdown_pause_time</tt> was changed to be positive instead of negative.
=== Changes from [[Contest API 2018]] ===
==== General changes ====
* The meaning of "should" and "must" were clarified using RFC 2119 and a few occurences of "should" were replaced by "must".
* Implementations must be consistent in the output of the number of decimals in timestamps with sub-second resolution.
==== Endpoint specific changes ====
* [[#Contests|Contests]]
** The attribute <tt>countdown_pause_time</tt> was added.
* [[#Contest_state|State]]
** The attribute <tt>started</tt> must be equal to [[#Contests|contest]] <tt>start_time</tt> if set.
** The attribe <tt>end_of_updates</tt> was added.
** The order in which state changes can occur and are visible depending on client role were clarified.
* [[#Scoreboard|Scoreboard]]
** The scoreboard <tt>rows</tt> were moved into a sub-object and attributes <tt>state</tt>, <tt>event</tt>, <tt>time</tt>, and <tt>contest_time</tt> containing metadata were added.
** An option to request the scoreboard as of a specific event via the parameter <tt>after_event_id</tt> was added.
== General design principles ==
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [https://www.ietf.org/rfc/rfc2119.txt RFC 2119].
The interface is implemented as a HTTP REST interface that outputs information in [https://en.wikipedia.org/wiki/JSON JSON] format ([https://tools.ietf.org/html/rfc7159 RFC]). This REST interface should be provided over HTTPS to guard against eavesdropping on sensitive contest data and authentication credentials (see roles below).
=== Endpoint URLs ===
The specific base URL of this API will be dependent on the server (e.g. main CCS or CDS) providing the service; in the specification we only indicate the relative paths of API endpoints with respect to a '''baseurl'''. In all the examples below the baseurl is <tt>https://example.com/api</tt>.
We follow standard REST practices so that a whole collection can be requested, e.g. at the URL path
GET https://example.com/api/contests/wf14/teams
while an element with specific ID is requested as
GET https://example.com/api/contests/wf14/teams/10
A collection is always returned as a JSON list of objects. Every object in the list represents a single element (and always includes the ID). When requesting a single element the exact same object is returned. E.g. the URL path
GET baseurl/<collection>
returns
[ { "id":<id1>, <element specific data for id1>},
{ "id":<id2>, <element specific data for id2>},
...
]
while the URL path
GET baseurl/<collection>/<id1>
returns
{ "id":<id1>, <element specific data for id1>}
=== HTTP headers ===
A server should allow cross-origin requests by setting the <tt>Access-Control-Allow-Origin</tt> HTTP header:
Access-Control-Allow-Origin: *
A server should specify how clients should cache file downloads by setting the <tt>Cache-Control</tt> or <tt>Expires</tt> HTTP headers:
Cache-Control: public, max-age=3600, s-maxage=18000
Expires: Wed, 18 Jul 2018 07:28:00 GMT
=== HTTP methods ===
The current version of this specification only requires support for the '''GET''' method, unless explicitly specified otherwise in an endpoint below (see [[#PATCH_start_time|PATCH start_time]]).
However, for future compatibility below are already listed other methods with their expected behavior, if implemented.
;GET
: Read data. This method is idempotent and does not modify any data. It can be used to request a whole collection or a specific element.
;POST
: Create a new element. This can only be called on a collection endpoint. No '''id''' attribute should be specified as it is up to the server to assign one, which is returned in the location header.
;PUT
: Replaces a specific element. This method is idempotent and can only be called on a specific element and replaces its contents with the data provided. The payload data must be complete, i.e. no partial updates are allowed. The '''id''' attribute cannot be changed: it does not need to be specified (other than in the URL) and if specified different from in the URL, a '''409 Conflict''' HTTP code should be returned.
;PATCH
: Updates/modifies a specific element. Similar to '''PUT''' but allows partial updates by providing only that data, for example:
: <code>PATCH https://example.com/api/contests/wf14/teams/10</code>
: with JSON contents
: <code>{"name":"Our cool new team name"}</code>
: No updates of the '''id''' attribute are allowed either.
;DELETE
: Delete a specific element. Idempotent, but may return a 404 status code when repeated. Any provided data is ignored. Example:
: <code>DELETE https://example.com/api/contests/wf14/teams/8</code>
: Note that deletes must keep [[#Referential integrity|referential integrity]] intact.
Standard [https://en.wikipedia.org/wiki/List_of_HTTP_status_codes HTTP status codes] are returned to indicate success or failure.
=== Roles ===
Access to this API is controlled via user roles. The API provider must require authentication to access each role except for optionally the public role.
The API provider must support [https://en.wikipedia.org/wiki/Basic_access_authentication HTTP basic authentication] ([https://tools.ietf.org/html/rfc7617 RFC]). This provides a standard and flexible method; besides HTTP basic auth, other forms of authentication can be offered as well.
Each provider must support at least the following roles, although additional roles may be supported for specific uses:
* public (default role: contest data that's available to everyone)
* admin (data or capability only available to contest administrators)
Role-based access may completely hide some objects from the user, may omit certain attributes, or may embargo or omit objects based on the current contest time.
By default, the public user has read-only access (no '''POST''', '''PUT''', '''PATCH''' or '''DELETE''' methods allowed) and does not have access to judgements and runs from submissions made after the contest freeze time.
=== Referential integrity ===
Some attributes in elements are references to IDs of other elements. When such an attribute has a non-<tt>null</tt> value, then the referenced element must exist. That is, the full set of data exposed by the API must at all times be referentially intact.
This implies for example that before creating a [[#Teams|team]] with an <tt>organization_id</tt>, the [[#Organizations|organization]] must already exist. In reverse, that organization can only be deleted after the team is deleted, or alternatively, the team's <tt>organization_id</tt> is set to <tt>null</tt>.
Furthermore, the ID attribute (see below) of elements are not allowed to change. However, note that a particular ID might be reused by first deleting an element and then creating a new element with the same ID.
=== JSON attribute types ===
Attribute types are specified as one of the [https://en.wikipedia.org/wiki/JSON#Data_types.2C_syntax_and_example standard JSON types], or one of the more specific types below.
Implementations must be consistent with respect to the optional parts of each type, e.g. if the optional .uuu is included in any absolute timestamp it must be included when outputting all absolute timestamps.
;Integers
: (type '''<tt>integer</tt>''' in the specification) are JSON numbers that are restricted to be integer. They should be represented in standard integer representation <tt>(-)?[0-9]+</tt>.
;Floating point numbers
: (type '''<tt>float</tt>''' in the specification) are arbitrary JSON numbers that are expected to take non-integer values. It is recommended to use a decimal representation.
;Fixed point numbers
: (type '''<tt>decimal</tt>''' in the specification) are JSON numbers that are expected to take non-integer values. They must be in decimal (non-scientific) representation and have at most 3 decimals. That is, they must be a integer multiple of <tt>0.001</tt>.
;Absolute timestamps
: (type '''<tt>TIME</tt>''' in the specification) are strings containing human-readable timestamps, given in [https://en.wikipedia.org/wiki/ISO_8601 ISO 8601] extended combined date/time format with timezone: <tt>yyyy-mm-ddThh:mm:ss(.uuu)?[+-]zz(:mm)?</tt> (or timezone <tt>Z</tt> for UTC).
;Relative times
: (type '''<tt>RELTIME</tt>''' in the specification) are strings containing human-readable time durations, given in a slight modification of the [https://en.wikipedia.org/wiki/ISO_8601 ISO 8601] extended time format: <tt>(-)?(h)*h:mm:ss(.uuu)?</tt>
;Identifiers
: (type '''<tt>ID</tt>''' in the specification) are given as string consisting of characters <tt>[a-zA-Z0-9_-]</tt> of length at most 36 and not starting with a <tt>-</tt> (dash). IDs are unique within each endpoint.
: IDs are assigned by the person or system that is the source of the object, and must be maintained by downstream systems. For example, the person configuring a contest on disk will typically define the ID for each team, and any CCS or CDS that exposes the team must use the same ID.
: Some IDs are also used as identifiable labels and are marked below along with the recommended format. These IDs should be meaningful for human communication (e.g. team "43", problem "A") and are as short as reasonable but not more than 10 characters. IDs not marked as labels may be random characters and cannot be assumed to be suitable for display purposes.
;Ordinals
: (type '''<tt>ORDINAL</tt>''' in the specification) are used to give an explicit order to a list of objects. Ordinal attributes are integers and must be non-negative and unique in a list of objects, and they should typically be low numbers starting from zero. However, clients must not assume that the ordinals start at zero nor that they are sequential. Instead the ordinal values should be used to sort the list of objects.
;File references
: (types '''<tt>IMAGE</tt>''', '''<tt>VIDEO</tt>''', '''<tt>ARCHIVE</tt>''' and '''<tt>STREAM</tt>''' in the specification) are represented as a JSON object with elements as defined below.
Element for file reference objects:
{| class="wikitable"
|-
! Name
! Type
! Nullable?
! Description
|-
| href
| string
| no
| URL where the resource can be found. Relative URLs are relative to the '''baseurl'''. Must point to a file of intended mime-type. Resource must be accessible using the exact same (possibly none) authentication as the call that returned this data.
|-
| mime
| string
| iff default is defined
| Mime type of resource. Optional if and only if a default mime-type is specified for the reference.
|-
| width
| integer
| no for '''<tt>IMAGE</tt>'''
| Width of the image, video or stream in pixels. Should not be used for '''<tt>ARCHIVE</tt>'''.
|-
| height
| integer
| no for '''<tt>IMAGE</tt>'''
| Height of the image, video or stream in pixels. Should not be used for '''<tt>ARCHIVE</tt>'''.
|}
The '''href''' attributes may be [https://tools.ietf.org/html/rfc3986 absolute or relative URLs]; relative URLs must be interpreted relative to the '''baseurl''' of the API. For example, if '''baseurl''' is <tt>https://example.com/api</tt>, then the following are equivalent JSON response snippets pointing to the same location:
"href":"https://example.com/api/contests/wf14/submissions/187/files"
"href":"contests/wf14/submissions/187/files"
If implementing support for uploading files pointed to by resource links, substitute the href element with a data element with a base64 encoded string of the associated file contents as the value.
For example
POST https://example.com/api/contests/wf14/organizations
with JSON data
{ "id":"inst105",
"name":"Carnegie Mellon University",
...
"logo": [{"data": "<base64 string>", "width": 160, "height": 160}]
}
=== Extensibility ===
This specification is meant to cover the basic data of contests, with the idea that server/client implementations can extend this with more data and/or roles.
In particular, this specification already lists some endpoints or specific attributes as optional.
The following guidelines are meant to ease extensibility.
* Clients should accept extra attributes in endpoints, that are not specified here.
* Servers should not expect clients to recognize more than the basic, required specification.
* In this specification and extensions, an attribute with value <tt>null</tt> may be left out by the server (i.e. not be present). A client must treat an attribute with value <tt>null</tt> equivalently as that attribute not being present.
== Interface specification ==
The following list of API endpoints should be supported. Note that
<code>state</code>, <code>scoreboard</code> and <code>event-feed</code> are singular nouns
and indeed contain only a single element.
All endpoints should support '''GET'''; specific details on other
methods are mentioned below.
==== Types of endpoints ====
The endpoints can be categorised into 3 groups as follows:
;Configuration: contests, judgement-types, languages, problems, groups, organizations, teams, team-members
;Live data: state, submissions, judgements, runs, clarifications, awards
;Aggregate data: scoreboard, event-feed
Configuration is normally set before contest start. Is not expected to, but could occasionally be updated during a contest. It does not have associated
timestamp/contest time attributes. Updates are notified via the event feed.
Live data is generated during the contest and new elements are expected. Data is immutable though, only inserts, no updates or deletes of elements. It does have associated
timestamp/contest time attributes. Inserts and deletes are notified via the event feed. '''Note''': judgements are the exception to immutability in a weak sense: they get updated once with the final verdict.
Aggregate data: Only '''GET''' makes sense. These are not included in the event feed, also note that these should not be considered proper REST endpoints, and that the <tt>event-feed</tt> endpoint is a streaming feed in NDJSON format.
==== Table column description ====
In the tables below, the columns are:
;Name: Attribute name; object sub-attributes are indicated as <tt>object.attribute</tt>.
;Type: Data type of the attribute; either a [https://en.wikipedia.org/wiki/JSON#Data_types.2C_syntax_and_example JSON type] or [[#Recurring_details|a type defined above]].
;Required?: Whether this is a required attribute that '''must''' be implemented to conform to this specification.
;Nullable?: Whether the attribute might be <tt>null</tt> (and thus implicitly can also not be present in that case).
;Source @WF: Specifies whether this attribute is implemented at the ICPC World Finals and by whom.
;Description: Description of the meaning of the attribute and any special considerations.
Note that if an attribute is required and nullable, then if in a particular instance it is <tt>null</tt>, it may be left out. On the other hand, an attribute that is optional, but not nullable must either always be present (if the server implements/uses it), or never be present (if the server does not implement/use it). If an attribute is not implemented by a server, then it must never be present; this means that if a client sees an attribute, this means that the server implements it.
=== Contests ===
Provides information on the current contest.
The following endpoint is associated with contest:
{| class="wikitable"
|-
! Endpoint
! Mime-type
! Required?
! Source @WF
! Description
|-
| /contests
| application/json
| yes
| CDS
| JSON array of all contests with elements as defined in the table below
|-
| /contests/<id>
| application/json
| yes
| CCS
| JSON object of a single contest with elements as defined in the table below
|}
Returns a JSON object with the elements below. If there is no current (this may include about to start or just finished) contest, a 404 error is returned.
{| class="wikitable"
|-
! Name
! Type
! Required?
! Nullable?
! Source @WF
! Description
|-
| id
| ID
| yes
| no
| CCS
| identifier of the current contest
|-
| name
| string
| yes
| no
| CCS
| display name of the contest
|-
| formal_name
| string
| no
| no
| CCS
| full name of the contest
|-
| start_time
| TIME
| yes
| yes
| CCS
| the scheduled start time of the contest, may be <tt>null</tt> if the start time is unknown or the countdown is paused
|-
| countdown_pause_time
| RELTIME
| no
| yes
| CDS
| The amount of seconds left when countdown to contest start is paused. At no time may both <tt>start_time</tt> and <tt>countdown_pause_time</tt> be non-<tt>null</tt>.
|-
| duration
| RELTIME
| yes
| no
| CCS
| length of the contest
|-
| scoreboard_freeze_duration
| RELTIME
| no
| no
| CCS
| how long the scoreboard is frozen before the end of the contest
|-
| penalty_time
| integer
| no
| no
| CCS
| penalty time for a wrong submission, in minutes
|-
| banner
| array of IMAGE
| no
| yes
| CDS
| banner for this contest, intended to be an image with a large aspect ratio around 8:1 or so. Default and only allowed mime type is image/png.
|-
| logo
| array of IMAGE
| no
| yes
| CDS
| logo for this contest, intended to be an image with aspect ratio near 1:1. Default and only allowed mime type is image/png.
|}
The expected/typical use of <tt>countdown_pause_time</tt> is that once a <tt>start_time</tt> is defined and close, the countdown may be paused due to unforeseen delays. In this case, <tt>start_time</tt> should be set to <tt>null</tt> and <tt>countdown_pause_time</tt> to the number of seconds left to count down. The <tt>countdown_pause_time</tt> may change to indicate approximate delay. Countdown is resumed by setting a new <tt>start_time</tt> and resetting <tt>countdown_pause_time</tt> to <tt>null</tt>.
==== Access restrictions at WF ====
No access restrictions apply to a GET on this endpoint.
==== PATCH start_time ====
To replace the [[Contest Start Interface]], at the ICPC World Finals,
an API provided by a CCS or CDS implementing this specification must have a role
that has the ability to clear or set the contest start time via a PATCH method.
The PATCH must include a valid JSON element with only two attributes
allowed: the contest id (used for verification) and a start time (a
<code><TIME></code> value or <code>null</code>).
The request should fail with a 401 if the user does not have
sufficient access rights, or a 403 if the contest is started or within
30s of starting, or if the new start time is in the past or within 30s.
==== Example ====
Request:
GET https://example.com/api/contests/wf2014
Returned data:
{
"id": "wf2014",
"name": "2014 ICPC World Finals",
"formal_name": "38th Annual World Finals of the ACM International Collegiate Programming Contest",
"start_time": "2014-06-25T10:00:00+01",
"duration": "5:00:00",
"scoreboard_freeze_duration": "1:00:00",
"penalty_time": 20,
"banner": [{
"href": "https://example.com/api/contests/wf2014/banner",
"width": 1920,
"height": 240
}]
}
Request:
GET https://example.com/api/contests/dress2016
Returned data:
{
"id": "dress2016",
"name": "2016 ICPC World Finals Dress Rehearsal",
"start_time": null,
"countdown_pause_time": "0:03:38.749",
"duration": "2:30:00"
}
Request:
PATCH https://example.com/api/contests/wf2014
Request data:
{
"id": "wf2014",
"start_time": "2014-06-25T10:00:00+01"
}
Request:
PATCH https://example.com/api/contests/wf2016
Request data:
{
"id": "wf2016",
"start_time": null
}
=== Judgement Types ===
Judgement types are the possible responses from the system when judging a submission.
The following endpoints are associated with judgement types:
{| class="wikitable"
|-
! Endpoint
! Mime-type
! Required?
! Source @WF
! Description
|-
| /contests/<id>/judgement-types
| application/json
| yes
| CCS
| JSON array of all judgement types with elements as defined in the table below
|-
| /contests/<id>/judgement-types/<id>
| application/json
| yes
| CCS
| JSON object of a single judgement type with elements as defined in the table below
|}
JSON elements of judgement type objects:
{| class="wikitable"
|-
! Name
! Type
! Required?
! Nullable?
! Source @WF
! Description
|-
| id
| ID
| yes
| no
| CCS
| identifier of the judgement type, a 2-3 letter capitalized shorthand, see table below
|-
| name
| string
| yes
| no
| CCS
| name of the judgement. (might not match table below, e.g. if localised)
|-
| penalty
| boolean
| depends
| no
| CCS
| whether this judgement causes penalty time; must be present if and only if contest:penalty_time is present
|-
| solved
| boolean
| yes
| no
| CCS
| whether this judgement is considered correct
|}
==== Access restrictions at WF ====
No access restrictions apply to a GET on this endpoint.
==== Known judgement types ====
The list below contains standardized identifiers for known judgement types. These identifiers should be used by a server. Please send an email to [mailto:cliccs@ecs.csus.edu cliccs@ecs.csus.edu] when there are judgement types missing.
The column '''Big 5''' lists the "big 5" equivalents, if any. A '''*''' in the column means that the judgement is one of the "big 5".
The '''Translation''' column lists other judgements the judgement can safely be translated to, if a system does not support it.
{| class="wikitable"
! ID
! Name
! A.k.a.
! Big 5
! Translation
! Description
|-
| AC
| Accepted
| Correct, Yes
| *
| -
| Solves the problem
|-
| RE
| Rejected
| Incorrect, No
| WA?
| -
| Does not solve the problem
|-
| WA
| Wrong Answer
|
| *
| RE
| Output is not correct
|-
| TLE
| Time Limit Exceeded
|
| *
| RE
| Too slow
|-
| RTE
| Run-Time Error
|
| *
| RE
| Crashes
|-
| CE
| Compile Error
|
| *
| RE
| Does not compile
|-
| APE
| Accepted - Presentation Error
| Presentation Error, also see AC and PE
| AC
| AC
| Solves the problem, although formatting is wrong
|-
| OLE
| Output Limit Exceeded
|
| WA
| WA, RE
| Output is larger than allowed
|-
| PE
| Presentation Error
| Output Format Error
| WA
| WA, RE
| Data in output is correct, but formatting is wrong
|-
| EO
| Excessive Output
|
| WA
| WA, RE
| A correct output is produced, but also additional output
|-
| IO
| Incomplete Output
|
| WA
| WA, RE
| Parts, but not all, of a correct output is produced
|-
| NO
| No Output
|
| WA
| IO, WA, RE
| There is no output
|-
| WTL
| Wallclock Time Limit Exceeded
|
| TLE
| TLE, RE
| CPU time limit is not exceeded, but wallclock is
|-
| ILE
| Idleness Limit Exceeded
|
| TLE
| WTL, TLE, RE
| No CPU time used for too long
|-
| TCO
| Time Limit Exceeded - Correct Output
|
| TLE
| TLE, RE
| Too slow but producing correct output
|-
| TWA
| Time Limit Exceeded - Wrong Answer
|
| TLE
| TLE, RE
| Too slow and also incorrect output
|-
| TPE
| Time Limit Exceeded - Presentation Error
|
| TLE
| TWA, TLE, RE
| Too slow and also presentation error
|-
| TEO
| Time Limit Exceeded - Excessive Output
|
| TLE
| TWA, TLE, RE
| Too slow and also excessive output
|-
| TIO
| Time Limit Exceeded - Incomplete Output
|
| TLE
| TWA, TLE, RE
| Too slow and also incomplete output
|-
| TNO
| Time Limit Exceeded - No Output
|
| TLE
| TIO, TWA, TLE, RE
| Too slow and also no output
|-
| MLE
| Memory Limit Exceeded
|
| RTE
| RTE, RE
| Uses too much memory
|-
| SV
| Security Violation
| Illegal Function, Restricted Function
| RTE
| RTE, RE
| Uses some functionality that is not allowed by the system
|-
| IF
| Illegal Function
| Illegal Function, Restricted Function
| RTE
| SV, RTE, RE
| Calls a function that is not allowed by the system
|-
| RCO
| Run-Time Error - Correct Output
|
| RTE
| RTE, RE
| Crashing but producing correct output
|-
| RWA
| Run-Time Error - Wrong Answer
|
| RTE
| RTE, RE
| Crashing and also incorrect output
|-
| RPE
| Run-Time Error - Presentation Error
|
| RTE
| RWA, RTE, RE
| Crashing and also presentation error
|-
| REO
| Run-Time Error - Excessive Output
|
| RTE
| RWA, RTE, RE
| Crashing and also excessive output
|-
| RIO
| Run-Time Error - Incomplete Output
|
| RTE
| RWA, RTE, RE
| Crashing and also incomplete output
|-
| RNO
| Run-Time Error - No Output
|
| RTE
| RIO, RWA, RTE, RE
| Crashing and also no output
|-
| CTL
| Compile Time Limit Exceeded
|
| CE
| CE, RE
| Compilation took too long
|-
| JE
| Judging Error
|
| -
| -
| Something went wrong with the system
|-
| SE
| Submission Error
|
| -
| -
| Something went wrong with the submission
|-
| CS
| Contact Staff
| Other
| -
| -
| Something went wrong
|}
==== Examples ====
Request:
GET https://example.com/api/contests/wf14/judgement-types
Returned data:
[{
"id": "CE",
"name": "Compiler Error",
"penalty": false,
"solved": false
}, {
"id": "AC",
"name": "Accepted",
"penalty": false,
"solved": true
}]
Request:
GET https://example.com/api/contests/wf14/judgement-types/AC
Returned data:
{
"id": "AC",
"name": "Accepted",
"penalty": false,
"solved": true
}
=== Languages ===
Languages that are available for submission at the contest.
The following endpoints are associated with languages:
{| class="wikitable"
|-
! Endpoint
! Mime-type
! Required?
! Source @WF
! Description
|-
| /contests/<id>/languages
| application/json
| yes
| CCS
| JSON array of all languages with elements as defined in the table below
|-
| /contests/<id>/languages/<id>
| application/json
| yes
| CCS
| JSON object of a single language with elements as defined in the table below
|}
JSON elements of language objects:
{| class="wikitable"
|-
! Name
! Type
! Required?
! Nullable?
! Source @WF
! Description
|-
| id
| ID
| yes
| no
| CCS
| identifier of the language from table below
|-
| name
| string
| yes
| no
| CCS
| name of the language (might not match table below, e.g. if localised)
|}
==== Access restrictions at WF ====
No access restrictions apply to a GET on this endpoint.
==== Known languages ====
Below is a list of standardized identifiers for known languages.
When providing one of these languages, the corresponding identifier should be used.
The language name may be adapted e.g. for localization or to indicate a particular version of the language.
In case multiple versions of a language are provided, those must have separate, unique identifiers. It is recommended to choose new identifiers with a suffix appended to an existing one. For example <tt>cpp17</tt> to specify the ISO 2017 version of C++.
{| class="wikitable"
! ID
! Name
|-
| ada
| Ada
|-
| c
| C
|-
| cpp
| C++
|-
| csharp
| C#
|-
| go
| Go
|-
| haskell
| Haskell
|-
| java
| Java
|-
| javascript
| JavaScript
|-
| kotlin
| Kotlin
|-
| objectivec
| Objective-C
|-
| pascal
| Pascal
|-
| php
| PHP
|-
| prolog
| Prolog
|-
| python2
| Python 2
|-
| python3
| Python 3
|-
| ruby
| Ruby
|-
| rust
| Rust
|-
| scala
| Scala
|}
==== Example ====
Request:
GET https://example.com/api/contests/wf14/languages
Returned data:
[{
"id": "java",
"name": "Java"
}, {
"id": "cpp",
"name": "GNU C++"
}, {
"id": "python2",
"name": "Python 2"
}]
=== Problems ===
The problems to be solved in the contest
The following endpoints are associated with problems:
{| class="wikitable"
|-
! Endpoint
! Mime-type
! Required?
! Source @WF
! Description
|-
| /contests/<id>/problems
| application/json
| yes
| CCS
| JSON array of all problems with elements as defined in the table below
|-
| /contests/<id>/problems/<id>
| application/json
| yes
| CCS
| JSON object of a single problem with elements as defined in the table below
|}
JSON elements of problem objects:
{| class="wikitable"
|-
! Name
! Type
! Required?
! Nullable?
! Source @WF
! Description
|-
| id
| ID
| yes
| no
| CCS
| identifier of the problem, at the WFs the directory name of the problem archive
|-
| label
| string
| yes
| no
| CCS
| label of the problem on the scoreboard, typically a single capitalized letter
|-
| name
| string
| yes
| no
| CCS
| name of the problem
|-
| ordinal
| ORDINAL
| yes
| no
| CCS
| ordering of problems on the scoreboard
|-
| rgb
| string
| no
| no
| CCS
| hexadecimal RGB value of problem color as specified in [http://en.wikipedia.org/wiki/Web_colors#Hex_triplet HTML hexadecimal colors], e.g. '#AC00FF' or '#fff'
|-
| color
| string
| no
| no
| CCS
| human readable color description associated to the RGB value
|-
| time_limit
| decimal
| no
| no
| CCS
| time limit in seconds per test data set (i.e. per single run)
|-
| test_data_count
| integer
| yes
| no
| CCS
| number of test data sets
|}
==== Access restrictions at WF ====
The '''public''' role can only access these problems after the contest started.
That is, before contest start this endpoint returns an empty array for clients with the '''public''' role.
==== Examples ====
Request:
GET https://example.com/api/contests/wf14/problems
Returned data:
[{"id":"asteroids","label":"A","name":"Asteroid Rangers","ordinal":1,"color":"blue","rgb":"#00f","time_limit":2,"test_data_count":10},
{"id":"bottles","label":"B","name":"Curvy Little Bottles","ordinal":2,"color":"gray","rgb":"#808080","time_limit":3.5,"test_data_count":15}
]
Request:
GET https://example.com/api/contests/wf14/problems/asteroids