Request format

Every request contains a number of parameters that must or can be passed. If the request uses the GET-verb, then the mandatory arguments must be inserted into the indicated positions in the URL: GET /api/v1/assignment/s7e8n98hsp2phyz6tjea/submission/cru5g97qrywdjgndje90 HTTP/1.1

Optional arguments should be passed through the query string: GET /api/v1/assignment/all?from=2016-01-18&page=3 HTTP/1.1

For other methods the arguments should be passed in the request body, encoded as a JSON object.

The only exception is the token field, which should be passed through the HTTP Authorization header with type AutaToken.

Example POST request

POST /api/v1/assignment HTTP/1.1 Host: zaphod.f00f.nl Authorization: AutaToken s4lw76n5cvmx02jql8ort4lqz14syyl0vwoudwqe2gtuasndol Content-Type: application/json { "name": "Assignment 5: Housing Application" }

Response format

Every valid response is a JSON object. An empty response carries no metadata, which means that an empty response is represented by an empty object.

Errors

Invalid requests or server-side exceptions may include one or more error messages under the key "errors" as an array of error objects: { "errors": [ { "code": "E_TIME_TRAVELER", "message": "The date \"Monday, May 15, 1972\" is in the past." }, { "code": "E_EMPTY_TITLE", "message": "\"\" is not a valid title for an item." } ] } There may be multiple instances of the same error id in one error set.

Common errors

Some errors are common to all requests:

  • Requests requiring a token will return an HTTP 401 Unauthorized if the token is not valid, expired, or is missing.
  • Missing fields, type mismatches and other validation errors will return an HTTP 400.

POST /api/v1/user/login

Request

Property Type Required Description
username string yes the user's username
password string yes the user's password

Example response

{ "token": "eux9feksfc8nw69pcn8cinhi32qvfe2ebx029mkdko7makhovk" }

Requests an authentication token for an username and password. Will return an HTTP 403 with an error message if the credentials are invalid. Will return an HTTP 200 if the login succeeded.

An optional desired token lifetime can be supplied, which will be considered an upper bound (i.e., the endpoint may also return tokens with a shorter lifetime.)

GET /api/v1/users

Property Type Required Description
token string yes the token to invalidate
page string no the page number to display, 1-indexed, defaults to 1
pageSize string no the number of users to display per page, defaults to 25

Example response

{ "errors": [], "page": 2, "numPages": 5, "hasNext": "true", "hasPrevious": "true", "users": [{ "password": "secret", "username": "admin", "authorities": ["ROLE_ADMIN"], "accountNonExpired": "true", "accountNonLocked": "true", "credentialsNonExpired": "true", "enabled": "true" }] }

Returns a list of normal users.

DELETE /api/v1/user/logout

Request

Property Type Required Description
token string yes the token to invalidate

Invalidates a login token, effectively logging out the client. Will return an HTTP 403 if the token is not a valid token.

POST /api/v1/user/register

Request

Property Type Required Description
username string yes the user's username
password string yes the user's password
authority string yes the authority assigned to the user

Creates a new user with the specified username, password and authority. The given authority decides which actions the user can perform.

Will return an HTTP 400 if the specified authority is incorrect and an HTTP 403 if the specified username already exists. Current supported authorities are: "ROLE_ADMIN", "ROLE_TEACHER", "ROLE_TA" and "ROLE_STUDENT".

PUT /api/v1/user/password

request

Property Type Required Description
username string yes the username to change the password for
password string yes the new password for the user
oldPassword string yes the old password of the user

Changes the password of a user, returns an HTTP 403 if the old password is not correct for the given user.

Returns an HTTP 400 if the provided fields are of the wrong type. Returns an HTTP 403 if the provided combination of username and password is incorrect. Returns an HTTP 200 if the password change succeeded.

GET /api/v1/user

Request

Property Type Required Description
token string no the user's authentication token

Verifies the validity of a token without side-effects. If the token is valid, the user's details (name, status, and granted authorities) are returned.

Example response

Unauthenticated request

{ "errors": [ { "code": "NOT_AUTHENTICATED", "message": "Not logged in" } ] }

Authenticated request

{ "errors": [], "name": "arnold", "enabled": true, "authorities": ["ROLE_ARNOLD"] }

Returns an HTTP 401 if the user is not authenticated. Returns an HTTP 200 if the request succeeded.

