How to download file from URL using SSIS

Introduction

In this post, we will see how to download a file from a URL using the SSIS REST API Task. If you want to call the REST API instead of downloading a file, check this article.

Basically, you can download a file from a URL using two different tasks.

SSIS Download File Task offers a simple way to download a file without advanced settings (e.g. Specify OAuth Credentials, Headers, Body, Content Type, etc)

The SSIS REST API Task offers a much more robust way to download, including specifying OAuth credentials, Basic Credentials, Headers, Body, changing the SSL/TLS Protocol version, specifying a Proxy, and setting Error Retry Settings, etc.

Prerequisites

Before we download a file from a URL using SSIS, you will need to make sure the following prerequisites are met.

  1. SSIS designer installed. Sometimes it is referred to as BIDS or SSDT (download it from the Microsoft site).
  2. Basic knowledge of SSIS package development using Microsoft SQL Server Integration Services.
  3. Make sure SSIS PowerPack is installed. Click here to download.

Method-1 (Preferred): Download file from URL using REST API Task

Download from Public Page (No Login required)

  1. Create a new SSIS Package and open the designer
  2. Drag ZS REST API Task from SSIS Toolbox (Control Flow)
  3. Double-click it to edit
  4. Enter the following URL

    SSIS REST API Task – Download File from URL (Request Settings)

  5. Now go to the Response Settings Tab
  6. Check the Save Response Content option
  7. Select Save Mode = Save to file
  8. Specify target file path (e.g., c:\ssis\nw.zip )
  9. Check the Treat response as a binary option. This option must be checked if the file is binary format (e.g., image, mp3, avi, zip)

    SSIS REST API Task – Download Zip File from URL (Response Settings)

  10. Click OK to save and Execute SSIS Package.

Using Credentials to download from Secure Page

There will be a time when you have to download from a secure page which requires some sort of Authentication information. REST API Task Support Download URL From Connection option.  You can use HTTP Connection or OAuth Connection

Using HTTP Connection in SSIS REST API Task to Download Files or Other Data

Method-2: Download file from URL using Download File Task

  1. Create new SSIS Package and open designer
  2. Drag ZS Download File Task from SSIS Toolbox (Control Flow)
  3. Double click it to edit
  4. Change Url Access Mode to Direct
  5. Enter the following URL
  6. In the target set target file path (e.g. c:\ssis\nw.zip )
  7. Click OK to save and Execute SSIS Package.

    SSIS Download File Task – Download File from URL

Advanced Scenarios (Data Flow)

In addition to downloading files in Control Flow using the REST API Task or Download File Task, you can now also download binary files (PDF, image, ZIP, etc.) dynamically inside SSIS Data Flow using the Web API Destination component.
For a detailed step-by-step tutorial that shows how to handle binary responses and write them to disk per row in Data Flow, check out this community article:
👉 How to Download Binary File (PDF, Image, ZIP) from URL in SSIS Data Flow using Web API Destination — click here

Posted in SSIS Download File Task, SSIS REST API Task.