Working With Files
The File Service has two main components;
- APIs, with which your application can mange files, and
- the Tenant Admin Webapp, which lets you configure the service to meet your needs.
Tenant Admin Webapp
Configuring the File Service is about creating File Type collections, and setting up permissions and retention policies for them. You do this through our Tenant Admin Webapp. See File Type collections for more information.
API
You can learn the specific details of how an API works from our Swagger Documentation; here we’ll just give a brief overview of the functionality supplied through them.
API calls to the File Service require authentication via Keycloak, except reading and downloading files of File Type collections that allow public (anonymous) read. See the instructions for setting up a tenant and getting access tokens for details on how to do this.
Uploading
Files are uploaded as multipart/form-data requests and stored in Azure Blob Storage. In addition to the file, there is a small amount of metadata that gets created and stored along with it, as discussed below.
File Scanning
Every uploaded file is scanned for viruses or other malicious software after the upload completes; a file cannot be downloaded until its scan is complete, unless the download explicitly sets unsafe=true. Scanning is provided by ClamAV, an open-source anti-virus toolkit maintained by Cisco Systems Inc. The database is updated frequently, so you can be sure the File Service will be looking for the latest threats. The service is designed to be fast, but you may find there is some delay between uploading and being able to access your file. This should not be an issue with small files.
Access Permission
Using File Type collections you can specify access permissions based on your tenant (Keycloak) roles. See ADSP File Type collections for more information.
Metadata
Metadata - or File Properties - is stored along with the file. Metadata includes
| Name | Description |
|---|---|
| id | The file ID with which which you can refer to the file when performing File Service API calls. |
| filename | The name of the file. |
| urn | Logical URN of the file. You can map the URN to a URL using the ADSP SDK’s getResourceUrl() method. |
| size | File Size |
| typeName | Name of the File Type collection to which the file belongs to. |
| record ID | An optional, arbitrary, application record-ID that can be used to cross reference the file with application data. |
| created date | Date the file was uploaded. |
| created by | The name and ID of the authenticated user that uploaded the file. |
| scanned | True if the file was scanned when uploaded. |
| infected | True if a virus or other malware was found in the file contents. |
Searching
You can search through your uploaded files using the following criteria
- file names matching, or partially matching, an input string
- metadata matching a specific record ID
- those files in a specific File Type collection
Downloading
Files are downloaded with the Content-Type of the file (for example application/pdf), as an attachment by default or inline with embed=true. Please see the Swagger Documentation for more information on downloading via the APIs.