Reproduce Student View of Grades via API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We are looking for the simplest method to reproduce the information on the student's own view of the gradebook using an API tool. The best we could come up with so far is using this to list all of the assignments for a user in a course.
GET /v1/users/{user_id}/courses/{course_id}/assignments
And then using this to loop through each assignment id from the above list and get the grade from the submissions.
GET /v1/courses/{course_id}/assignments/{assignment_id}/submissions/{user_id}
Can anyone think of a better method to generate this exact information with the fewest API calls -- including the weight calculations as seen in Canvas without having to manually recalculate?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A grades object is wrapped within an enrollment object. So if you retrieve an enrollment of that student, look at the grades object, which lists both current and final score of that student: grades, ie:
[{"id": 23, ......
"grades": { "html_url": "https://<canvas-instance>/courses/354/grades/1225", "current_score": 99.02, "current_grade": null, "final_score": 99.02, "final_grade": null },
....}]
method: /v1/users/{user_id}/enrollments
API: Enrollments - Canvas LMS REST API Documentation
Hope that helps.