Exporting activities

The following steps show how to export activities from Eloqua. The same process can be used for any activity export by changing the filter and fields definitions. See our Activities export definitions page for a complete list.

All exports follow the same basic flow:

  1. Define the export
  2. Create the sync
  3. Retrieve the data

To export activities using the Bulk API:

1. Define the export

In order to export email open activities, first create an export definition. This defines the data to be exported including any required filters. For this example we will use the email open activity to demonstrate the process.

Important:
  • There is a maximum of 5 million records per Activity export sync. If necessary, you'll need to use a date/time filter to reduce the number of records exported to below 5 million. Activity volume can be checked using Insight reports. No filter is needed if there are fewer than 5 million records. Learn more about Bulk filtering.
  • There is a maximum of 10 contact fields allowed in an activity export definition. The addition of contact fields to activity exports will add to export time.
  • Contact fields cannot be used in the filter.
  • Bouncebacks are recorded asynchronously, which means the Bulk API Activity Created Date (when the bounceback occurred), may not be available to export until hours or days after the bounceback occurred. The upper date limit for a filter should be at least one hour before the time of Bulk API sync creation to ensure the majority of bouncebacks have been recorded.

This example uses a filter to export one month of data: in this case April 2015. Be sure to filter to a smaller time-frame if you think this may still return more than 5 million records:
"filter": "'{{Activity.Type}}'='EmailOpen' AND '{{Activity.CreatedAt}}'>= '2015-04-01' AND '{{Activity.CreatedAt}}' < '2015-05-01'"

Once you created an appropriate filter, create a new activity export definition. For this example, we will include all possible email open activity fields, however you only need to use fields whose values you need to export.

Request:

POST /activities/exports

Request body:

{
  "filter": "'{{Activity.Type}}'='EmailOpen'",
  "name": "Bulk Activity Export - Email Open",
  "fields": {
    "ActivityId": "{{Activity.Id}}",
    "ActivityType": "{{Activity.Type}}",
    "ActivityDate": "{{Activity.CreatedAt}}",
    "ContactId": "{{Activity.Contact.Id}}",
    "IpAddress": "{{Activity.Field(IpAddress)}}",
    "VisitorId": "{{Activity.Visitor.Id}}",
    "VisitorExternalId": "{{Activity.Visitor.ExternalId}}",
    "EmailRecipientId": "{{Activity.Field(EmailRecipientId)}}",
    "AssetType": "{{Activity.Asset.Type}}",
    "AssetName": "{{Activity.Asset.Name}}",
    "AssetId": "{{Activity.Asset.Id}}",
    "SubjectLine": "{{Activity.Field(SubjectLine)}}",
    "EmailWebLink": "{{Activity.Field(EmailWebLink)}}",
    "CampaignId": "{{Activity.Campaign.Id}}",
    "ExternalId": "{{Activity.ExternalId}}",
    "DeploymentId": "{{Activity.Field(EmailDeploymentId)}}",
    "EmailSendType": "{{Activity.Field(EmailSendType)}}",
    "EmailAddress": "{{Activity.Field(EmailAddress)}}",
    "ContactIdExt": "{{Activity.Contact.Field(ContactIDExt)}}"
  }
}

When the above export definition is POSTed to /activities/exports an export definition is created. Eloqua responds with the following:

Response body:

{
  "name": "Bulk Activity Export - Email Open",
  "fields": {
    "ActivityId": "{{Activity.Id}}",
    "ActivityType": "{{Activity.Type}}",
    "ActivityDate": "{{Activity.CreatedAt}}",
    "ContactId": "{{Activity.Contact.Id}}",
    "IpAddress": "{{Activity.Field(IpAddress)}}",
    "VisitorId": "{{Activity.Visitor.Id}}",
    "VisitorExternalId": "{{Activity.Visitor.ExternalId}}",
    "EmailRecipientId": "{{Activity.Field(EmailRecipientId)}}",
    "AssetType": "{{Activity.Asset.Type}}",
    "AssetName": "{{Activity.Asset.Name}}",
    "AssetId": "{{Activity.Asset.Id}}",
    "SubjectLine": "{{Activity.Field(SubjectLine)}}",
    "EmailWebLink": "{{Activity.Field(EmailWebLink)}}",
    "CampaignId": "{{Activity.Campaign.Id}}",
    "ExternalId": "{{Activity.ExternalId}}",
    "DeploymentId": "{{Activity.Field(EmailDeploymentId)}}",
    "EmailSendType": "{{Activity.Field(EmailSendType)}}",
    "EmailAddress": "{{Activity.Field(EmailAddress)}}",
    "ContactIdExt": "{{Activity.Contact.Field(ContactIDExt)}}"
  },
  "filter": "'{{Activity.Type}}'='EmailOpen'",
  "dataRetentionDuration": "PT12H",
  "uri": "/activities/exports/1560",
  "createdBy": "API.User",
  "createdAt": "2017-08-09T16:22:09.0434041Z",
  "updatedBy": "API.User",
  "updatedAt": "2017-08-09T16:22:09.0434041Z"
}

In the above response the URI /activities/exports/1560 is used to trigger the export sync. Be sure to save this value for the following steps.

2. Create the sync

Using the URI value from step 1 (in this case /activities/exports/1560) we can now create a sync. To do so, submit a POST request with the URI passed as the syncedInstanceUri value:

Request:

POST /syncs

Request body:

{
  "syncedInstanceUri": "/activities/exports/1560"
}

A response is then received and the sync is now queued to be automatically run.

Response body:

{
  "syncedInstanceUri": "/activities/exports/1560",
  "status": "pending",
  "createdAt": "2017-08-09T16:22:09.0434041Z",
  "createdBy": "API.User",
  "uri": "/syncs/5744"
}

The status of the export can be checked by performing a GET on the URI of the sync. In this case, /syncs/5744.

When the export is complete, the status value will be "success":

{
  "syncedInstanceUri": "/activities/exports/1560",
  "syncStartedAt": "2017-08-24T20:54:03.8330000Z",
  "syncEndedAt": "2017-08-24T20:54:05.6630000Z",
  "status": "success",
  "createdAt": "2017-08-09T16:22:09.0434041Z",
  "createdBy": "API.User",
  "uri": "/syncs/5744"
}

3. Retrieve the data

The data can now be retrieved by performing a GET on the URI's /data endpoint, in this case /syncs/5744/data.

Request:

GET /syncs/5744/data

By default this will return the first 1,000 records exported. In order to refine your data selection learn more about URL parameters.