Skip to main content
Mitratech Success Center

Client Support Center

Need help? Click a product group below to select your application and get access to knowledge articles, webinars, training content, and release notes or to contact our support team.

Authorized users - log in to create a ticket, view tickets status and check your success plan details.

 

Download Documents via the TAP API

Steps to Download Documents via the TAP API - GET Download by ID

Introduction

Follow these steps to help customers download documents from their system via the TAP API. This process allows customers to independently extract documents without relying on support for full data extracts.

Prerequisites

  1. Access Token: Ensure you have a valid access token to authenticate your API requests.
  2. File ID: Obtain the ID of the file you wish to download. 

To obtain the file ID for download, follow these steps:

  1. Get the Result Set ID:

    1. Access the workflow where the file is associated in your system.
    2. Click on ‘View History’ or ‘Edit Request’ at the bottom of the page.
    3. Check the URL for the value of ‘resultsetId=’.

Result set ID

  1. Use the Result Set ID:

    1. Copy the result set ID and paste it into the GET download by ID URL.

Get download by url​​​​​

  1. Click 'Send'.
  2. The body of the response will display the file ID.

File ID

  1. Download the File:

    1. Use this file ID to download documents using APIs.

Steps to Download Documents

  1. Generate an Access Token:

  • Endpoint: GET/v1/workflows/{resultSetId}/files 
  • Parameters:
    • grant_type
    • scope
    • redirect_uri
    • username
    • password
    • client_id
    • client_secret
  • Example Request:

curl -X POST https://{tenant}.tap.thinksmart.com/prod/auth/identity/connect/token \ -d 'grant_type=your_grant_type&scope=your_scope&redirect_uri=your_redirect_uri&username=your_username&password=your_password&client_id=your_client_id&client_secret=your_client_secret'

  • Response: The response will include an access_token.
  1. Download Document by ID:

  • Endpoint: GET/api/v1/files/{document_id}
  • Headers:
    • Authorization: Bearer {access_token}
  • Example Request:
    curl -X GET https://{tenant}.tap.thinksmart.com/prod/api/v1/files/{document_id} \ -H "Authorization: Bearer your_access_token" \ -o downloaded_document.ext
  1. Handle the Download:

  • The response will be a binary file. Use appropriate tools to handle the file based on its type (e.g., PDF, DOCX).

Detailed Steps

  1. Get Access Token:

  • Open a terminal or use a REST client (like Postman).
  • Make a POST request to the access token endpoint with the required parameters.
  • Copy the access_token from the response.
  1. Download the Document:

  • Make a GET request to the download endpoint using the file ID and the access token.
  • Save the response as a file. The -o option in curl specifies the output file.

Notes

  • Ensure your system meets security and permission requirements for API access.
  • Document IDs must be accurate to download the correct files successfully.
  • If the download fails, check the error logs for detailed information on the issue.

By following these steps, customers can independently download documents from their system using the TAP API, eliminating the need for support to provide full data extracts.

  • Was this article helpful?