In this article you will see how to use SSIS REST API Task to get file size without actually downloading it.
Before we look into Step-By-Step section to get file size from URL let’s make sure you met following requirements.
- SSIS designer installed. Sometimes it is referred as BIDS or SSDT (download it from 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 lets look at how to get file size from URL
- Open SSIS Package and goto Control Flow designer
- Create new SSIS variable call it ContentSizeInBytes
- Drag and drop ZS REST API Task from SSIS Toolbox
- Double click API Task to configure. Enter following
- Click Test. Review Content-Length header in Response. That’s what we need to save to Variable
- Now go to Response Settings tab as below and Configure Content-Length Header mapping. If its not showing in the Grid then most likely your Web Server doesn’t support HEAD command and there may be some other method you have to use. For now we will assume just like most of Web Servers your API also supports HEAD command.
- Here is the screenshot of actual configuration on Response Tab