How to use Salesforce Marketing Cloud API to connect with my SQL server

How to use Salesforce Marketing Cloud API to connect with my SQL server database. I need to use C# to do HTTP POST request to acquire an access token, but I have no idea how to do it. I need to run this sample code in C#:

POST https://auth.exacttargetapis.com/v1/requestToken
Content-Type: application/json
{
  "clientId": "gyjzvytv7ukqtfn3x2qdyfsn",
  "clientSecret": "************"
}

I am using SSIS 2008r2, I want to write c# code to make an api call to the exact Target API to connect to SQL server database. Because I want to pull data from SQL server to marketing cloud. I didn't find any article about using SSIS to connect Marketing cloud.....the salesforce marketing cloud rest API or FuelSDK looks like only support .net 4 or higher....

Answers


There is an SDK available for the marketing cloud in C#. Start here: https://code.exacttarget.com/apis-sdks/fuel-sdks/csharp/getting-started-with-the-csharp-sdk.html


This works for me. Move the clientId and client secret to web.config at some point.

    public static async Task<string> getAuth()
    {
        var clientId = "asdfasdfasdfasdfasdfasdf";
        var clientSecret = "asdfasdfasdfasdfasdf";
        using (var client = new HttpClient())
        {
            var values = new Dictionary<string, string>
            {
                {"clientId", clientId},
                {"clientSecret", clientSecret}
            };

            var content = new FormUrlEncodedContent(values);

            var response = await client.PostAsync(string.Format("https://auth.exacttargetapis.com/v1/requestToken"), content);

            var responseString = await response.Content.ReadAsStringAsync();
            return responseString;
        }
    }

Need Your Help

How to clear the memory in C?

c arrays pointers srand

I have written a program to generate a random string,