Getting the most recent submission comments via API

Jump to solution
DoubleJAllDay
Community Member

Hi there.

I hope that someone with the API knowledge can help me with this one. 

I've built the parent portal where I'm showing the latest submission comments to parents. To fetch the comments I first grab the assignments, then for each assignment I fetch the submissions and inside the submissions call I include submission comments. My problem is that this job take a very long time to run as it needs to make a ton of request, and I'd like to cut down this time.

Canvas unfortunately doesn't have a GET on the comments https://canvas.instructure.com/doc/api/submission_comments.html and the only way to get comments in by calling the submissions endpoint and including the submission comments into it. 

My issue is that there's no filter that will give me submissions where a comment was submitted after my last fetch. I always have to get all the submissions and check if there are new comments in them.

I can't see a flag that would mark a submissions as closed to comments so I assume that the comment can be submitted at any time.

I wonder if anyone has ran into a similar issue and how they went about it..

Cheers for your help!

0 Likes
1 Solution
CanvasNeil
Community Explorer

Hello, it looks like you should be using Canvas Live Events to capture new submission comments!

Instead of fetching the data yourself, you can setup a submission_comment_created subscription, so whenever a new submission comment is created, Canvas will send you the submission and comment data.

View solution in original post