POST /api/v1/assignment

Request

Property Type Required Description
token string yes the user's authentication token
name string yes the assignment name
language string yes the language for the assignment
static list no the metrics for the assignment
dockerAuthConfigurations list<auth configuration> no registry authentication details to pass to Docker

Example post

{ "name": "TI1200", "language": "java", "static": [ { "formatter": "", "name": "ABSTRACT_METHOD_COUNT", "options": {}, "script": "/* javascript */" } ], "dockerAuthConfigurations": [ { "registry": "https://registry.example.com/", "username": "moby", "password": "hunter2" } ] }

Example response

{ "id": "6z9tol70rah7mhq8kuzu87n1pvfzj1ns0i7uj6ii" }

Adds a new assignment.

Returns the id of the newly created assignment.

If no metrics are specified, no checks will be run.

Returns an HTTP 409 if the assignment already exists. Returns an HTTP 201 if the assignment was created.

GET /api/v1/assignment

Request

Property Type Required Description
token string yes the user's authentication token

Example response

{ "data": [{ "id": "awd9218bfd1831nd2", "name": "assignment23"}] }

Gets a list of all assignment ids and their corresponding names.

Returns an HTTP 200 if the request succeeded.

PUT /api/v1/assignment/{id}

Request

Property Type Required Description
token string yes the user's authentication token
id string yes The id of the assignment
name string yes The name of the assignment
language string yes The language for the assignment
static list yes The metrics for the assignment
dockerAuthConfigurations list<auth configuration> no registry authentication details to pass to Docker

Example response

{ "id": "6z9tol70rah7mhq8kuzu87n1pvfzj1ns0i7uj6ii" }

Updates an assignment

Returns an HTTP 404 if the assignment could not be found. Returns an HTTP 200 if the request succeeded.

GET /api/v1/assignment/{id}

Request

Property Type Required Description
token string yes the user's authentication token
id string yes the assignment's id

Example response

{ "id": "e48el11kgbal05u7hk4xl0alja0w6yid1pxovh4z", "data": [{ "id":"4plrgbx2hj9q2g1eflu4b8mc81tisqu81freeov4", "name":"submission1" }, { "id":"ufceu0xyd3bf4uvie6vliv76wielzuo905875ad8", "name":"submission2" }] }

Lists all submission IDs for a given assignment.

Returns an HTTP 404 if the assignment could not be found. Returns an HTTP 200 if the request succeeded.

DELETE /api/v1/assignment/{id}

Request

Property Type Required Description
token string yes the user's authentication token
Assignment id string yes The id of the assignment
{ "errors": [], "id": "6z9tol70rah7mhq8kuzu87n1pvfzj1ns0i7uj6ii" }

Deletes an assignment, returns the id of the deleted assignment

Returns an HTTP 200 if the deletion succeeded. Returns an HTTP 404 if the id couldn't be found.

GET /api/v1/assignment/{aid}/submission

Request

Property Type Required Description
token string yes the user's authentication token
aid string yes the assignment's id
page integer no the current page of submissions, the number depends on the page size. Defaults to 1.
size integer no the number of submissions per page. Defaults to 25, and at most 1000.

Example response

{ "page": 1, "numPages": 1, "submissions": [ { "name": "/a1/assignment-1.zip", "id": "5b1c3551f435dd1d6af6a7c0" }, { "name": "/a1/a1.zip", "id": "5b1c38aff435dd1d6af6a7c1" }, { "name": "/a1/a1.rar", "id": "5b1c38fcf435dd2ab13ee3a8" }, { "name": "/a1/assigment.zip", "id": "5b1c396bf435dd2ab13ee3a9" }, { "name": "/a1/1.zip", "id": "5b1c39fcf435dd2ab13ee3aa" }, { "name": "/a1/zip.zip", "id": "5b1c3b24f435dd2ab13ee3ab" } ] }

Lists some or all submissions for an assignment. Results are paginated; the page number and size can be passed using optional query parameters. Each submission entry will contain at least the name and ID.

Returns an HTTP 200 if the deletion succeeded. Returns an HTTP 404 if the id couldn't be found.

POST /api/v1/assignment/{aid}/submission

Property Type Required Description
token string yes the user's authentication token
aid string yes the assignment id
name string yes the name of the assignment

