DOMjudge / domjudge

DOMjudge programming contest jury system
https://www.domjudge.org
GNU General Public License v2.0
733 stars 256 forks source link

Allow exporting data (static scoreboard, clarifications, ...) via API #2768

Open mpsijm opened 1 week ago

mpsijm commented 1 week ago

Description of the enhancement request

It would be nice if the things that can be exported from the UI can also be exported from the API, to be able to do so automatically.

The goal you want to achieve

As jury, at the end of the contest, we would like to run some script that downloads the results of the contest. Most things we need can be retrieved as JSON from the API, but some things cannot, for example:

What I've tried

In https://github.com/mpsijm/BAPCtools/commit/cc15a1200706d8af2f4811d20501848b503d2574, I've added some code that should download the scoreboard ZIP and clarifications HTML from <domjudge_url>/jury/contests/<numeric_contest_id>/public-scoreboard.zip and <domjudge_url>/jury/import-export/export/clarifications.html. Instead, it downloads a login page, even though we pass HTTPBasicAuth at https://github.com/RagnarGrootKoerkamp/BAPCtools/blob/master/bin/contest.py#L96.

(Note that the ../../ looks shady, but it actually works :stuck_out_tongue: The base URL in call_api currently ends with /api/v4, and the ../../ removes this. If this wouldn't work, the server would respond with 404.)

Expected behaviour

Either:

Anything else you'd like to add?

Accessing the static scoreboard zip from a script currently requires the numeric ID of the contest, even though all of the API has switched to external IDs :stuck_out_tongue: In general, perhaps the URLs of the jury pages should also switch from numeric IDs to external IDs (e.g. /jury/contests/2 would become /jury/contests/bapc2024).

Tested at judge.bapc.eu, version 8.4.0DEV/ 2d6f4ff6a.

nickygerritsen commented 1 week ago

Thanks, looks like a good idea. Note that @eldering was also working on exporting a contest in the contest package format, but that doesn't include these files.

vmcj commented 1 week ago

See also https://github.com/DOMjudge/domjudge/issues/2726 when implementing this.