In this file, our goal is to create a class library that connects to an API, authenticates, retrieves JSON formatted data, and deserializes to output for use in a SSIS package. In this particular solution, I created a separate DLL for the class library which will require me to register it in the global assembly cache on the ETL server. If your environment doesn’t allow for this, you can still use some of the code snippets here to work with JSON data.
Our order of operations will be to do the following tasks: Create a web request, attach authentication headers to it, retrieve the serialized JSON data, and deserialize it into an object. I use model-view-controller (MVC) architecture to organize my code, minus the views because I am not presenting the data to a user interface.
Read on for a depiction and all of the project code. Building a separate WebAPI project to retrieve this data is usually a good move, as you gain a lot of flexibility: you can run it on cheaper hardware, schedule data refreshes, send the data out to different locations, and so on.