Example response

{ "errors": [], "id": "kf74juh52vfjghfhd654", }

Creates a new submission, returns the id of the submission.

If the name and the identity match an already existing submission, the old submission data will be deleted.

Returns an HTTP 201 if the request succeeded, returns an HTTP 404 if the assignment couldn't be found.

GET /api/v1/worker/token

Property Type Required Description
token string yes the user's authentication token

Example response

{ "errors": [], "token": "kf74juh52vfjghfhd654", }

Returns a new worker token, only available if user is admin

Returns an HTTP 403 forbidden if the user has not the right privileges. Returns an HTTP 400 if the request succeeded.

GET /api/v1/assignment/{aid}/export

Request

Property Type Required Description
token string yes the user's authentication token
aid string yes the assignment's id
format string no the file format the export should have. Can be json or csv, any text case is accepted. Defaults to json.
csvformat string no the CSV flavor to use for exporting. This may be any of the formats supported by Apache Commons CSV, with any text case being accepted. This parameter defaults to excel (note that the default value is not default!) If the export format is not CSV, this value is ignored.

Exports all submissions for an assignment.

By default, both output formats have the same fields; future extensions may add request fields that add or remove fields from either format. The default fields are:

Name Type Empty? Value
assignment string never the identifier of the assignment the submission was for
identity string if anonymous the identity of the submitter, if any
submitted timestamp never the timestamp the submission was received
dispatched timestamp if waiting for analysis the timestamp the submission was sent to a worker for analysis
analyzed timestamp if yet to be analyzed the timestamp the submission was completely analyzed
processed timestamp if yet to be reported on or graded the timestamp the submission was fully processed by the system and a verdict and grade were ready
id string never the submission's identifier
name string never the submission's display name
verdict string if yet to be reported on or graded the final report verdict
grade number if yet to be reported on or graded the final grade

Example response

JSON

[ { "assignment": "5cd189bd059358624629ec65", "submitted": "2019-05-29T08:54:06.829Z", "dispatched": "2019-05-29T08:54:06.837Z", "analyzed": "2019-05-29T08:54:07.690Z", "id": "f4c3f165457f89cb259c13c871fcfb588fb79cb8", "name": "devops:f4c3f165457f89cb259c13c871fcfb588fb79cb8", "verdict": "PENDING", "grade": 0.0 }, { "assignment": "5cd189bd059358624629ec65", "submitted": "2019-05-28T14:38:33.979Z", "dispatched": "2019-05-28T14:38:40.637Z", "analyzed": "2019-05-28T14:38:41.627Z", "id": "R58HINVRT71NWN6", "name": "devops:R58HINVRT71NWN6", "verdict": "PENDING", "grade": 0.0 }, { "assignment": "5cd189bd059358624629ec65", "submitted": "2019-05-28T14:38:33.424Z", "dispatched": "2019-05-28T14:38:35.049Z", "analyzed": "2019-05-28T14:38:36.131Z", "id": "QW9EZPH7SRP8DGZ", "name": "devops:QW9EZPH7SRP8DGZ", "verdict": "PENDING", "grade": 0.0 } ]

CSV

assignment,identity,submitted,dispatched,analyzed,processed,id,name,verdict,grade 5cd189bd059358624629ec65,,2019-05-28T16:19:54.410Z,2019-05-28T16:19:56.042Z,2019-05-28T16:19:57.430Z,,0Q5AG7UN4M0QLTL,devops:0Q5AG7UN4M0QLTL,PENDING,0.0 5cd189bd059358624629ec65,,2019-05-28T14:49:34.975Z,2019-05-28T14:50:03.402Z,2019-05-28T14:50:04.380Z,,15N7RB98Z3A3PMI,devops:15N7RB98Z3A3PMI,PENDING,0.0 5cd189bd059358624629ec65,,2019-05-28T16:19:58.368Z,2019-05-28T16:20:16.351Z,2019-05-28T16:20:17.347Z,,036ZAAECIMVX4FA,devops:036ZAAECIMVX4FA,PENDING,0.0

GET /api/v1/assignment/{aid}/export/{iid}

Request

Property Type Required Description
token string yes the user's authentication token
aid string yes the assignment's id
iid string yes the submitter's id
format string no the file format the export should have
csvformat string no the CSV flavor to use for exporting

