Waiting for engine...
Skip to main content

Downloading Files using the MFT Content API

This topic describes how to download files using our REST API.

The process involves two main steps:

  1. Retrieving file details using a report ID.
  2. Constructing the download URL using the obtained information.

Prerequisites

Before downloading a file, you need the following:

  • A valid report ID
  • The flow endpoint ID
  • API access credentials (if required)

To download Files using the MFT AFT Content API:

Step 1: Get File Details

Retrieve the file details using the report ID.

File details endpoint

GET <https://us.thruinc.com/api/Activity/getFileDownloadHistory>

Required parameters

  • reportId: The unique identifier for the report (For example, 677e882e01402bc727b075b4)
  • flowEndpointType: Set to 1 for standard downloads

Example request

<https://us.thruinc.com/api/Activity/getFileDownloadHistory?reportId=677e882e01402bc727b075b4&flowEndpointType=1>

Step 2: Download the File

Once you have the file details, construct the download URL using the following format.

Download endpoint

GET <https://us.thruinc.com/api/Files/1.0/{reportId}/content>

Required parameters

  • reportId: The same report ID used in Step 1
  • endpointPath: Specifies the flow endpoint in the format flowendpoint:{endpointId}

Example Download URL

<https://us.thruinc.com/api/Files/1.0/677e882e01402bc727b075b4/content?endpointPath=flowendpoint:15938>

Complete example

  1. Start with a report ID: 677e882e01402bc727b075b4
  2. Get file details using the File Details Endpoint
  3. Use the report ID and endpoint ID to construct the download URL
  4. Send a GET request to the download URL to retrieve the file

Error handling

Common HTTP status codes you might encounter:

  • 200: Successful download
  • 400: Bad request (check parameters)
  • 401: Unauthorized (check credentials)
  • 404: File not found
  • 500: Server error

Best practices

  • Always validate the report ID before constructing the download URL
  • Handle large file downloads appropriately by implementing timeout handling
  • Consider implementing retry logic for failed downloads
  • Cache file details when making multiple downloads of the same file

Security considerations

  • Keep your API credentials secure
  • Validate all input parameters
  • Implement rate limiting if making multiple requests
  • Check file permissions before attempting downloads
On this Page