Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mpsijm opened this issue Oct 31, 2024 · 2 comments
Open

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

mpsijm opened this issue Oct 31, 2024 · 2 comments

Comments

@mpsijm
Copy link
Contributor

mpsijm commented Oct 31, 2024

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:

  • The static scoreboard ZIP (both public and unfrozen)
  • clarifications.html

What I've tried

In mpsijm/BAPCtools@cc15a12, 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 😛 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:

  • there should be dedicated endpoints in the API to export these files, or
  • it should be possible to access the pages under /jury using HTTPBasicAuth.

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 😛 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/ 2d6f4ff.

@nickygerritsen
Copy link
Member

nickygerritsen commented Oct 31, 2024

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
Copy link
Member

vmcj commented Oct 31, 2024

See also #2726 when implementing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants