-
Notifications
You must be signed in to change notification settings - Fork 0
API Reference
(Note: The below information is not that comprehensive, and it may be a little bit out of date. This Wiki page will be updated soon to fix this.)
To submit code, send a POST request to /api/submit with the content type multipart/form-data. Include the following fields:
- problem_id - The ID of the problem that you're submitting a solution for.
- type - The language that your code is written in. Should be one of "java", "cpp", or "python".
- code - The file containing the submission's source code. Note that this is an actual file, not just a string representing the source code.
- username - The username of the person who is submitting the code. If you don't need usernames, just set this to something like "guest".
- secret_key - The secret key that is set using JudgeLite's SECRET_KEY environment variable. This makes sure that only servers you control can actually submit code.
The returned status code will be 200 if the submission was successful, and 400 if the submission failed. The returned repsonse will be JSON. It will have exactly two of the following entries:
- status - Reports on whether or not the submission was successful. Will be either "success" or "fail".
- error - Only present if the submission failed. Presents a user-friendly message of why the submission failed.
- job_id - Only present if the submission succeeded. This is the unique ID value that was assigned to the submission. It is used to query the status of the submission (see below).
To get the status of a submission, send a GET request to /api/status/<job_id>, where job_id is the ID returned from the initial POST request. The returned status code will be 202 if the submission is still processing, and 200 if the submission has been fully evaluated (or an error occurred). The returned response will be JSON. It will have the following entries:
- status - Contains the status of the submission. Will be one of "queued", "judging", "done", "compile_error", or "internal_error".
The following entries may or may not be available, depending on the returned status:
- score - (judging, done) The current score of the submission for each subtask.
- is_bonus - (judging, done) Whether or not each subtask is a bonus subtask (useful for changing how bonus verdicts are displayed).
- subtasks - (judging, done) A list of subtasks. Each subtask has a list of test cases. Each test case is an array with 3 values: ['verdict', time, memory].
- max_score - (judging, done, compile_error) The maximum score that a submission could get on a problem, excluding bonus points.
- final_score - (done, compile_error) The final score that a submission recieved.
- error - (compile_error, internal_error) If status is compiler_error, the error message that the compiler generated. Else, the error code for the internal error.