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/attribute | Type | Notes |
---|---|---|
Type | string | Export type. Required. Valid values are: List – exporting subscriber list Segment – exporting subscriber segment |
ListId | integer | ID of subscriber list to export. Required when Type=List. Otherwise ignored. |
SegmentId | integer | ID of subscriber segment to export. Required when Type=Segment. Otherwise ignored. |
Fields | complex | Collection 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. |
Properties | complex | Collection of Property elements. List of custom subscriber properties to be exported. Properties are identified by ID. See example requests below. |
FileFormat | string | Format in wich report will be returned. Valid values are: Csv Excel |
Field element children:
Element/attribute | Type | Notes |
---|---|---|
(Field element content) | string | System field name. |
Property element children:
Element/attribute | Type | Notes |
---|---|---|
(Property element content) | int | Custom property ID. |
Available system fields to export:
Name | Description |
---|---|
Id | Subscriber’s ID. |
FirstName | Subscriber’s firstname. |
LastName | Subscriber’s lastname. |
Subscriber’s email. | |
EmailMd5 | MD5 of subscriber’s email. |
EmailSha256 | SHA256 of subscriber’s email. |
CustomSubscriberId | Subscriber’s custom ID. |
IP | IP address subscriber used to subscribe. |
Vendor | Subscriber’s vendor (source). |
TrackingCode | Tracking code subscriber used during subscription. |
GeoCountry | Subscriber’s country recognized from IP address using geolocation. |
GeoState | Subscriber’s state/province. |
GeoCity | Subscriber’s city. |
GeoZipCode | Subscriber’s ZIP/postal code. |
LastActivity | Date of last subscriber’s activity (click, open, visiting preference center etc). |
LastMessage | Date of last message sent to subscriber. |
LastEmail | Date of last email message sent to subscriber. |
LastOpenEmail | Date of last time subscriber opened an email message. |
LastClickEmail | Date of last time subscriber clicked a link in email message. |
SubscriptionDate | Date of subscription to a particular list (if the export type is segment, the date of the earliest subscription is used). |
ConfirmationDate | Date 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:
Name | Description |
---|---|
Phone | Subscriber’s phone number. |
LastSmsMms | Date of last SMS/MMS message sent to subscriber |
LastClickSmsMms | Date 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/attribute | Type | Notes |
---|---|---|
(Data element content) | int | ID 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>