Import to local blacklist
ImportToBlacklistTasks collection allows scheduling (asynchronous) imports to local blacklist. Records are imported from an external source, e.g. file stored on FTP server.
Currently, only one-time, immediately executed imports are supported.
Executing a GET request on ImportToBlacklistTasks collection allows polling for scheduled import status (e.g. if it is still in progress or already finished).
Request data format#
Data part of request for scheduling a new import to suppression list.
Data element children:
| Element/attribute | Type | Notes |
| Source | complex | Imported file information. Required. |
| EntryType | string | Type of entries to be added. The available options are “Email”, “Phone” and “DialingPrefix”. For value “Email” accepted records include full email addresses, domains, MD5 or SHA256 hashes. Optional. Defaults to “Email”. |
Source element children:
| Element/attribute | Type | Notes |
| Url | string | URL address of imported file. Supported protocols are HTTP, HTTPS, FTP, FTPS and SFTP. E.g. ftp://www.domain.com/myimportedfile.csv |
| Username | string | Username used for authentication. Optional. |
| Password | string | Password used for authentication. Optional. |
| FtpAuth | string | Authentication method for secure FTP servers. Optional. Valid values are:None – FTP server does not support secure authentication (default) ExplicitTls – Explicit TLS/SSL authentication ExplicitSsl – Explicit SSL only authentication ImplicitSsl – Implicit SSL authentication |
| FtpUseActiveMode | string | If set to “true”, active mode will be used for FTP connections. Default value is “false” – passive connection mode will be used. |
Response#
Method returns ID of scheduled import. ID can be used to get import status using GET method.
Response Data element:
| Element/attribute | Type | Notes |
| (Data element content) | int | ID of scheduled import. |
Examples#
Scheduling a new blacklist import with default options
Request:
POST https://api.esv2.com/v2/Api/ImportToBlacklistTasks HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/xml
User-Agent: Jakarta Commons-HttpClient/3.1
Host: api.esv2.com
Content-Length: 379
<ApiRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<ApiKey>test_api_key1</ApiKey>
<Data>
<Source>
<Url>ftp://ftp.es.com/Blacklists/test.csv</Url>
</Source>
</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: Tue, 27 Mar 2012 12: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>78</Data>
</ApiResponse>Scheduling a new blacklist import with full options
Request:
POST https://api.esv2.com/v2/Api/ImportToBlacklistTasks HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/xml;charset=UTF-8
User-Agent: Jakarta Commons-HttpClient/3.1
Host: api.esv2.com
Content-Length: 1210
<ApiRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<ApiKey>test_api_key1</ApiKey>
<Data>
<Source>
<Url>ftp://ftp.es.com/Blacklists/test.csv</Url>
<Username>username</Username>
<Password>password</Password>
<FtpAuth>ExplicitTls</FtpAuth>
<FtpUseActiveMode>true</FtpUseActiveMode>
</Source>
<EntryType>DialingPrefix</EntryType>
</Data>
</ApiRequest>