Exports all submissions for an assignment by a specific identity. This endpoint has the same contract as a full export, but only submissions by a single identity are returned.

GET /api/v1/identity/{iid}/export

Request

Property Type Required Description
token string yes the user's authentication token
iid string yes the submitter's id
format string no the file format the export should have
csvformat string no the CSV flavor to use for exporting

Exports all submissions for all assignments by an identity. This endpoint has the same contract as a single-assignment identity export, but all assignments were submissions are for are returned instead.

GET /api/v1/assignment/{aid}/submission/{sid}

Request

Property Type Required Description
token string yes the user's authentication token
aid string yes the assignment's id
sid string yes the desired submissions's ID
format string no The desired report format. Options: "html". Default is json

Example response

{ "id": "k7gd8qnrp8v3pge2her3h2nrv4lc3k0vwhvpt54u", "aid": "asdjawdni120812312adm091209e12emd09120dm", "name":"submission_name", "pipelinelog": "generating report", "verdict": "pending", "report": null, "results":null, "errors":[] }

Gets a submission by its ID. Returns an HTTP 404 if the assignment ID or submission ID do not exist. Returns an HTTP 200 if the request succeeded.

The report is null until it is ready. That is when the verdict is no longer pending.

POST /api/v1/assignment/{aid}/submission/direct-upload

Request

Property Type Required Description
token string yes the user's authentication token
aid string yes the assignment's id
directUploadId string yes the id used to set the name of the submission and filename
file multipart/form-data yes the file to upload
identifier string no the identity of the submitter

Uploads a multipart file to be analyzed. The file must have the following format: "name":"file", "filename":[ANYTHING].[EXTENSION]. Files without a filename or extension will be rejected. Returns HTTP 201 if the file has been uploaded successfully.

Creates a submission called direct-upload:directUploadId

{ "id": submissionId, "errors":[] }

POST /api/v1/assignment/{aid}/submission/{sid}/benchmark/rank

Request

Property Type Required Description
token string yes the user's authentication token
aid string yes the assignment's id
sid string yes the desired submissions's ID
riskCategories set[double] yes the categories used to assign metric results to a certain risk category
rankingTable double[][] yes the table used to map the relative weight of system code in each risk category to a total system rating
metricNameString string yes the metric name to analyze
entityLevelString string yes the entitylevel to analyze

Example response

{ "rank": 4, "errors":[] }

Requests the benchmarking rank for a certain metric. The rank is an integer in the range 0-5.

POST /api/v1/assignment/{aid}/submission/{sid}/benchmark/chartdata

Property Type Required Description
token string yes the user's authentication token
aid string yes the assignment id
sid string yes the submission id
metricNameString string yes the metric name to analyze
entityLevelString string yes the entitylevel to analyze, options: "METHOD", "CLASS", "FILE", "MODULE", "PROJECT", "FIELD"

Example response

{ "metricName": "METHOD_EFFECTIVE_LOC", "entityLevel": "METHOD", "entities": { "16": [ "root/Assignment5V2/HouseCatalog.java/HouseCatalog/housesAskedFor(int price, char a, String SORR, boolean availibleNow)" ], "1": [ "root/Assignment5V2/Boiler.java/Boiler/Boiler()", "root/Assignment5V2/CentralHeating.java/CentralHeating/CentralHeating()" ], "162": [ "root/Assignment5V2/HousesingApplication.java/HousesingApplication/main(String[] args)" ], "19": [ "root/Assignment5V2/HouseCatalog.java/HouseCatalog/read(String fileName)", "root/Assignment5V2/Address.java/Address/read(Scanner sc)" ], "3": [ "root/Assignment5V2/House.java/House/getHeatingSystem()", "root/Assignment5V2/CentralHeating.java/CentralHeating/getType()", "root/Assignment5V2/House.java/House/toString()" ], "4": [ "root/Assignment5V2/HeatingSystemTest.java/HeatingSystemTest/testGetTypeCentral()", "root/Assignment5V2/HeatingSystemTest.java/HeatingSystemTest/testGetTypeBoiler()" ], "6": [ "root/Assignment5V2/HouseTest.java/HouseTest/testGetAvailable()", "root/Assignment5V2/HouseTest.java/HouseTest/testCostAtMost()" ], "7": [ "root/Assignment5V2/House.java/House/House(Address address, int nRooms, int salePrice, HeatingSystem heatingsystem, boolean available)", "root/Assignment5V2/HouseTest.java/HouseTest/testEqualsOtherObject()" ], "9": [ "root/Assignment5V2/HouseTest.java/HouseTest/testEqualsSameHouseOtherVariable()", "root/Assignment5V2/HouseTest.java/HouseTest/testEqualsDifferentAddress()" ], "10": [ "root/Assignment5V2/HouseTest.java/HouseTest/testReadException()" ], "60": [ "root/Assignment5V2/House.java/House/read(Scanner sc)" ], "13": [ "root/Assignment5V2/CentralHeating.java/CentralHeating/getEnergyEfficiency(int rooms)" ] }, "raw": { "16": 0.023952095808383235, "1": 0.0029940119760479044, "13": 0.019461077844311378 }, "dataset": [ 0.29940119760479045, 0.0, 9.431137724550897, 1.1976047904191618, 24.251497005988025 ], "errors": [], "labels": [ 1, 2, 3, 4, 5, 6 ] }

Gets the benchmarking chart data.

POST /api/v1/assignment/{aid}/submission/{sid}/benchmark/aggregate

Request

Property Type Required Description
token string yes the user's authentication token
aid string yes the assignment's id
sid string yes the desired submissions's ID
type string no the type to aggregate for, options=raw, default=entity
metricNameString string yes the metric name to analyze
entityLevelString string yes the entitylevel to analyze

Example response

{ "errors":[], "data":{ 1:[FILE_EFFECTIVE_LINES_OF_CODE], 2:[CYCLOMATIC_COMPLEXITY] } }

Aggregates all metrics of a certain type into a Map of value -> total relative weights

POST /api/v1/assignment/{aid}/submission/{sid}/benchmark/report

Request

Property Type Required Description
token string yes the user's authentication token
aid string yes the assignment's id
sid string yes the desired submissions's ID
metricNameString string yes the metric name to analyze
entityLevelString string yes the entitylevel to analyze

Example response

Returns the benchmarking result as an HTML page.

GET /api/v1/course

Request

Property Type Required Description
token string yes the user's authentication token

Example response

{ "courses": [ { "id": "5cf028357fc2582206be877b", "name": "Complexity Theory", "courseCode": "TI3306", "year": 2019, "instructorSet": [], "taSet": [ "ta" ], "assignmentIds": [ "5ce653c5ff1dbf1ab679583d" ] } ], "errors": [] }

Requests all courses.

POST /api/v1/course

Request

Property Type Required Description
token string yes the user's authentication token
name string yes the course name
courseCode string yes the course code
year int yes the year the course started in, >1970

Example response

{ "id":"5cf028357fc2582206be877b", "errors": [] }

Creates a new course.

PUT /api/v1/course/{cid}/assignment

Request

Property Type Required Description
token string yes the user's authentication token
cid string yes the course id
aid string yes the assignment id to add

Example response

{ "errors": [] }

Adds an assignment to a course.

PUT /api/v1/course/{cid}/user

Request

Property Type Required Description
token string yes the user's authentication token
cid string yes the course id
role string yes the role that the user will have in the course (ROLE_TA or ROLE_TEACHER)
username string yes the username to add

Example response

{ "errors": [] }

Adds a user to a course with a specified role. The user must have a role of ROLE_TA or ROLE_TEACHER.

DELETE /api/v1/course/{cid}

Request

Property Type Required Description
token string yes the user's authentication token
cid string yes The course id

Deletes a course, returns an HTTP 200 is the request succeeded. Returns an HTTP 400 if the course was not found.

PUT /api/v1/course/{cid}

Request

Property Type Required Description
token string yes the user's authentication token
cid string yes the course id
name string yes the course name
courseCode string yes the course code
year int yes the year the course started in, >1970

Example response

{ "errors": [] }

Updates a course.

GET /api/v1/course/{cid}

Property Type Required Description
token string yes the user's authentication token
cid string yes the course id

Example response

{ "errors": [], "course": { "id": "5cf028357fc2582206be877b", "name": "course name", "courseCode": "TI1306", "year": "2019", "instructorSet": ["instructor", "instructor2"], "taSet": ["ta1", "ta2"], "assignmentIds": ["5cf02832206be877bjf8656f"] } }

