Reputation: 1
I am a newbie in C#. So for an etl, I am using SSIS component to fetch the data fusing API key and combine the fetched data with data from other sources.
So I am using the SSIS 'Script Component' to fetch the API data using the below code{
public override void CreateNewOutputRows()
{
string url = String.Format(<url>);
WebRequest requestObject = WebRequest.Create(url);
requestObject.Credentials = new System.Net.NetworkCredential("username", "password");
requestObject.Method = "GET";
HttpWebResponse responseObject = null;
responseObject = (HttpWebResponse)requestObject.GetResponse();
string result = null;
using (Stream stream = responseObject.GetResponseStream())
{
StreamReader sr = new StreamReader(stream);
result = sr.ReadToEnd();
sr.Close();
}
var serializer = new JavaScriptSerializer();
var data = serializer.Deserialize<ResultApi>(result);// ResultApi class
Output0Buffer.AddRow();
Output0Buffer.Names = data.Names;
and my <resultApi>
class is as below:
class ResultApi
{
public string Names { get; set; }
}
I don't know what I am doing wrong but when running the SSIS package, I am getting the below error:
It would a great help if someone can help me with this. Any advice or suggestion is appreciated.
Upvotes: 0
Views: 238