简体   繁体   中英

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.

This endpoint api/bulk/2.0/emailAddresses/imports

Will NOT create a contact in Eloqua, but WILL globally unsubscribe the email address. If you create a contact with this email address in the future, it will already be unsubscribed.

With a definition like this:

{
    "fields": {
        "Email": "{{EmailAddress.Field(EmailAddress)}}"
    },
    "syncActions": [
        {
            "destination": "{{GlobalSubscribe}}",
            "action": "setStatus",
            "status": "unsubscribed"
        }
    ],
    "identifierFieldName": "Email",
    "name": "Bulk Import",
    "updateRule": "always"
}

Alternatively, you can use the normal contacts/imports endpoint if you wish to create a contact and have that contact globally unsubscribed.

[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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM