Question - download attachments using REST

today someone asked us how to download internal controls / audit / evidence automatically to feed some system of theirs. the typical use case is the opposite, automate evidence upload not download … but is good we got asked to see how to do this.

it does not work btw, there is a small change needed but that small change could mess up other things so this is a bit experimental.

on demo-e2 i have audits and i put attachments (a csv file) on audit id 1

if you want to know “what attachment has audit id = 1” you need to query the attachment plugin (the same as you would do if you upload an attachment) with a get request:

that will get you the attachments for that model id’s … the output will include the file type (important) and id of the attachment, 14 in this case

then you could try to download the attachment … but it wont work out of the box because an exception on the code wont let you do it

will get you…

if you override the exception on the appcontroller (line 1321) you will be able to download the file

and try again it should work (i have not tested this for binary files)

we need to review this code a bit more in detail after the migration…

int ref:
int ref: