Przejdź do treści

Start a new export

Exports collection allows scheduling (asynchronous) exports of lists and segments. Data is exported in CSV format.

You may choose what fields will be exported (system and custom fields) by sending a POST request with different parameters.

Export status may be then checked by sending a GET request and when the export is ready, the request will return an URL to file available for download.

Request data format

Data part of request for scheduling an export.

Data element children:

Element/attributeTypeNotes
TypestringExport type. Required. Valid values are:
List – exporting subscriber list
Segment – exporting subscriber segment
ListIdintegerID of subscriber list to export. Required when Type=List. Otherwise ignored.
SegmentIdintegerID of subscriber segment to export. Required when Type=Segment. Otherwise ignored.
FieldscomplexCollection of Field elements. List of system fields to be exportd (e.g. Email, Firstname, Vendor etc). At least one field or custom property must be selected. See table below for all available system fields. 
PropertiescomplexCollection of Property elements. List of custom subscriber properties to be exported. Properties are identified by ID. See example requests below.
FileFormatstringFormat in wich report will be returned. Valid values are:
Csv
Excel

Field element children:

Element/attributeTypeNotes
(Field element content)stringSystem field name.

Property element children:

Element/attributeTypeNotes
(Property element content)intCustom property ID.

Available system fields to export:

NameDescription
IdSubscriber’s ID.
FirstNameSubscriber’s firstname.
LastNameSubscriber’s lastname.
EmailSubscriber’s email.
EmailMd5MD5 of subscriber’s email.
EmailSha256SHA256 of subscriber’s email.
CustomSubscriberIdSubscriber’s custom ID.
IPIP address subscriber used to subscribe.
VendorSubscriber’s vendor (source).
TrackingCodeTracking code subscriber used during subscription.
GeoCountrySubscriber’s country recognized from IP address using geolocation.
GeoStateSubscriber’s state/province.
GeoCitySubscriber’s city.
GeoZipCodeSubscriber’s ZIP/postal code.
LastActivityDate of last subscriber’s activity (click, open, visiting preference center etc).
LastMessageDate of last message sent to subscriber.
LastEmailDate of last email message sent to subscriber.
LastOpenEmailDate of last time subscriber opened an email message.
LastClickEmailDate of last time subscriber clicked a link in email message.
SubscriptionDateDate of subscription to a particular list (if the export type is segment, the date of the earliest subscription is used).
ConfirmationDateDate of subscription confirmation.*

*It is only valid when Doublt Opt-In list is exported. Otherwise, trying to use it will result in an „Unknown field name” error.

For customers with SMS/MMS integration enabled there are additional fields available:

NameDescription
PhoneSubscriber’s phone number.
LastSmsMmsDate of last SMS/MMS message sent to subscriber
LastClickSmsMmsDate of last time subscriber clicked a link in SMS/MMS message.

Response

Method returns ID of scheduled export. ID can be used to get export status using GET method.

Response Data element:

Element/attributeTypeNotes
(Data element content)intID of scheduled export.

Examples

Simple list export

Request:

POST https://api.esv2.com/v2/Api/Exports HTTP/1.1 
Accept-Encoding: gzip,deflate 
Content-Type: application/xml 
User-Agent: Jakarta Commons-HttpClient/3.1 
Host: api.esv2.com 
Content-Length: 411 

<ApiRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <ApiKey>test_api_key1</ApiKey>
  <Data>
    <Type>List</Type>
    <ListId>11</ListId>
    <Fields>
      <Field>Email</Field>
      <Field>FirstName</Field>
      <Field>LastName</Field>
    </Fields>
    <FileFormat>Csv</FileFormat>
  </Data>
</ApiRequest>

Exporting a segment with custom properties

Request:

POST https://api.esv2.com/v2/Api/Exports HTTP/1.1 
Accept-Encoding: gzip,deflate 
Content-Type: application/xml 
User-Agent: Jakarta Commons-HttpClient/3.1 
Host: api.esv2.com 
Content-Length: 411 

<ApiRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <ApiKey>test_api_key1</ApiKey>
  <Data>
    <Type>Segment</Type>
    <SegmentId>93</SegmentId>
    <Fields>
      <Field>Email</Field>
      <Field>FirstName</Field>
      <Field>LastName</Field>
    </Fields>
    <Properties>
      <Property>5</Property>
      <Property>12</Property>
    </Properties>
  </Data>
</ApiRequest>

Response:

HTTP/1.1 201 Created 
Cache-Control: private 
Content-Type: text/xml; charset=utf-8 
Server: Microsoft-IIS/7.5 
X-AspNetMvc-Version: 3.0 
X-AspNet-Version: 4.0.30319 
X-Powered-By: ASP.NET 
Date: Mon, 25 Nov 2013 16:40:14 GMT 
Content-Length: 147 

<ApiResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Data>12</Data>
</ApiResponse>