UBC-DSCI / rudaux

LMS + External Tool Workflow Orchestration
https://ubc-dsci.github.io/rudaux
MIT License
7 stars 5 forks source link

TODO: Use Canvas File Upload API to upload feedback forms along with grades. #16

Closed ttimbers closed 4 years ago

ttimbers commented 5 years ago

@samhinshaw - did you have any thoughts where to start for this? I need to do this now, even if I just do in inside Python for now that is fine. So I am wondering if you identified a part of the Canvas API that would do this?

samhinshaw commented 5 years ago

Yes! It seemed like it was a two-step process: https://canvas.instructure.com/doc/api/file.file_uploads.html

@ttimbers

ttimbers commented 5 years ago

I think it can't be done with an external tool submission, here under submission[file_ids][] it says "Requires a submission_type of “online_upload”."

ttimbers commented 5 years ago

Perhaps we can instead send the feedback files back as attachments using the Conversations API

ttimbers commented 5 years ago

To do this, it looks like we need to:

  1. upload files to the sender's “conversation attachments” folder
  2. Create a conversation where we attach the file (via attachment_ids)
ttimbers commented 5 years ago

OK, and there's a trick to it, as there' a bug (hurray!), it's documented here: https://community.canvaslms.com/thread/20969-api-problem-attachments-in-create-conversations

samhinshaw commented 5 years ago

Oh, I see—because the file upload API can only be used on submissions, and submissions can only be created via the API for the “online_upload” file type?

As for that bug (needing to supply []), I am fairly certain I ran into the same issue with another API endpoint. Fortunately, Calvin pointed out the fix to me!