Feature - API Call for download attachments

Hi,

Currently, on 3.23.1, there is no way to download attachments using the API. We would like to have a new API call to download the file.

Regards,

1 Like

Hello,

As far as I know, you can perform a GET on the following URL to download the attachment(s) you want.

https://[eramba url]/attachments/attachments/download/[attachment_id]

You can get the [attachment_id] in two steps:

  1. You make a GET request on the below URL, where [module_name] is the module hosting the item(s) of which you want to download the attachments (e.g., the Internal Controls module). [module_name] can be found in the module’s corresponding API. GET on the below URL will give you the IDs of all your module’s items.

https://[eramba url]/[module_name]/index

  1. You can then make a GET request on the following URL. [item_id] is the ID of the item of which you want to download the attachments and that you can get from step 1. A GET on the below URL will give you the IDs of the attachments associated to [item_id] (hereafter named [attachment_id]).

https://[eramba url]/[module_name]/[item_id]/attachments

Once you have the [attachment_id] you need, you can make a GET request to

https://[eramba_url]/attachments/attachments/download/[attachment_id]

This will return the contents of the file you need. Using the URL from step 2, you will also get information about the attachment’s extension. You can use this to setup the proper stream in your code to fetch the document’s content.

Its not super practical, but it works! It also requires a bit of additional work if you want to retrieve extensions such as .docx or .pdf.