Retrieves a course.

DELETE /api/v1/course/{cid}/user/{role}/{username}

Request

Property Type Required Description
token string yes the user's authentication token
cid string yes the course id
role string yes the role of the user that will be removed, should be ROLE_TA or ROLE_TEACHER
username string yes the username

Example response

{ "errors": [] }

Removes a user from a course.

DELETE /api/v1/course/{cid}/assignment/{aid}

Property Type Required Description
token string yes the user's authentication token
cid string yes the course id
aid string yes the assignment id

Example response

{ "errors": [] }

Removes an assignment from a course.

GET /api/v1/files/inspect/{path}

Request

Property Type Required Description
token string yes the user's authentication token
path string yes relative path to the a directory or file to be inspected

Example response

{ "size": 4096, "contents": [ { "name": "/demo.zip", "time": { "epochSecond": 1527101101, "nano": 976635000 }, "type": "REGULAR", "size": 54549 } ], "name": "/", "time": { "epochSecond": 1527164808, "nano": 712582000 }, "type": "DIRECTORY", "errors": [] }

Inspect a file or folder to get information about modification date, name and size. Also includes the contents of a directory.

GET /api/v1/files/get/{path}

Request

Property Type Required Description
token string yes the user's authentication token
path string yes relative path to the a directory or file to be retrieved

Example response

HTTP/1.1 200 Content-Disposition: attachment; filename="demo.zip" Accept-Ranges: bytes Content-Type: application/octet-stream Content-Length: 54549 Date: Wed, 06 Jun 2018 11:05:07 GMT UEsDBBQAAAAAAGdjOEoAAAAAAAAAAAAAAAAFAAAAam...

Gets a file from the server. Returns the file as an octet-stream.

Example error response

{ "errors": [ { "code": "NOT_A_FILE", "message": "/ is not a regular, downloadable file" } ] }

If the requested file is not a file.

PUT /api/v1/files/upload/{path}

Request

Property Type Required Description
token string yes the user's authentication token
path string yes relative path to the a directory or file to be created
file multipart file yes the file to be uploaded

Example response

{ "errors": [] }

Uploads a multipart file to the server at a specified path.

GET /api/v1/worker/metrics

Request

Property Type Required Description
token string yes the user's authentication token

Example response

{ "metrics": { "python": [ "cyclomatic complexity", "method length" ], "cpp": [ "cyclomatic complexity", "method length", "lines of code" ], "*": [ "comment count", "line length" ] }, "errors": [] }

Gets a list of languages and the metrics supported for that language.

GET /api/v1/worker/metrics.js

Property Type Required Description
token string yes the user's authentication token

Example response

MetricEditor.metrics = { "metrics": { "python": [ "cyclomatic complexity", "method length" ], "cpp": [ "cyclomatic complexity", "method length", "lines of code" ], "*": [ "comment count", "line length" ] }, "errors": [] }

Gets a map of all languages and their metrics.

Deprecated - originally a hack for the old UI to allow this resource to load in a blocking fashion, no longer necessary

GET /api/v1/worker/metrics/test-fixtures

Property Type Required Description
token string yes the user's authentication token

Example response

{ "fixtures": { "CYCLOMATIC_COMPLEXITY": [ 1, 7, 14, 615 ], "DOCKER_LOGS": [ "BUILD SUCCESSFUL", "BUILD FAILED" ] } }

Returns a map containing test fixtures for criteria scripts.

It is important to note that the fixtures can be of any type, as long as the type is valid for the metric it belongs to.

POST /api/v1/script/test/passing-script

Request

Property Type Required Description
token string yes the user's authentication token
script string yes the script to test
tests list<spec> yes the tests to run

A unit test specification ("spec") is an object containing an identifier id for the test and a value value to pass to the script under test.

Example request

{ "script": "(() => count => {\n const minWarnThreshold = 4;\n const minFailThreshold = 2;\n const maxWarnThreshold = 20;\n const maxFailThreshold = 30;\n if (count > 0) {\n if (count < minFailThreshold) {\n fail(`Has too few test methods:' ${count} < ${minFailThreshold}`);\n } else if (count < minWarnThreshold) {\n warn(`Has few test methods:' ${count} < ${minWarnThreshold}`);\n } else if (count > maxFailThreshold) {\n fail(`Has too many test methods:' ${count} > ${maxFailThreshold}`);\n } else if (count > maxWarnThreshold) {\n warn(`Has many methods:' ${count} > ${maxWarnThreshold}`);\n }\n }\n})();\n", "tests": [ { "id": "test:t16oyi-k3m42o-ie108e-318ntg", "value": "3" }, { "id": "test:va47q4-7ti1jg-5ubb30-1xllc6", "value": "24" } ] }

