Documentation on building URLs to call speedgrader from internal university website

Jump to solution
carols
Community Explorer

Hi, 

At my institution we have an internal web application used by staff and students to view assessments and feedback. In this portal, when staff are viewing the marks a student has received for a given course, we provide links that staff can use to click through to the Speedgrader page in Canvas for the relevant student / submission.

Currently, the link we are using is in the format:

https://canvas.sussex.ac.uk/courses/sis_course_id:915N1_T3_19_20/gradebook/speed_grader?assignment_i...

When a student id is no longer available in Canvas (e.g. because the student has been removed) instead of failing gracefully, this link serves up a speedgrader page for a different student on the course whose student record does still exist.

I found a helpful post referring to a similar problem and offering a solution 

https://community.canvaslms.com/t5/Canvas-Question-Forum/Linking-to-Speedgrader-URL/m-p/158666#M6928...

However I'm wondering whether there is any documentation relating to the appropriate way to build links for speedgrader. I have searched for a couple of hours but haven't found anything.

Is anyone able to help? Thanks in advance.

Labels (2)
0 Likes
1 Solution
James
Community Champion

@carols 

Canvas doesn't directly support linking to SpeedGrader from external sources, so they are not going to document how to do it.

Not supporting something is not the same thing as it not working, though, and you can create links that will work, but you will need to reverse engineer from the URL or look at the source code.

In /spec/coffeescripts/models/EntrySpec.js, they define 

SPEEDGRADER_URL_TEMPLATE: 'speed_grader?assignment_id=1&student_id=%3Astudent_id'

That %3A is an encoded colon, so it's really student_id=:student_id.

There is a note a little later in that file that states that the :student_id gets replaced with the user ID.

Putting that together would give you 'speed_grader?assignment_id=88888&student_id=99999'

Of course, that's just a test to make sure it gives the right thing. The actual code that produces the URL is found in the AssignmentAPI.js file. There it defines the full path.

/courses/${courseId}/gradebook/speed_grader?assignment_id=${assignmentId}&${studentType}=${options.studentId}

The last part is to allow for anonymous users, so it is either anonymous_id=77777 or student_id=99999.

To solve your problem about getting the wrong student, you could first check enrollments to make sure the student is enrolled.

View solution in original post