Search code examples
iosdesire2learn

Desire2Learn:How to download a file from news attachment?


I'm integrating desire2Learn in IOS. Please find the News object below:

{
        Attachments =         (

                        {
                FileId = 401485;
                FileName = "iOS Simulator Screen shot 04-Apr-2013 4.09.48 PM.png";
                Size = 171857;
            }
        );
        Body =         {
            Html = "<p>Audio and file</p>
\n<p></p>";
            Text = "Audio and file
\n";
        };
        EndDate = "<null>";
        Id = 43905;
        IsGlobal = 0;
        IsHidden = 0;
        IsPublished = 1;
        ShowOnlyInCourseOfferings = 0;
        StartDate = "2013-04-04T10:38:00.000Z";
        Title = "Audio and File attachment";
    }

I want to download the file. Can someone please help.


Solution

  • To retrieve the attachment for a news item, you use the route that fetches the attachment by file ID. This route should return a file stream containing the file attachment data for the file identified with your provided ID. In your case, the file ID seems like it would be 401485.