reevesj
I was able to upload a file as a submission comment. So let's step by step this.
One thing to note off the bat that I did not see in your comments. The first POST for a submission file upload is to a different route than to a course file upload. Please confirm you used:
POST /api/v1/courses/:course_id/assignments/:assignment_id/submissions/:user_id/comments/files
From there you receive a data object back, something like:
"{"id": 9999,
"upload_status":"pending",
"status_url":"https://everspring2.instructure.com/api/v1/files/1234/abcFile567/status"}"
Do a GET on the status_url. Once you receive a data object that looks like
{"upload_status":"ready"
, "attachment":{
"id":9999
, "folder_id":null
, "display_name":"pic.jpg"
, "filename":"141234_151__pic.jpg"
, "content-type":"image/jpeg"
, "url":"https://everspring2.instructure.com/files/1234/download?download_frd=1\u12326verifier=123"
, "size":110049
, "created_at":"2016-04-17T17:59:34Z"
, "updated_at":"2016-04-17T17:59:35Z"
, "unlock_at":null
, "locked":false
, "hidden":false
, "lock_at":null
, "hidden_for_user":false
, "thumbnail_url":"https://instructure-uploads.s3.amazonaws.com/account123000001/thumbnails/123/14609974_151__pic_thumb..."
, "modified_at":"2016-04-17T17:59:34Z"
, "locked_for_user":false
}
}"
You now know that instructure has successfully place your file on their sever.
Final step is to PUT to a submission at the route:
/api/v1/courses/:course_id/assignments/:assignment_id/submissions/:user_id?comment[file_ids][]=9999
Please let me know if you find success in this! I am more than happy to continue helping.
One note: While I am an admin on our instances of canvas, I did this logged in as one of our test teachers to ensure teachers were in fact authorized to perform this action.