Downloading a CSV from website with ADF

Menegay, Chris 1 Reputation point
2022-09-13T18:30:17.477+00:00

I've found bits of info on the web, but still no success in doing this. I'm attempting to do a POST call to the below website to download the CSV so that I can use it in a COPY activity to load it into a database. I've tried doing this directly with a COPY activity, using an HTTP dataset as a source, and also have tried as a web activity and never get a response.

https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=GEF&QO_fu146_anzr=

Using Fiddler, I came up with a Body of the below
txtSearch=&cboGeography=All&cboYear=All&cboPeriod=All&btnDownload=Download&YEAR=on&MONTH=on&AIRLINE_ID=on&UNIQUE_CARRIER=on&UNIQUE_CARRIER_NAME=on&CARRIER=on&CARRIER_NAME=on&CARRIER_GROUP=on&CARRIER_GROUP_NEW=on&EMPFULL=on&EMPPART=on&EMPTOTAL=on&EMPFTE=on

Not sure what I'm doing wrong here. Any help would be greatly appreciated.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,623 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. ShaikMaheer-MSFT 38,546 Reputation points Microsoft Employee Moderator
    2022-09-15T11:25:24.243+00:00

    Hi @Menegay, Chris ,

    Thank you for posting query in Microsoft Q&A Platform.

    Yes, you are right. If your API call is going to download a file directly, then we should use HTTP connector type dataset in Source tab of Copy activity. And Sink tab we can use destination storage dataset.

    Kindly check below video, where we make a API call which downloads file.
    Download file from API and load it in to Sink using Azure Data Factory

    I tried to issue GET request call to your below URL. Its opening a web page. It's actually not downloading anything.
    https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=GEF&QO_fu146_anzr=

    So, I feel you need to get correct API details which will downloads file on request.

    Hope this helps. Please let me know if any concerns.

    -------------

    Please consider hitting Accept Answer button. Accepted answers help community as well.


  2. Chandra Sekhar Katabathina (External) 5 Reputation points
    2023-09-25T09:54:55.73+00:00

    Hi,

    I have also same requirement, download the zip files using API,

    But I have only oauth2 token to access API, I got access_key using web activity.

    But now Im facing problem is every pipeline run new accees_key generated,
    So I need to pass this key to http linked service in Auth headers ( here it not taken any dynamic values).

    Please suggest any way to pass the access_key to http linked serves dynamically.

    Thanks,

    Chandra.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.