AnsweredAssumed Answered

Uploading file as assignment submission via API

Question asked by DJ Rao on Nov 5, 2016
Latest reply on Apr 13, 2018 by Wasi Khan

Hello,

I am working on an LTI integration with Canvas. I am trying to upload file(s) (say hello.txt) as assignment submission. However, I get the error message shown below:

curl 'https://miamioh.test.instructure.com/api/v1/courses/30928/assignments/317351/submissions/self/files' -F 'name=hello.c' -F 'size=81' -F 'content_type=text/x-c++src' -H 'Authorization: Bearer Token' 
{"errors":[{"message":"The specified resource does not exist."}],"error_report_id":6979213040}

I have verified the path (course ID, assignment ID etc.) and token. I tried with different assignments but no luck. The Canvas-web application seems to be able to upload files to the assignment but I am unable to do so via CURL.

 

I am able to create files at "/api/v1/courses/30928/files" with the token. So I can tell up to that point things are correct and the general approach I am using is working, but I am unable to submit files into assignments using the API URI "/api/v1/courses/:course_id/assignments/:assignment_id/submissions/self/files" (due to the above error) as suggested at: https://canvas.instructure.com/doc/api/file.file_uploads.html

 

Any suggestions/help to troubleshoot this issue is greatly appreciated.

Outcomes