Is there an API for grade comments?

Jump to solution
ilovell
Community Contributor

I probably just missed it but, I cannot find anywhere in the API documentation for showing Grade comments or rubric instructor comments. Is it even possible?

I am attempting to make a report card using the API and google docs. Right now they are selecting individually 300+ students and expanding "Show All Details" then Print grades to get that info. I was hoping to help if I could generate a big spreadsheet they could just mail merge into a final report. I think I have figured out how to GET everything they need except those comments.

1 Solution
James
Community Champion

ilovell​,

I think you're talking about this screen. If not, please let me know.

171149_pastedImage_0.png

There are a few API calls you can make to get the information.

  • The Get a Single Submission API call will return information for a single assignment for a single student. Useful if you're iterating through each student one a time without trying to save all the information into a spreadsheet
  • The List Assignment Submissions API call will return information for all students for a single assignment. Useful if you're iterating through each assignment one at a time and then fetching all student information about it.
  • The List Submissions for Multiple Assignments API call will allow you to return multiple students and multiple assignments at the same time. This is probably the most useful for what you want to do. I pass it a list of student_ids[] without assignment_ids[] and I get a list of all assignments for the indicated students. If you have a lot of students, you may want to chunk it into smaller groups to keep it manageable.

The important thing in all of those is the include[] parameter.

  • include[]=submission_comments returns the comments
  • include[]=rubric_assessment returns the scoring on the rubric, but not the rubric itself
  • include[]=assignment returns the rubric but not the scoring

If you choose include[]=submission_comments, you get a "submission_comments" array of objects that is returned. Each submission comment has its own entry in the array. All of them contain a "comment" that contains the comment.

171150_pastedImage_4.png

If you include[]=rubric_assessment, you get a "rubric_assessment" object. Each entry is keyed, but it is not an array. It would also contain any comments for that specific rubric entry here. Sorry for the simplicity, I'm using a really simple rubric for grading.

171151_pastedImage_5.png

If you include[]=assignment, you get an "assignment" object. Inside that object is a "rubric" entry that contains an array. Each entry in the array has an "id" that corresponds to the key in the rubric_assessment. Again, my rubric is simple with only one criteria, but that also means it fits on a screen capture.

171152_pastedImage_6.png

The includes[]=assignment should be the same for each student so you could retrieve it once rather than with each student. It depends on how you're doing the processing.

By the way, the score details section appears to be done through a presenter and not a controller. In plain language, not available directly through the API, but available through the web interface. I'm about to wrap up a project that will fetch the user Access Reports for an entire class. I could find that information at all in the API, so I'm grabbing it directly from Canvas (which has the side benefit that an instructor can use it without messing with the API).  The page I'm using returns the output in either HTML or JSON formats, so choosing JSON made it easier to work with. Unfortunately, the grade summary page seems to only be available in HTML format. Luckily, if you're downloading all the information through the API, then you can manually compute the Score Details if you want it. Another option would be to download the HTML page and then parse it to get all the information you need in one shot -- the problem with that is it's not available through the API and subject to change if they modify they underlying report.

Another option, one you probably don't want to pursue since you've already invested so much time in this one, is using a headless browser like PhantomJS or CasperJS to load the grade summary page that Canvas provides, toggle the Show All Details, and then save it to a PDF file. You do that for each student and then you can print them with all the fanciness that is Canvas.

I hope this gets you headed in the right direction.

View solution in original post