Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
I followed the documentation here to submit a file ...
Uploading Files - Canvas LMS REST API Documentation
The end result is a file added to the user's personal file space, and I got back a file id. I can preview the file and I can download this file.
Then I want to use this file as assignment submission for the same user, which is done by this Canvas API.
Submissions - Canvas LMS REST API Documentation
But I am getting "No valid file ids given" error when calling that API. Can someone point me on the right path?
(code is in C#)
var url = $"https://{CanvasHost}/api/v1/courses/{CanvasCourseId}/assignments/{CanvasAssignmentId}/submissions?as_user_id={CanvasUserId}";
var formData = new Dictionary<string, string>
{
{"comment[text_comment]", "submitted via FST"},
{"submission[submission_type]", "online_upload"},
{"submission[file_ids]", $"{fileSubmissionResult.CanvasFileId}"}
};
Solved! Go to Solution.
I did get it to work, my above code is almost correct, except you need to use this instead.
Hi Douglas
Just wondering if you managed to resolve that problem - I'm having the same issue with no luck
Thanks
Hi @d_tan ,
I am wondering how you went on this and if Peter's response above was able to help you out?
Cheers,
Stuart
I did get it to work, my above code is almost correct, except you need to use this instead.
Thanks so much for letting us know Douglas, and thank you to pklove for helping out!
To participate in the Instructure Community, you need to sign up or log in:
Sign In