SSIS HTTP Connection and Script Task to consume RESTful Services API

I am trying to connect to a RESTful API using SSIS.  I have an HTTP Connection Manager with the URL and the username and password to gain access to the API.  The problem comes when I am trying to insert variables into the URL to determine the date range.  I am using a Task Script component to try to by pass the url in the Connection Manager and insert the variables into the URL.  I am attaching the code I am using and the error I get.  The error only comes when I try to run the SSIS package.  

public void Main()
		{
            // Get the unmanaged connection object, from the connection manager called "HTTP Connection Manager"
            object nativeObject = Dts.Connections["HTTP Connection Manager"].ConnectionString = ("https://api.apisource.com:8182/api/fleets/young/platforms/311305/data?descriptions=true&values=true&parameterId=10245&startTime=" + ((DateTime)Dts.Variables["startTime"].Value) + "&endTime=2015-09-09&maxCount=1000&startPort=-1&resolution=all");

            // Create a new HTTP client connection
            HttpClientConnection connection = new HttpClientConnection(nativeObject);

            // Download the file #1
            // Save the file from the connection manager to the local path specified
            string filename = "C:\\Temp\\Sample.txt";
            connection.DownloadFile(filename, true);

            // Confirm file is there
            if (File.Exists(filename))
            {
                MessageBox.Show(string.Format("File {0} has been downloaded.", filename));
            }


            // Download the file #2
            // Read the text file straight into memory
            byte[] buffer = connection.DownloadData();
            string data = Encoding.ASCII.GetString(buffer);

            // Display the file contents
            MessageBox.Show(data);


			
			Dts.TaskResult = (int)ScriptResults.Success;
		}
		}

Open in new window

LVL 5
rtayIT DirectorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rtayIT DirectorAuthor Commented:
Interesting......I have noticed if you ask a question, get a response, but spend more than a day or two working through the solution to see if it works you get hounded and yelled at so points are assigned.  But, if you ask a question and get no response or suggested solutions at all.......crickets.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rtayIT DirectorAuthor Commented:
Thank you all!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Components

From novice to tech pro — start learning today.