Introduction
In this article, you will see how to use the SSIS REST API Task to get the file size without actually downloading it.
Prerequisites
Before we look into the Step-By-Step section to get the file size from the URL, let’s make sure you meet the following requirements.
- SSIS designer installed. Sometimes it is referred to as BIDS or SSDT (download it from the Microsoft site).
- Basic knowledge of SSIS package development using Microsoft SQL Server Integration Services.
- ZappySys SSIS PowerPack installed. Click on the link to download.
Configure SSIS REST API Task to Get file size from URL
Now, let’s look at how to get the file size from a URL
- Open the SSIS Package and go to the Control Flow designer
- Create a new SSIS variable called ContentSizeInBytes
- Drag and drop the ZS REST API Task from the SSIS Toolbox
- Double-click the API Task to configure. Enter following
- Enter the File URL you’d like to download
- Change the default method from GET to HEAD
- Click Test. Review Content-Length header in Response. That’s what we need to save to the Variable.
- Now go to the Response Settings tab as below and Configure the Content-Length Header mapping. If it’s not showing in the Grid, most likely your Web Server doesn’t support the HEAD command, and you may need to use another method. For now, we will assume that just like most Web Servers, your API also supports the HEAD command.
- Here is the screenshot of the actual configuration on the Response Tab





