API call for getting all SpeedGrader comments for a course?

Jump to solution
audrey_p
Community Participant
Hi, I'd like to help an instructor gather all of their SpeedGrader comments in their course. This is so they can create a text library and use it for future commenting. Any help would be appreciated!


I was able to see one assignment:
url: GET /api/v1/courses/:course_id/assignments/:assignment_id/submissions/?include[]=submission_comments
and am struggling to see all assignments. 

I see assignment_id[] "List of assignments to return submissions for. If none are given, submissions for all assignments ar..." but don't seem to be using this right, e.g.,
url: GET /api/v1/courses/:course_id/?include[]=submission_comments&include[]=assignment_id. 

In the meantime, I've shown them how to gather this information through Canvas' user interface like the comment library in SpeedGrader and the related ideas in the past years. Thank you!

0 Likes
1 Solution
melodyc_lam
Community Coach
Community Coach

You need to do multiple API calls and process the results to call the next API endpoint.

First, you need to retrieve all assignments from the course: https://canvas.instructure.com/doc/api/all_resources.html#method.assignments_api.index

Then, given that list of assignment IDs retrieved from the JSON object, you will call the submissions endpoint for each assignment: https://canvas.instructure.com/doc/api/submissions.html#method.submissions_api.index with the include[]=submission_comments parameter.

Then once you have those JSON objects you can process the submission comments.

Hope this helps! 

View solution in original post