resteloqua

Globally unsubscribe contact from eloqua with BULK or REST API 2.0


I just wants to know if any URI available in eloqua to globally unsubscribe Email contact from all eloqua groups,

Right now i am iterating groups and unsubscribing them one by one,

if there is any way to do it more easily than this because it is so time consuming, also checked the new reference page (https://secure.eloqua.com/api/docs/Dynamic/Rest/2.0/Reference.aspx) there also there no URI for this...

Please help me in this, Thanks in advance.


Solution

  • [Found the answer for this, may be this will help others.]

    Using the Bulk API, I was able to unsubscribe contacts globally by setting the {{Contact.Email.IsSubscribed}} field. I am not entirely sure if this is the right way to do it. But it works fine!

    Here's the C# sample code:

    // Define the list of fields that will be used in the data import
    Dictionary<string, string> fields = new Dictionary<string, string>
    {
        {"C_EmailAddress", "{{Contact.Field(C_EmailAddress)}}"},
        {"C_FirstName", "{{Contact.Field(C_FirstName)}}"},
        {"C_LastName", "{{Contact.Field(C_LastName)}}"},
        {"C_IsSubscribed", "{{Contact.Email.IsSubscribed}}"}  // The Global Unsubscription field
    };
    
    // Create the definition (structure) of the import
    var importUri = _contactImportHelper.CreateImportStructure(fields);
    
    // Contact data to be imported
    Dictionary<string, string> data1 = new Dictionary<string, string>
    {
       {"C_EmailAddress", "test1@test.com"},
       {"C_FirstName", "Test1First"},
       {"C_LastName", "Test1Last"},
       {"C_IsSubscribed", "false"}
    };
    Dictionary<string, string> data2 = new Dictionary<string, string>
    {
       {"C_EmailAddress", "test2@test.com"},
       {"C_FirstName", "Test2First"},
       {"C_LastName", "Test2Last"},
       {"C_IsSubscribed", "true"}
    };
    
    List<Dictionary<string, string>> list = new List<Dictionary<string, string>>
    {
       data1,
       data2
    };
    
    Sync sync = _contactImportHelper.ImportData(importUri, list);  
    

    Below is the Link: https://community.oracle.com/thread/3655521
    Read Seema menon answer.