Example response

{ "compiles": true, "results": [ { "id": "test:t16oyi-k3m42o-ie108e-318ntg", "error": null, "notes": { "notes": [ { "severity": "WARNING", "message": "Has few test methods:' 3 < 4" } ] }, "grade": null }, { "id": "test:va47q4-7ti1jg-5ubb30-1xllc6", "error": null, "notes": { "notes": [ { "severity": "WARNING", "message": "Has many methods:' 24 > 20" } ] }, "grade": null } ] }

Validates a passing script.

The script is checked whether it compiles (mostly for syntax errors) and is then run against the provided values. The results are returned, along with any errors generated when running the test, as if the script were run on an entity.

GET /api/v1/workers

Request

Property Type Required Description
token string yes the user's authentication token

Gets a list of all workers connected to the core.

Each worker is represented by a description containing a name, hostname, load, and the instant the last ping was received. If the worker was busy at the moment of the request, a job description consisting of an assignment and submission ID is included.

Example response

{ "errors":[], "workers": [ { "hostname": "here", "load": 20.0, "name": "test #2", "lastPing": 1557124900000, "job": {"assignment": "123", "submission": "456"} }, { "hostname": "here", "load": 20.0, "name": "test #1", "lastPing":1557125030000 } ] }

GET /api/v1/settings

Request

Property Type Required Description
token string yes the user's authentication token

Example response

{ "settings": { "bcrypt work factor": 10, "token management interval": 3, "java path": "C:/Program Files/Java/jre-10.0.1/bin/java", "threads": 2, "maximum number of workers": 25, "version": "0.0.1", "worker ping timeout": 30, "token management interval unit": "MINUTES", "worker port": 12727, "worker path": "/nl/tudelft/ewi/auta/worker-0.0.1.jar", "minimum number of workers": 15, "worker management interval": 20, "build date": 1529492529, "api port": "8080", "worker kill threshold": 2, "file store path": "/srv/auta/uploads", "token length": 512, "worker spawn threshold": 0.75, "authentication database path": "/srv/auta/auth.db" }, "errors": [] }

Gets a list of the current global settings of the core and the workers.

PUT /api/v1/settings

Request

Property Type Required Description
token string yes the user's authentication token
settings map yes the updated settings

Uploads the updated settings file to the server at a specified path.

POST /api/v1/cpm/{aid}

Request

Property Type Required Description
token string yes the user's authentication token
aid string yes the assignment's id
file multipart file yes the file to be uploaded
filename string yes the name of the file
projectName string yes the name of the cpm project
workunitID string yes the id of the cpm workunit
workunitName string yes The name of the cpm workunit
memberName string yes the name of the cpm member
uploadComments string no the comments for the cpm submission
verificationCode string yes The cpm verification code

Submits a new submission to be checked, using a file from the cpm submission.

GET /api/v1/logs/core

Request

Property Type Required Description
token string yes the user's authentication token

Example response

