How to upload comments on an assignment submission automatically?

Jump to solution
m_weintraub
Community Novice

Hi.  I'm very new to Canvas and the community.  

I have a question based on our existing process, which we've ported into Canvas. 

We have an assignment where the students upload a file, say .xslx or accdb.  We grade the assignment using a google form and then have a script that assembles a report (pdf) that we want to upload in lieu of comments.  We have about 400 students in the course, so manual uploads are painful.  I'm looking for a built in way, either through the GUI or through an API, to do this.

I did read a post about uploading based on the same file name, but that's not going to work here.  I can make the report have the same name, but not the same file type.  So it doesn't seem like this route will work.  

I also saw there is a feature proposal to do something like this.  I don't need a feature if there's an API call I can use.

Any thoughts/insights?

Thanks,

    Mike

1 Solution
James
Community Champion

 @m_weintraub ,

If you are wanting it to show up in DocViewer as their submission, then you're not going to have much luck. You may be able to fake creation an annotated PDF, but this doesn't happen through the API so it's not so easy to do. It took a lot of work just to figure out how to download an annotated submission through the API.

If you can accept uploading the PDF as a submission (assignment) comment, then there is definitely a way to do this. Check out the Grade or comment on multiple submissions endpoint of the Submissions API and the Upload a file endpoint of the Submission Comments API.

You first upload the PDF file and then you attach it to a PUT call to grade or comment on the submission using the comment[file_ids][] array. You can also use the Submissions API endpoint to assign a grade automatically as well. You can even leave a comment "See attached file for more information" or something like that.

There's a single-submission version as well, but the multiple submissions endpoint allows you to save API calls.

Those submissions get processed in the background before they get entered into the system, but my experience is that we're normally talking seconds, not minutes. 

View solution in original post