Download File
-
Is able to expose the (binary) content of a file.
-
Allows to save a file locally on disk.
-
Allows to show a file directly in the Browser.
-
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 |
---|---|---|---|
storename |
string |
yes |
The name of the file store in which the file is stored. Is ignored when a pathspec is provided. |
_id |
string |
yes |
The MongoDB ObjectId of the file to download. Is ignored when a pathspec is provided. |
pathspec |
string |
yes |
The path or id of a File or FileList property containing the file to download. |
filter |
string |
yes |
A filter specification to lookup a file which is stored in a File or FileList property. Must be a string containing the name or a Base64 encoded JSON dictionary. See the |
prev |
number or string |
yes |
A filter can have an optional start value 'prev' which is typically the metatable obtained from a previous call to continue iterating over all matching entries. It may also be an integral row index (negative values are relative to the last row, i.e. specifying -2 returns the last table row if it matches). Must be a number or a Base64 encoded JSON dictionary. |
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-disposition |
string |
yes |
The HTTP Response header indicating if the content is expected to be displayed |
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 name
in the metadata 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. The authorization
URL Query can be set to provide the Basic or Bearer authentication token.
Save file locally on disk
Example to save a file locally on disk with the same filename as stored in the system.