{ "log": [ "[2019-06-03T14:42:50.272325] [org.springframework.web.context.ContextLoader] [DEBUG] Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]", "[2019-06-03T14:42:50.272996] [org.springframework.web.context.ContextLoader] [INFO ] Root WebApplicationContext: initialization completed in 1679 ms", "[2019-06-03T14:42:50.42655] [nl.tudelft.ewi.auta.core.authentication.CorsPatchFilter] [DEBUG] Filter 'corsPatchFilter' configured for use", "[2019-06-03T14:42:50.427275] [nl.tudelft.ewi.auta.core.authentication.TokenAuthenticationFilter] [DEBUG] Filter 'tokenAuthenticationFilter' configured for use", "[2019-06-03T14:42:50.483025] [nl.tudelft.ewi.auta.core.Core ] [INFO ] Allowing API access to hosts [http://localhost:8081]", "[2019-06-03T14:42:51.561436] [org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer] [DEBUG] Template loader path [class path resource [nl/tudelft/ewi/auta/core/ui]] resolved to file path [/home/luc/Projects/auta/core/out/production/resources/nl/tudelft/ewi/auta/core/ui]", "[2019-06-03T14:42:51.876032] [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] [DEBUG] Patterns [/**/favicon.ico] in 'faviconHandlerMapping'", "[2019-06-03T14:42:51.955727] [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter] [DEBUG] ControllerAdvice beans: 0 @ModelAttribute, 0 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice", "[2019-06-03T14:42:52.037565] [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] [DEBUG] 37 mappings in 'requestMappingHandlerMapping'", "[2019-06-03T14:42:52.062929] [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] [DEBUG] Patterns [/webjars/**, /**] in 'resourceHandlerMapping'", "[2019-06-03T14:42:52.075692] [org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver] [DEBUG] ControllerAdvice beans: 1 @ExceptionHandler, 1 ResponseBodyAdvice", "[2019-06-03T14:42:52.190632] [org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration] [WARN ] Cannot find template location(s): [classpath:/templates/] (please add some templates, check your FreeMarker configuration, or set spring.freemarker.checkTemplateLocation=false)", "[2019-06-03T14:42:52.270597] [nl.tudelft.ewi.auta.core.Core ] [INFO ] Starting AuTA Core...", "[2019-06-03T14:42:52.271913] [nl.tudelft.ewi.auta.core.Core ] [DEBUG] Environment ready", "[2019-06-03T14:42:55.530945] [nl.tudelft.ewi.auta.core.Core ] [DEBUG] Authentication database ready", "[2019-06-03T14:42:55.533033] [nl.tudelft.ewi.auta.core.Core ] [DEBUG] Token management thread running", "[2019-06-03T14:42:58.069433] [nl.tudelft.ewi.auta.core.security.SecurityAgent] [WARN ] Security warning: Privileged user arnold has default password", "[2019-06-03T14:42:58.06989] [nl.tudelft.ewi.auta.core.security.SecurityAgent] [WARN ] Security warning: Privileged user admin has default password", "[2019-06-03T14:42:58.070282] [nl.tudelft.ewi.auta.core.security.SecurityAgent] [WARN ] Security warning: Privileged user ta has default password", "[2019-06-03T14:42:58.070963] [nl.tudelft.ewi.auta.core.Core ] [DEBUG] Security agent greenlit boot with periodic re-checks", "[2019-06-03T14:42:58.072751] [nl.tudelft.ewi.auta.core.communication.SubmissionServer] [INFO ] Server started at 0.0.0.0/0.0.0.0:12728", "[2019-06-03T14:42:58.073849] [nl.tudelft.ewi.auta.core.Core ] [DEBUG] Started submission server", "[2019-06-03T14:42:58.074965] [nl.tudelft.ewi.auta.core.workers.WorkerMonitorRunner] [INFO ] Scheduling regular worker checkups every 20 seconds", "[2019-06-03T14:42:58.076036] [nl.tudelft.ewi.auta.core.workers.WorkerMonitorRunner] [DEBUG] Pinging the workers (0 connected)", "[2019-06-03T14:42:58.076066] [nl.tudelft.ewi.auta.core.Core ] [DEBUG] Scheduled worker monitor", "[2019-06-03T14:42:58.078735] [nl.tudelft.ewi.auta.core.Core ] [INFO ] AuTA Core ready after 10.620s", "[2019-06-03T14:42:58.079059] [nl.tudelft.ewi.auta.core.Core ] [INFO ] \u001b[33;1m\n _______\n /\\ |__ __|/\\\n / \\ _ _| | / \\\n / /\\ \\| | | | | / /\\ \\\n / ____ \\ |_| | |/ ____ \\\n/_/ \\_\\__,_|_/_/ \\_\\\n==========================\u001b[0m\n\u001b[34;1mCore \u001b[35;1mv1.3.0\u001b[0m" ], "errors": [] }

Gets the latest entries in the core's log. Up to 1024 entries are retained.

GET /api/v1/assignment/{aid}/submission/{sid}/verdict

Property Type Required Description
token string yes the user's authentication token
aid string yes the assignment id
sid string yes the submission id

Example response

{ "verdict": "pending" }

Retrieves the verdict for a submission

Contents