The Bulk API allows users to export large volumes of data including Contact and Account records. It makes it easy to filter your data using a Segment or retrieve the contents of a List. You can also manipulate the data as part of the export, for example you could subscribe a group of contacts, mark them active in a campaign and do much more...

 

In this series, we'll look at the 4 steps necessary to complete the export and we'll share some sample code to help you along.

(The code samples are available here on Github)

 

Steps :

  1. Setup
  2. Create the Export Structure (define fields, filter, etc...)
  3. Start and Poll the Status
  4. Get the Data

 

After going through step 1, you'll be able to define :

  • export filter : how to filter to the results (segment, filter, list)
  • field list : field collection that will be used in the import

 

ExportFilter filter = new ExportFilter
                                      {
                                          filterRule = FilterRuleType.member,
                                          membershipUri = "/contact/filter/123"
};





 

Dictionary<string,stirng>fields= new Dictionary<string,string>
                             {
                                 {"C_EmailAddress", "{{Contact.Field(C_EmailAddress)}}"},
                                 {"C_FirstName", "{{Contact.Field(C_FirstName)}}"},
                             };






These will be used in the definition of the Export :

 

public string CreateExport(Dictionary<string,string>fields,stringdestinationUri,ExportFilterfilter)
        {
            Export export = new Export
                                {
                                    name = "sample export",
                                    fields = fields,
                                    filter = filter,
                                    secondsToAutoDelete = 3600,
                                    secondsToRetainData = 3600,
                                    syncActions = new List<SyncAction>
                                    {
                                         action = SyncActionType.add,
                                         destinationUrl = destinationUrl
                                    }

                                };

            RestRequest request = new RestRequest(Method.POST)
                                      {
                                          Resource = "/contact/export",
                                          RequestFormat = DataFormat.Json,
                                          RootElement = "export"
                                      };
            request.AddBody(export);

            IRestResponse<Export> response = _client.Execute<Export>(request);
            Export returnedExport = response.Data;

            return returnedExport.uri;
        }






 

Each step will be accompanied by a post describing the details and including code samples to help perform the operations. Please see the following post if you're interested in Using the Bulk API to Import Contacts.

 

We've shared a helper project on Github.

Please note that this is my own work and I'll do my best to support them, but it is not supported by Eloqua.

 

Thanks,

Fred