Hi @Anonymous ,
public void Main()
{
try
{
string serviceUrl = Dts.Variables["$Project::ServiceUrl"].Value.ToString();
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(serviceUrl);
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
decimal amount = 1200.50m;
long tranactionID = 1001;
string APIUrl = string.Format(serviceUrl + "/ProcessManager/ProcessData?amount={0}&transactionID={1}", amount, tranactionID);
var response = client.GetAsync(APIUrl).Result;
if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsAsync<Response>().Result;
if (result.IsSucess)
{
//TODO update your database based on the result
}
Dts.TaskResult = (int)ScriptResults.Success;
}
}
catch (Exception ex)
{
Dts.TaskResult = (int)ScriptResults.Failure;
}
}
Hope the following links will be helpful:
1.How To Consume Web API Through SSIS Package
2.Download source file from website with SSIS
Best Regards,
Mona
----------
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hot issues in November--What can I do if my transaction log is full?
Hot issues in November--How to convert Profiler trace into a SQL Server table?