Community

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

API call for getting all SpeedGrader comments for a course?

Jump to solution
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 Kudos
1 Solution

Accepted Solutions
melodyc_lam
Community Member

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

3 Replies
melodyc_lam
Community Member

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! 

Thanks so much @melodyc_lam!

You can also simplify it to one API endpoint by using List submissions for multiple assignments

GET /api/v1/courses/:course_id/students/submissions

Include parameters for student_ids[]=all and include[]=submission_comments