Providing you are a LUSID user with sufficient privileges, you can upload files to Drive and perform standard file management operations on those files.
Note: If you are the LUSID domain owner, you are automatically assigned the built-in lusid-administrator role, which has all the permissions necessary to perform the operations in this article. To see how to grant other users permission to use Drive, follow this tutorial.
Note the following:
Files uploaded to Drive, and folders you create to organise files within Drive, must have names between 1 and 50 characters long, consisting of alphanumeric, dash (-) or underscore (_) characters only.
Files cannot be empty, nor larger than 2GB.
You can interact with Drive graphically in the LUSID web app, or programmatically using the Drive API.
Using the LUSID web app
To upload a file:
Sign in to the LUSID web app using the credentials of a LUSID administrator.
From the left-hand menu, select Data Management > Drive:
On the Drive dashboard, click the Upload file button (top right), and follow the instructions:
You can perform standard file management operations from the Drive dashboard. For example, you can:
Create folders using the Create folder button (top right).
Download a file (not a folder) by clicking the Actions icon for a file row to open its shortcut menu.
Rename a file or folder. Note names are classed as metadata on the underlying object.
Copy link to share a file or folder by copying a URL to the Clipboard. Note recipients must be users in your LUSID domain with suitable permissions to use Drive.
Move a file (not a folder). Note you can bulk move by selecting file rows and choosing Move from the Choose action dropdown (above the rows):
Using the Drive API
To upload a file:
Call the CreateFile API, passing in your API access token and the following parameters (see comments for details):
curl -X POST "https://<your-domain>.lusid.com/drive/api/files" -H "Authorization: Bearer <your-access-token>" -H "Content-Type: application/octet-stream" -H "x-lusid-drive-filename: trade-file.csv" # This is the name of the file as you want it to appear in Drive -H "x-lusid-drive-path: /Instruments" # This is the intended folder location in Drive; "/" signifies the root folder -H "Content-Length: 2220" # This is the file size in bytes; it must be accurate --data-binary @my-trade-file.csv # This is the path to the local file you want to upload
The response contains an automatically-generated id that uniquely identifies the file in Drive:
{ "id": "aab46045-df2f-4446-a6e3-6af269d9c26f", "path": "/Instruments", "name": "trade-file.csv", "createdBy": "00u91lo2d7X46sdse2p7", "createdOn": "2021-07-16T14:27:41.5827803+00:00", "updatedBy": "00u91lo2d7X46sdse2p7", "updatedOn": "2021-07-16T14:27:41.5827803+00:00", "type": "File", "size": 2220, "status": "Active", ... }
Note you can search for a particular file or folder using the Search API. If no path is specified, the root folder is searched recursively. All the metadata required to interact with object(s) is returned in the response.
Note also that the following Drive API endpoints support result filtering:
GetRootFolder - List the contents of the root folder
GetFolderContents - List the contents of a particular folder
Search- Search for a particular file or folder
Automatic virus scanning
Every file uploaded to Drive, or whose content is modified whilst stored in Drive, is automatically scanned for malware. Note the following scan stages:
Stage | Implication | File state or error code |
Virus scan in progress | You cannot download a file while a scan is in progress. | 716 VirusScanInProgress |
Malware detected | You can see the file in the list of files and delete it as normal but you cannot download a file containing malware. The response body of the API call contains the reason. | 715 MalwareDetected |
Virus scan passed | The file is clean and ready to use. | Available |
Virus scan failed | The scan could not be performed. | Failed |