This chapter describes the REST API calls that can be used with MetaDefender Vault. Through the Application’s Interface, any 3rd party application can interact and communicate directly with MetaDefender Vault. This allows you to add MetaDefender Vault to your automated workflow. Each call should include an authentication key or user credentials (username and password) or use 8.4 API Keys.
About this REST API
The exposed endpoint is located by default at http://localhost:8010/vault_rest/ (i.e. for Initialize Group Transfer the endpoint is http://localhost:8010/vault_rest/transfer).
All endpoints require you to provide the Authorization header. The value for this header should be obtained by calling Request An API Key. Please note that an authentication key has a limited lifetime and it should be refreshed to avoid expiration policy.
In order to change the URL it is recommended to use the Protocol Configuration Tool(located by default in C:\Program Files\OPSWAT\MetaDefender Vault\Tools).
This URL can also be changed directly from the configuration file by following these steps:
Go to the installation directory (by default C:\Program Files\OPSWAT\MetaDefender Vault)
Navigate to the WebServer/conf folder
Open the file called dynamic.conf using administrative privileges
Edit the following section of the configuration file as you wish:
listen <ip_address>:<port>; server_name "<machine_name>";
Or, in case of TLS/SSL:
listen <ip_address>:<port> ssl; server_name "<machine_name>"; ssl_certificate "<certificate_path>"; ssl_certificate_key "<certificate_key_path>"; ssl_password_file "<password_file_path>";
Restart MetaDefender Vault Helper Service (vaultHelper) for changes to apply.
Authentication Management
Overview
These APIs provide functionality to create, update and delete API keys. The first step should be to Request an API key before continuing with other API calls.
Request An API Key
Summary
This API allows a user to sign in and obtain an API key to use in subsequent API requests.
Use Cases (used by)
All clients accessing MetaDefender Vault REST must call this API first to obtain an API key.
The token required in the Authorization header is formed by joining the account's username and password, using the windows newline separator (CRLF - \r\n) as delimiter.
Example
Username: JohnDoe
Password: SecretPassword
Token: encodeBase64("JohnDoe\r\nSecretPassword")
Authorization: Basic Sm9obkRvZQ0KU2VjcmV0UGFzc3dvcmQ=
OK
Cancel Or Expire An API Key
Use Cases (used by)
Used by the user interface when the user logs out.
OK
Extend API Key
Summary
This API allows a user to extend an API key.
Use Cases (used by)
Used by clients that want to prevent an API to expire due to inactivity or change the expiration of an existing generated API key.
OK
Create A 3rd Party API Key
Summary
This API allows you to create API keys to be used by 3rd party applications.
OK
Enumerate API Keys
Summary
Returns a list of API keys generated by this user to allow 3rd party applications to connect to MetaDefender Vault .
Use Cases
Used by the web user interface to display generated API keys.
OK
File Management
Overview
These APIs enable developers to check information about files uploaded in MetaDefender Vault.
Download a file
Summary
This API call allows you to download the files stored in MetaDefender Vault.
The call should be made to vault_rest/file/{file_id} through a GET request. Please note that you need to obtain {file_id} in order to retrieve the file.
Successful response
Delete A File
Summary
Delete a file from the MetaDefender Vault storage. This API will only mark the file for deletion. The file will be physically deleted by the background worker.
Permissions Restrictions
Administrators can delete any file, including other user's files. Users can only delete their own files.
Successful response
Move A File
Summary
This API allows moving one or multiple files in MetaDefender Vault.
Successful response
Rename A File
Summary
This API allows renaming a file in MetaDefender Vault.
Successful response
Query File status
Summary
This API lets you query the current status of a file in MetaDefender Vault.
OK
Enumerate Files
Summary
Retrieve a list of the user's files.
OK
Delete Multiple Files
Summary
Delete a group of files from the MetaDefender Managed File Transfer storage. This API will only mark the files for deletion. The files will be physically removed by a background worker.
Permissions Restrictions
Administrators can delete any file, including other user's files. Users can only delete their own files.
OK
Get file tags
This API endpoint, provides a list of {file_id} file's tags
Successful response
Add/Modify file tags
This API endpoint, allows user to modify file tags
Successful response
User Management
Overview
Manage users inside MetaDefender Vault.
Modify a guest account
This API endpoint, allows the user to remove guest account.
Successful response
Create a guest account
This API endpoint, allows user to create guest account
Successful response
Enumerate accounts
This API endpoint, with the {type} parameter supporting options like local, external, guest, or active directory, provides a response containing a list of accounts.
Successful response
Create an account
This API endpoint, allows user to create an account
Successful response
Modify an account
This API endpoint, allows user to modify an account
Successful response
Delete account(s)
This API endpoint, allows the removal of a user account, permanently erasing associated data and terminating access.
Successful response
Get account details
This API endpoint, allows user to get an account's detailed info
Successful response
Archive Download
Overview
These APIs enable downloading of multiple files or folders as an archive from MetaDefender Vault.
Workflow
In order to start the process please follow these steps:
- Create an archive by calling Create Archive
- Wait until the archive is created by polling Get Archive Status
- Once the archive is available, you can obtain it by calling Download Archive
Error Handling
If an error prevents you from downloading the archive or you simply wish to stop the process or discard the archive, you can call Cancel Archive Download. Please note that it’s not mandatory to call this endpoint after a successful download because there is an automatic cleanup mechanism that will remove archives after they are downloaded.
Cancel Archive Download
Summary
This API allows the cancelation of a previously created archive.
Successful response
Create Archive
Summary
This API allows creating an archive containing multiple folders and files from MetaDefender Vault. This API will only initiate the archiving process, you need to use Get Archive Status to obtain the status of the archiving process and then download it.
OK
Download Archive
Summary
This API downloads an archive from MetaDefender Vault.
Successful response
Get Archive Status
Successful response
Audit Events
Overview
View and export audit events.
Enumerate Audit Events
Successful response
Export Audit Events
Successful response
File Upload
Workflow
To upload one or more files in chunks to MetaDefender Vault , follow the workflow below:
- Create a transfer group by calling Initialize Group Transfer
- Create a file transfer by calling Initialize File Transfer
- Upload file chunks by calling Upload file chunk until the complete file is uploaded
- Call Complete File Transfer to commit the uploaded file in MetaDefender Vault .
- Repeat step 2 - 4 to upload additional files in the same group.
- Call Complete Group Transfer to commit the transfer in MetaDefender Vault and make it available for download.
Error Handling
During steps 3 to 5, it is possible to delete a partially/completely uploaded file by calling Delete File From File Transfer
During steps 2 to 5, it is possible to delete a group transfer (including any uploaded files) by calling Delete Group Transfer
Initialize group transfer
Permissions Restrictions
Even if the current API method is open to multiple user roles (i.e. Administrator and User), only the Administrator has a full set of permissions.
Administrators can impersonate users, or even other administrators.
For the User role, the permissions apply an even more strict rules set: they can only upload files in their own account - they don't have any impersonation rights. Although it's not something that applies directly to the current API method, it is worth mentioning that after a transfer has been started (i.e. this method has been called successfully), the other transfer methods (e.g. Init file transfer, Patch file, Complete File, etc.) will only be accessible to the user that has initiated the transfer (the one who's API key was used to make this request). No other user can alter a transfer that's in progress.
Successful response
Complete group transfer
Permissions Restrictions
The API is limited to the user roles listed above (i.e. CO, Administrator, User), but assuming that a valid set of parameters is provided, including a group_id, only the transfer owner will be able alter the transfer.
Example:
The user test1 initiates a group transfer (i.e. calls /transfer successfully) and it receives a transfer group ID - group_id.
The user test2 tries to append a file to transfer with ID group_id. A 403 - Forbidden error will be returned stating that the user that has made the request is not authorized to alter the transfer.
The user test1 tries to append a file to the transfer - operation successful.
The user test1 completes the transfer by calling POST /transfer - operation successful.
Transfer with ID group_id will be accessible to the user until its expiration date.
Successful response
Delete Group Transfer
Permissions Restrictions
The API is limited to the user roles listed above (i.e. CO, Administrator, User), but assuming that a valid set of parameters is provided, including a group_id, only the transfer owner will be able alter the transfer.
Example:
The user test1 initiates a group transfer (i.e. calls /transfer successfully) and it receives a transfer group ID - group_id.
The user test2 tries to append a file to transfer with ID group_id. A 403 - Forbidden error will be returned stating that the user that has made the request is not authorized to alter the transfer.
The user test1 tries to append a file to the transfer - operation successful.
The user test1 completes the transfer by calling POST /transfer - operation successful.
Transfer with ID group_id will be accessible to the user until its expiration date.
Successful response
Initialize File Transfer
Permissions Restrictions
The API is limited to the user roles listed above (i.e. CO, Administrator, User), but assuming that a valid set of parameters is provided, including a group_id, only the transfer owner will be able alter the transfer.
Example:
The user test1 initiates a group transfer (i.e. calls /transfer successfully) and it receives a transfer group ID - group_id.
The user test2 tries to append a file to transfer with ID group_id. A 403 - Forbidden error will be returned stating that the user that has made the request is not authorized to alter the transfer.
The user test1 tries to append a file to the transfer - operation successful.
The user test1 completes the transfer by calling POST /transfer - operation successful.
Transfer with ID group_id will be accessible to the user until its expiration date.
Successful response
Complete file transfer
Permissions Restrictions
The API is limited to the user roles listed above (i.e. CO, Administrator, User), but assuming that a valid set of parameters is provided, including a group_id, only the transfer owner will be able alter the transfer.
Example:
The user test1 initiates a group transfer (i.e. calls /transfer successfully) and it receives a transfer group ID - group_id.
The user test2 tries to append a file to transfer with ID group_id. A 403 - Forbidden error will be returned stating that the user that has made the request is not authorized to alter the transfer.
The user test1 tries to append a file to the transfer - operation successful.
The user test1 completes the transfer by calling POST /transfer - operation successful.
Transfer with ID group_id will be accessible to the user until its expiration date.
Successful response
Delete File From File Transfer
Permissions Restrictions
The API is limited to the user roles listed above (i.e. CO, Administrator, User), but assuming that a valid set of parameters is provided, including a group_id, only the transfer owner will be able alter the transfer.
Example:
The user test1 initiates a group transfer (i.e. calls /transfer successfully) and it receives a transfer group ID - group_id.
The user test2 tries to append a file to transfer with ID group_id. A 403 - Forbidden error will be returned stating that the user that has made the request is not authorized to alter the transfer.
The user test1 tries to append a file to the transfer - operation successful.
The user test1 completes the transfer by calling POST /transfer - operation successful.
Transfer with ID group_id will be accessible to the user until its expiration date.
Successful response
Upload File Chunk
Permissions Restrictions
The API is limited to the user roles listed above (i.e. CO, Administrator, User), but assuming that a valid set of parameters is provided, including a group_id, only the transfer owner will be able alter the transfer.
Example:
The user test1 initiates a group transfer (i.e. calls /transfer successfully) and it receives a transfer group ID - group_id.
The user test2 tries to append a file to transfer with ID group_id. A 403 - Forbidden error will be returned stating that the user that has made the request is not authorized to alter the transfer.
The user test1 tries to append a file to the transfer - operation successful.
The user test1 completes the transfer by calling POST /transfer - operation successful.
Transfer with ID group_id will be accessible to the user until its expiration date.
Successful response
Folder Management
Overview
These APIs enable developers to check information about folders in MetaDefender Vault.
Delete A Folder
Summary
Delete a folder from the MetaDefender Vault storage. This API will only mark the folder for deletion. The folder will be physically deleted by the background worker.
Permissions Restrictions
Administrators can delete any folder, including other user's folders. Users can only delete their own folders.
Successful response
Delete Multiple Folders
Summary
Delete a group of folders from the MetaDefender Vault storage. This API will only mark the folders for deletion. The folders will be physically removed by a background worker.
Permissions Restrictions
Administrators can delete any folder, including other user's folders. Users can only delete their own folders.
Successful response
Enumerate Folder Content
Summary
Retrieve a list of the user's files.
Successful response
Folder Search
Summary
Retrieve a list of the user's folders and files starting from a specified folder and filtered by a search string.
Successful response
Get Root Folder
Summary
List information about the 'root' folder.
Successful response
Move Folders
Summary
This API allows moving one or multiple folders in MetaDefender Vault.
Successful response
Rename A Folder
Summary
This API allows renaming a folder in MetaDefender Vault.
Successful response
Conflict
Create A Folder
Summary
This API allows creating a folder in MetaDefender Vault.
Successful response
Bad Request
Conflict
Default
Version
Successful response