I am trying to call /learn/v1/filerepo/uploadNewFile from C# code to upload a file to a course. We are creating a custom page for users to upload attachments to a course. No matter what user I use I get a 403 forbidden error coming back. I have tried everything and don’t know what the requirements for this Api call is since the documentation isn’t very helpful. Can anybody help with this on how to successfully upload a file to a course and what might this is how I fill out the body.
var attachment = new AttachmentModel
{
CourseId = submission.CourseId,
ParentId = 0,
Title = formattedFileName,
UserId = int.Parse(currentUser.userId),
FileName = formattedFileName,
OriginalFileName = formattedFileName,
Visibility = 1,
ViewableBy = "LearningCourseFile::VIEWABLE_IN_ANY_SESSION",
FileData = fileBytes // Store file data as bytes
};
Thanks for the help!


