Assign Grade To Registration

Last modified on January 28, 2015 at 2:59 pm

Overview

Assign a grade to a registration. At any time, you can assign a grade to a registration. This will have various effects based on the current state of the registration record. If the record is currently active and the user is progressing through the course, assigning a grade will halt their progress and put the provided grade on their record. This will also calculate whether the grade is passing or failing and set the appropriate status. If the registration is already completed, updating the grade will assign the new grade value as well as recalculate pass/fail and update the status. On an ejected record, assigning a grade has the same effect – pass/fail will be recalculated and assigned, and the ejection will be cleared. Note that you never need to provide a value for status when assigning a grade, and best practice is to omit it.

Examples

Assign a grade to an existing registration

This example demonstrates grade assignment by sending a PUT request containing the grade property to assign. Note that all other properties of the registration are omitted.

Request
PUT /dc/api/v5/registrations/65ade781cc98d136543678191005431a HTTP/1.1
Host: api.digitalchalk.com
Content-type: application/json
Accept: application/json

{
	"grade": 99.7 
}

Response
HTTP/1.1 204 NO CONTENT
Content-type: application/json
Content-length: 0

Failure Cases

Below is a list of the most common failure scenarios your code should be prepared to handle. This list is not exhaustive.

Validation error

When you attempt to assign a grade, a validation process will run to ensure the changes being made are consistent with the application’s business rules. In particular, when assigning a grade, the grade value must be between 0 and 100. If a validation error occurs, no changes will be made and the error will be reported in the response along with an appropriate HTTP status code of 400 or above.

In the following example, an invalid value is provided for the grade field. This demonstrates how the server will indicate the problem with the request for this case.

Request
PUT /dc/api/v5/registrations/65ade781cc98d136543678191005431a HTTP/1.1
Host: api.digitalchalk.com
Content-type: application/json
Accept: application/json

{
	"grade": 103 
}
Response
HTTP/1.1 400 Bad Request
Content-type: application/json
Content-length: 210

{
	"fieldErrors" : {
		"grade" : "must be a number between 0 and 100"
	}
}

Reference