Overview

Eject a user from an offering. By ejecting a user, you remove their ability to access course material and provide no grade for the course. Note that ejecting a user is only possible while the user is actively taking the course (i.e. the status property of the registration says active). Attempting to eject a user after they have completed the offering will result in an error response.

Examples

Eject user from offering

This example demonstrates ejecting a user by sending a PUT request containing an updated status property set to ejected. Note that all other properties of the registration are omitted, as they will automatically be updated by the service when the ejection is processed.

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

{
	"status": "ejected"
}

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 eject a user, the service will first check to ensure the registration is in a valid state such that an ejection is valid. In particular, the registration status must be active. Ejecting from an already completed course is not valid and will result in an error.

In the following example, an ejection is attempted on a registration which has already been completed by the user and automatically graded by the server. 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: org.digitalchalk.com
Content-type: application/json
Accept: application/json

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

{
	"fieldErrors" : {
		"status" : "eject status not available after registration is graded"
	}
}

Reference