cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
matt_price
Community Participant

Download submisison attachments

Jump to solution

Is it possible to download a submitted file (submission attachment) via the API? I can see that the submission object includes an "attachment" property which contains an object describing the attachment, including a download URL. But it doens't seem to be possible to actually retrieve the file itself. Is there a way to do this? I'm using API v1 on my University's (brand new!) canvas installation.

Thanks!

Labels (1)
Tags (1)
0 Kudos
1 Solution

Accepted Solutions
pklove
Community Champion

You just need to call the attachments url.  For example:

   https://......../files/1234/download?download_frd=1&verifier=sadfsdfsdfsdfsdfsdf

But note that this will probably re-direct, so your application has to follow the re-direct.  For example, with curl:

   curl -L 'https://......../files/1234/download?download_frd=1&verifier=sadfsdfsdfsdfsdfsdf' > some_file

View solution in original post

2 Replies
pklove
Community Champion

You just need to call the attachments url.  For example:

   https://......../files/1234/download?download_frd=1&verifier=sadfsdfsdfsdfsdfsdf

But note that this will probably re-direct, so your application has to follow the re-direct.  For example, with curl:

   curl -L 'https://......../files/1234/download?download_frd=1&verifier=sadfsdfsdfsdfsdfsdf' > some_file

View solution in original post

matt_price
Community Participant

Wow, that was really easy! I'm a little surprised to find that the URL doesn't require authentication -- I have been unable to manage the single-signon for my University from the command line, and had assumed I wouldn't be able to access this resource. But yes, this works great. I wish that the precise name of the file as downloaded in the "work offline" button inside the Canvas web UI were included in the API response, to make it easier to support a mixed practice of API and Web UI work; but it looks like it won't be so hard to reverse engineer those file names. Again, thank you!