How to determine Assignment owner/creator via API?

Jump to solution
FunkyPajamas
Community Explorer

Hi, this seems like such a basic question that I feel like I must be missing something, but I checked the documentation and forums and could not find anything. Apologies in advance if this is documented somewhere.

When retrieving an assignment via API through the "Get a single assignment" endpoint (https://canvas.instructure.com/doc/api/assignments.html#method.assignments_api.show), how can it be determined who is the assignment owner/creator, or in other words, who is the "teacher" that assigned it?

I checked the documentation (https://canvas.instructure.com/doc/api/assignments.html#Assignment) and there's no "user", "account" or "owner" value being returned that would point in the right direction.

As I understand it, Courses can have multiple Teachers in them, meaning that the person that created the Course is not necessarily going to be the same person that created the Assignment, correct?

If so, what's the proper way to determine the Assignment's owner/creator user id?

Thanks.

Labels (3)
0 Likes
1 Solution

@FunkyPajamas 

This is going to sound wrong, but to Canvas, the teacher/instructor isn't very important.

You can have multiple users (teachers, TA's, instructional designers) who create content. It doesn't matter to the student who put the assignment in there; if it's assigned they need to complete it. Canvas doesn't care who created it, which is why it's hard to get the information about the creator / updater. 

Knowing who created the assignment is not going to necessarily tell you who the teacher is. If my school uses an instructional designer (we don't, but many do), then they would be the creator, not the teacher. If there is a blueprint course that pushes content out, then the instructor isn't going to be listed as the creator. If someone copies the course content from a previous course for the instructor because the instructor needs help, then that person would be the creator, not the instructor.

Getting the information from the requests table or the user views requires an administrative token (or at least one with super-high privileges). It would be a hard case for an LTI to argue that they need access to that information.

What you are asking about is most assuredly the wrong way to approach the situation as it is resource intensive, requires elevated access, but, most importantly, won't guarantee you the answer you need.

Sometimes the instructor matters. You can have multiple users (teachers, TA's) who have access to the student grades. Canvas does track who grades an assignment, but if three people have access to the gradebook, then it could be any of the three that do the grading.

What some schools have tried to do is to assign TA's to look over collections of students. For example, everyone in section 1 has Tom as a TA, everyone in section 2 has Sally as a TA, and everyone in section 3 has Betty as a TA. There may be an instructor who could change grades for anyone without regard to the section.

Grades belong at the course level, not the section level. If a student changes sections within a course, their grades persist, but the person responsible for dealing with them may change. Students can also belong to more than one section.

Since you are an LTI provider, there are variables that Canvas can send to you with the launch request. This is the intended way to pass information between the systems and hopefully they sufficient that an LTI doesn't need API access.

One of those variables is com.instructure.User.sectionNames that provides an array of the section names that the user is enrolled in. There is also a CourseSection.souredId that returns the SIS ID for the course, Canvas.course.sectionIds that give the Canvas IDs for the section, Canvas.course.sectionRestricted that will tell you if students can interact with only their sections, Canvas.course.sectionSisSourceIds gives the SIS IDs for the sections the user is enrolled in.

What I don't see is a list of everyone who is a teacher or TA for the course. This is where the API could come in. You could take the Canvas.course.id for the course or the Canvas.course.sectionIds and look up the teacherEnrollments for that course / those sections via the API.

Another possible way to handle it, without the API, is to determine which course or sections the instructor is enrolled in when they launch your LTI and then update the associations with the students from that section. Or, you could use the API to get a list of all of the students from the course / sections when the instructors opens the tool. Getting a list of all of the students might take a while if the classes are large, but getting a list of sections within a course for a single instructor would be quick.

View solution in original post