cjkoester / chris.koester.io.comments

Repo issues are used as comment system for chris.koester.io blog
0 stars 0 forks source link

Download JSON Data with SSIS #6

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

Download JSON Data with SSIS | Chris Koester

Download and flatten JSON data using the SSIS script task.

https://thankful-cliff-0ea3c960f-7.eastus2.azurestaticapps.net/index.php/2017/06/06/download-json-data-with-ssis/

cjkoester commented 2 years ago

If your data source requires authentication, the comment and code below was migrated from the Wordpress version of this post, and is from a commenter named Chris Schroeder. I have not tested the code.

For basic authentication…use Postman (or something similar) to determine what your headers need to look like for the API call to work correctly. For me, it was "Authorization: Token xyz123".

Then, add something like this:

using (WebClient client = new WebClient())
{
    //add the auth header
    client.Headers.Add("Authorization", "Token ");
    client.Headers[HttpRequestHeader.ContentType] = "application / json";
    return client.DownloadString(downloadURL);
}