Score API

Score API for IMS Assignment and Grade Services

A Score object looks like:

{
  // The lti_user_id or the Canvas user_id
  "userId": "50 | 'abcasdf'",
  // The Current score received in the tool for this line item and user, scaled to
  // the scoreMaximum
  "scoreGiven": 50,
  // Maximum possible score for this result; it must be present if scoreGiven is
  // present.
  "scoreMaximum": 50,
  // Comment visible to the student about this score.
  "comment": null,
  // Date and time when the score was modified in the tool. Should use subsecond
  // precision.
  "timestamp": "2017-04-16T18:54:36.736+00:00",
  // Indicate to Canvas the status of the user towards the activity's completion.
  // Must be one of Initialized, Started, InProgress, Submitted, Completed
  "activityProgress": "Completed",
  // Indicate to Canvas the status of the grading process. A value of
  // PendingManual will require intervention by a grader. Values of NotReady,
  // Failed, and Pending will cause the scoreGiven to be ignored. FullyGraded
  // values will require no action. Possible values are NotReady, Failed, Pending,
  // PendingManual, FullyGraded
  "gradingProgress": "FullyGraded"
}

Create a Score Lti::Ims::ScoresController#create

POST /api/lti/courses/:course_id/line_items/:line_item_id/scores

Scope: url:POST|/api/lti/courses/:course_id/line_items/:line_item_id/scores

Create a new Result from the score params. If this is for the first created line_item for a resourceLinkId, or it is a line item that is not attached to a resourceLinkId, then a submission record will be created for the associated assignment when gradingProgress is set to FullyGraded or PendingManual.

The submission score will also be updated when a score object is sent with either of those two values for gradingProgress. If a score object is sent with either of FullyGraded or PendingManual as the value for gradingProgress and scoreGiven is missing, the assignment will not be graded. This also supposes the line_item meets the condition to create a submission.

A submission comment with an unknown author will be created when the comment value is included. This also supposes the line_item meets the condition to create a submission.

Request Parameters:

Parameter Type Description
userId Required string

The lti_user_id or the Canvas user_id. Returns a 412 if user not found in Canvas or is not a student.

activityProgress Required string

Indicate to Canvas the status of the user towards the activity's completion. Must be one of Initialized, Started, InProgress, Submitted, Completed.

gradingProgress Required string

Indicate to Canvas the status of the grading process. A value of PendingManual will require intervention by a grader. Values of NotReady, Failed, and Pending will cause the scoreGiven to be ignored. FullyGraded values will require no action. Possible values are NotReady, Failed, Pending, PendingManual, FullyGraded.

timestamp Required string

Date and time when the score was modified in the tool. Should use subsecond precision. Returns a 400 if the timestamp is earlier than the updated_at time of the Result.

scoreGiven number

The Current score received in the tool for this line item and user, scaled to the scoreMaximum

scoreMaximum number

Maximum possible score for this result; it must be present if scoreGiven is present. Returns 412 if not present when scoreGiven is present.

comment string

Comment visible to the student about this score.

https://canvas.instructure.com/lti/submission Object

(EXTENSION) Optional submission type and data. new_submission [Boolean] flag to indicate that this is a new submission. Defaults to true if submission_type is given. submission_type [String] permissible values are: none, basic_lti_launch, online_text_entry, or online_url submission_data [String] submission data (URL or body text)

Example Request:

{
  "timestamp": "2017-04-16T18:54:36.736+00:00",
  "scoreGiven": 83,
  "scoreMaximum": 100,
  "comment": "This is exceptional work.",
  "activityProgress": "Completed",
  "gradingProgress": "FullyGraded",
  "userId": "5323497",
  "https://canvas.instructure.com/lti/submission": {
    "new_submission": true,
    "submission_type": "online_url",
    "submission_data": "https://instructure.com"
  }
}