-
Notifications
You must be signed in to change notification settings - Fork 0
Back end Submissions API
Constantin edited this page Jun 8, 2021
·
17 revisions
This page presents the API presented by the backend for the Submissions.
The submissions can we obtained using various criteria:
- The game the submission was made to.
- The user the submission was made by.
Additionally, submissions can be ordered in multiple ways:
- By submission date.
- By the score.
- Increasing / Decreasing.
Description of the API:
- Permissions required: None
- Address:
/api/Submissions/GetAll - Request
JSON:
{
"requested_submissions": "Number of requested submissions",
"requested_submissions": 10,
"requested_offset": "Number of submissions to skip (for pagination)",
"requested_offset": 0,
"GameID": "If exists, the submissions have to be made to this game",
"UserID": "If exists, the submissions have to be made by the user",
"order_by": "By default is 'date'. Option: 'date' / 'score'",
"result_order": "'increasing' or 'decreasing'. By default 'decreasing'",
}- Response
JSON:
{
"error_message": "Reason why the action failed. Doesn't exist if successful",
"status": "'ok' if successful, 'fail' if not",
"submissions_found": "number of found submissions",
"submissions_found": 314,
"submissions_returned": "Number of returned submissions",
"submissions_returned": 10,
"submissions": "List of the submissions, in order",
"submissions": [{
"Date": "date of the submission",
"Score": "score of the submission",
"GameID": "id of the game",
"GameName": "Title of the game",
"AuthorID": "id of creator of the submission",
"AuthorUsername": "username of the author (implemented!!!)",
"SubmissionID": "id of the submission",
}],
}A user can't see the code or logs of a submission, unless he is authorized to view the submission's code, which can happened in 4 cases:
- The user is an administrator.
- The user is the owner of the game the submission was made to.
- The user is the owner of the submission.
- The user solved the game the submission was made to.
Note that if the submission isn't done evaluating yet, then only a subset of the described JSON will be returned.
Description of the API:
- Permissions required: Described above
- Address:
/api/Submissions/Details - Request
JSON:
{
"SubmissionID": "Id of the submission",
}- Response
JSON:
{
"error_message": "Reason why the action failed. Doesn't exist if successful",
"status": "'ok' if successful, 'fail' if not",
"Date": "date of the submission",
"Score": "score of the submission",
"GameID": "id of the game",
"GameName": "Title of the game",
"AuthorID": "id of creator of the submission",
"AuthorUsername": "username of the author (implemented!!!)",
"SubmissionID": "id of the submission",
"SubmissionCode": "Code of the submission, if it is visible",
"compiled": "Returns whether the submission compiled or not (not yet implemented)",
"compiled": true,
"compilation_message": "Message given by the compiler, in case of compilation error",
"results": "Results of the submission against each bot",
"results": [{
"logs": "logs of the fight",
"won": "true or false - booleans, not strings",
}],
"finished_evaluation": "true / false -- as booleans, not strings (not yet implemented)",
}- Permissions required: Signed-in
- Address:
/api/Submissions/New - Request
JSON:
{
"GameID": "Id of the game to which the submission was made",
"SubmissionCode": "C++ code of the submission",
}- Response
JSON:
{
"error_message": "Reason why the action failed. Doesn't exist if successful",
"status": "'ok' if successful, 'fail' if not",
"SubmissionID": "id of the submission if successful",
}