Community

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
FunkyPajamas
New Member

How to determine Assignment owner/creator via API?

Jump to solution

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 Kudos
1 Solution

Accepted Solutions
James
Community Champion

@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

6 Replies
JamesSekcienski
Community Participant

It doesn't look like the API supports this information for the REST API or GraphQL. 

If you have access to the requests tables from Canvas Data, you might be able to find out who created by looking at the time the assignment was created and find the request at that time in the requests table of Canvas Data.  If you can find the request, then you can find which user made the request to create the assignment.

FunkyPajamas
New Member

Hi @JamesSekcienski thanks for the reply.

Unfortunately I don't have access to the request tables, as those don't appear to be part of the API.

 

 

James
Community Champion

@FunkyPajamas 

Canvas Data is separate from the API. The requests table is huge; I mean HUGE. It's similar to the page views that administrators can get for users, but for every user and almost every request across the institution. There is a lot of overhead in getting it working. Much of the information is available in Canvas (provided you don't want to go back more than a year -- don't quote me on that duration).

Through the API, Canvas administrators have access to the List user page views endpoint. That endpoint supports start_time and end_time parameters that allow you to jump back to a point in time without having to paginate backwards through every request to get there.

What you can attempt is to take a list of all of the people who might have made the change (a list of all of your teachers -- potentially TA's, instructional designers, etc) and then gather the page views for each of them around the time when the assignment was created. If you find a match, then you have the culprit person responsible.

If the assignment was recently created, you might be able to look at the People page in Canvas and see who has been active since the page was created to help narrow down the list of possible perpetrators.

If it is super-important and an isolated case, you may be able to reach out to your CSM at Instructure and have them look into it.

If this is a recurring issue, then going forward, you can use Live Events from the Canvas Data Services. You can set it up to send an event message every time an assignment is created or updated. You can set up an AWS SQS queue and the pricing is pretty cheap (I think there's a million free events a month and there shouldn't be that many assignment creation or updates). Anyway, the event message includes information about the person making the request. This approach cannot go back and re-create events and it makes a best-attempt to send it, but there may be events that are missed. Events expire, so you will need to poll the events and store them locally, just in case you run into an issue where the assignment was created more than 14 days ago.

FunkyPajamas
New Member

Hi @James thank you kindly for such an extensive and informative reply. I must apologize: I should have described my use case in the initial post; I had assumed the owner/creator of the assignment to be such an integral piece of data that I just figured there was something obvious I was missing in the documentation, and decided to skip the use case to keep the initial post brief. Sorry about that.

The use case is for a third party integration with districts using Canvas, by way of the API: we (content provider) receive an LTI request from Canvas to SSO a user coming through a Canvas Assignment. The user is most assuredly not the Assignment creator but an assignee (student), and so we must connect the "student" to the "teacher" in our system (for grading/feedback). The initial plan was to retrieve the Assignment creator information from the API and match that against our dataset.

The List user page views would work but it sounds a tad computationally expensive (API request per user, then try to find the matching page request for assignment creation), so I think we'll have to rethink our strategy for what we're trying to do.

Again, thanks for taking the time to look into it.

 

James
Community Champion

@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.

FunkyPajamas
New Member

Thanks again @James . I have a meeting later today with the product owner, so I will share this information with them. I do agree that we may be going down the wrong path, so we'll determine what our options are and whether we need to rethink our strategy/use case.