Download File

  • Is able to expose the (binary) content of a file.

  • Allows to save a file locally on disk.

  • Required security permission - READ.

  • HTTP methods supported: GET

Description

This endpoint allows to display the content of a file in a web browser or to download a file as an attachment locally on disk.

Parameters

Name Type Optional Description

_id

string

no

The MongoDB ObjectId of the file to download.

storename

string

no

The name of the file store in which the file is stored.

content-type

string

yes

The media type (also known as a Multipurpose Internet Mail Extensions or MIME type) of the file. By default the value of the meta data field content-type will be used.

content-disposition

string

yes

The HTTP Response header indicating if the content is expected to be displayed inline in the browser, that is, as a Web page or as part of a Web page, or as an attachment, that is downloaded and saved locally. By default not set.

Saving a file

To save a file locally on disk the value of the content-disposition option needs to be set to attachment. By default the value of the field filename is used as filename. A custom filename can be defined in the value of the content-disposition option in the following way: attachment; filename=myname.jpg

Examples

Display in browser

Example to retrieve a file and to display the content in the browser.

HTTP GET

Request URL
  • /api/v2/downloadfile?storename=Lab&_id=5cf0e75c84b00a016000074c

Save file locally on disk

Example to save a file locally on disk with the same filename as stored in the system.

HTTP GET

Request URL
  • /api/v2/downloadfile?storename=Lab&_id=5cf0e75c84b00a016000074c&content-disposition=attachment

Save file locally with custom name

Example to save a file locally on disk with filename example.jpg.

HTTP GET

Request URL
  • /api/v2/downloadfile?storename=Lab&_id=5cf0e75c84b00a016000074c&content-disposition=attachment; filename=example.jpg