A+ assessment protocol version 1

This protocol defines the communication format between the LMS and an assessment service. The protocol makes it possible for the assessment service to be stateless, that is every request contains all the required information for the service to respond. Additionally, the protocol uses HTTP to transfer the information between services. This makes it relatively easy to implement a new assessment service.

The protocol consist of two phases: retrieving the exercise definition and submitting a solution to be assessed. Both phases may start an asynchronous process, which will complete at a later time. This means that the assessment can be completed synchronously or asynchronously.

Terminology

Phase 1, retrieve the exercise

overview of the exercise retrieve phase

Step 1.1, the request

The exercise description is retrieved using HTTP GET request.

The request must have the following headers:

Additionally, the following query parameters may be part of the request:

Step 1.2, the response

An HTML document including the exercise description and possibly a form or an iframe element.

If there exists an element with class="exercise" or id="exercise", then contents of that element are shown to the user. Otherwise, then contents of the body are shown.

See Response and feedback HTML for more details.

Step 1.3, asynchronously create a submission

The assessment service may store the submission_url, so it may create a new submission on behalf of the user. The submission_url contains all the required information for the authentication, thus it should be stored securely. Additionally, the period, when the authentication information is valid, may be limited by the LMS.

The assessment service may make a HTTP POST request to the submission_url to create a new submission including the data from the user, the feedback to it and other assessment details for it. Typically, this is only required when the student browser communicates directly with the assessment service inside an iframe.

N.B. because the protocol does not have signed messages, the LMS is only able to authorize the request if it comes from the IP address resolved from the URL configured to the exercise.

The request must have the following headers:

The body of the request must contain following fields:

The grade is calculated from the points and max_points. For example, points=12 and max_points=100 would yield 12% of the maximum points defined in the LMS for that exercise.

This request does not support fields error and notify, which are supported for the step 2.3. Thus, if there are errors, do not make the request.

Response for asynchronously creating a submission

If the POST data is accepted, then the LMS will respond with a content type application/json and {"success": true}. In case of errors, the response will contain {"success": false, "errors": ["a list of strings"]}.

If the request does not accept other than text/plain, then the response will be a string ok or error.

In addition, the status code for the response is:

N.B. also verify the success, as older implementations might not return 400 in case of errors.

Phase 2, assess the submission from the user

overview of the submission

Step 2.1, the request

To assess the submission, the LMS will send the data from the user using HTTP POST to the assessment service.

The request must have the following headers:

Similarly to the step 1.1, the request contains set of query parameters. The following parameters are the same as in the step 1.1:

However, the following parameters have some differences:

Step 2.2, the response

An HTML document including the submission feedback or the status. The document may include a form for resubmission, which might be handy with questionnaires. If there exists an element with class="exercise" or id="exercise", then contents of that element are shown to the user. Otherwise, then contents of the body are shown.

Additionally, following meta fields have special meaning:

There are four possible outcomes:

The grade is calculated from the points and max_points. For example, points=12 and max_points=100 would yield 12% of the maximum points defined in the LMS for that exercise.

Step 2.3, asynchronous update

The assessment service may store the submission_url, so it may upload the feedback later or update an existing feedback. The submission_url contains all the required information for the authentication, thus it should be stored securely. Additionally, the period, when the authentication information is valid, may be limited by the LMS.

The assessment service may make a HTTP POST request to the submission_url to update the feedback and other assessment details for the submission. Typically, this would happen only once as a result of completed asynchronous assessment, but the service may make multiple updates too.

N.B. because the protocol does not have signed messages, the LMS is only able to authorize the request if it comes from the IP address resolved from the URL configured to the exercise.

The request must have the following headers:

The body of the request must contain following fields:

Response for asynchronous update

If the POST data is accepted, then the LMS will respond with a content type application/json and {"success": true}. In case of errors, the response will contain {"success": false, "errors": ["a list of strings"]}.

If the request does not accept other than text/plain, then the response will be a string ok or error.

In addition, the status code for the response is:

N.B. also verify the success, as older implementations might not return 400 in case of errors.

Response and feedback HTML

The assessment protocol does not care about the HTML content, except for following classes and attributes. For more content details, see assessment presentation formats.

HTML Classes

Elements with a following classes have special meanings:

Reserved class names for the LMS.

Known drawbacks

There are number of known issues, which require addressing.

Removed features

Features, which have been part of the API.