cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
AndrewD1
Community Member

API GET all assignments for specific student. BULK endpoint

I am currently working on a dotnet wrapper for a professor. I need to be able to get every assignment and assignment grade for a INDIVIDUAL student.

Currently what I am doing is hitting

/courses/:courseID/assignments

to retrieve a list of all assignment IDS that exist for the class (This endpoint gives me the name of the assignment and the due_date / assignment ID).

Then I iterate over

/courses/:courseID/assignments/{assigmentID}/submissions/{userID}

 The issue I am having is that this leads to hundereds of endpoint calls to the api (I need the grade the student got on the assignment but that isn't included on the /courses/:courseID/assignments endpoint).

i.e if I want all the data for this student i would have to call

/courses/:courseID/assignments/1/submissions/12345

/courses/:courseID/assignments/2/submissions/12345

/courses/:courseID/assignments/3/submissions/12345

/courses/:courseID/assignments/4/submissions/12345

 

 

The professor needs student data for each assignment, such as the grade the student got and the name of the assignment. So I created a custom object to deserilize the response using these two endpoints combined.

 

Does anyone know of a way to get every assignment with the grade the student got on it? Or is this the only possible approach. I have found no way to retrieve every assignment with the grade the student got on it from a Canvas endpoint, or any URL filters I could use to make it easier. Anything to lower the endpoint calls down would be greatly appreciated.

Labels (2)
0 Kudos
1 Reply
sendres
Community Participant

Hi @AndrewD1,

You should be able to reduce this workload somewhat with this:

 

/api/v1/courses/:course_id/gradebook_history/feed?user_id=:user_id

 

This will give you the history of everything that's been graded for the given student and course. I don't think it will include assignments the student didn't turn in. So you probably need two calls: one to fetch all of the assignments in the course (as you are already doing) and then this one to get the grades for the assignments that have been turned in and graded.

Please report back how that works for you.