How to Download file using Titan API
Question:
How can I download a file using the Titan API?
Reasoning
Administrators and developers may need to retrieve files programmatically from Titan for automation, integration, or testing purposes. The Titan API provides an endpoint that allows authenticated users to download files directly from a configured file storage location.
Answer
You can download files using the /Api/Files/Download/{FileId} endpoint available through the Titan API Swagger interface or by issuing a direct API request using tools such as PowerShell or cURL.
Steps
- Open a web browser.
- Navigate to:
https://localhost:41443/swagger/index.html - Change the Admin URL from
localhost:41443tolocalhost. - Click Authorize.
- Enter your user credentials and authenticate.
- Expand the Files section.
- Locate the endpoint:
/Api/Files/Download/{FileId}- Download File - Click Try it out.
- Set the following parameters:
- FileId: Specify the file name to download (for example: sampletext.txt).
- fileType: Specify the file type or virtual folder (for example:
myfiles).
- Click Execute.
Testing Using the Request URL
Copy the generated Request URL.
Open a new browser tab.
Paste the URL into the address bar and browse to it.
If prompted, log in using your user credentials.
The file should begin downloading.
Note: If you do not want to authenticate manually in the browser, you can include the username and password in the URL.
example:
https://username:password@localhost/api/Files/Download/sampletext.txt?fileType=myfiles
Testing Using PowerShell
Copy the generated cURL command from the Swagger page.
Modify the command if necessary to run in PowerShell.
Example:
curl.exe -k --digest `
"https://localhost/api/Files/Download/sampletext.txt?fileType=myfiles" `
-H "Authorization: Basic dGVzdDoxMjM=" `
-o "titansftp_2.0.26.2465.exe"
- Execute the command in PowerShell.
- Verify that the requested file is successfully downloaded.