Need An Email Marketing Solution For All Of Your Customers?

Partner With VerticalResponse!

appendFileToListBackground


The appendFileToListBackground() method performs the same tasks as the appendFileToList() method, but does so after detaching and running as a background process. As a result, no meaningful data is returned to the caller (unless a fault is thrown during the data validation stage).

The argument notification_email_address is required for all background methods.

Input

[vrtypens:appendFileToListArgs]

session_id [xsd:string] (required)
Your API session id.
list_id [xsd:int] (required)
The ID of the list to add new recipients to
file [vrtypens:FileSpec] (required)
A FileSpec containing the contents of the file to append. The “delimiter” must be
set here, and either the “location” or “contents” field must be set.
fields [vrtypens:ArrayOfString] (required)
A list of the fields represented by the columns in the file. Any column in the file whose
field name is given as “_ignore_” is ignored when recipients are being created.
validate_postal_addresses [xsd:boolean]
If this is set to true and the list member’s postal address is invalid, then a fault will be thrown.
favor_existing_values [xsd:boolean]
For uploaded list members that are already in the account, if there’s a conflict between the uploaded list member’s fields and the existing list member fields, then the uploaded list member’s fields win the conflict, and the existing list member’s fields are updated. Set this to a true value for the existing list member’s fields to win the conflict such that the existing list member’s fields are not updated.
overwrite_non_nulls_with_nulls_ok [xsd:boolean]
Normally a non-null value would never get overwritten during an upload process.
Set this to a true value to override this default behavior.
overwrite_partial_postal_addresses_ok [xsd:boolean]
Postal address fields are: first_name, last_name, address_1, address_2, city, state, postalcode. Normally these are treated as one big field during the upload process and no individual piece is updated without the other being updated. Set this to a true value to override this default behavior. This will cause any updated list member to no longer be considered postcard-mailable.
ignore_first_line [xsd:boolean]
Set this to a true value if the first line in the uploaded file should be ignore (i.e., if it’s some sort of header row).
notification_email_address [xsd:string]
This is required for the background version of this method. When the result is ready, this email address will
receive a notification that includes a link that can be used to download the result.

Output

[xsd:int]
The output is the ID of the background task.

Examples

Java

File file = new File( "list_data.csv" );
byte[] fileContents = new byte[(int)file.length()];
new FileInputStream( file ).read( fileContents );
FileSpec fileSpec = new FileSpec( "list_data.csv", "csv", null, fileContents );
           
// add file contents to new list
// fileFieldNames contains the fields that each column in the file represents - in order
String[] fileFieldNames = { "customer_id", "email_address", "first_name", "last_name", "product" };
int result = vrapi.appendFileToListBackground( new AppendFileToListArgs(
    sessionId,
    listId,
    fileSpec,
    fileFieldNames,
    Boolean.FALSE,
    "yourname@company.com"
) );

Perl

$bg_id = $vrapi->appendFileToListBackground( {
    session_id => $sid,
    list_id    => $lid,
    file       => {
        filename   => 'list_2019.csv',
        delimiter  => 'csv',
        contents   => $fcontents,
    },
    fields => [
        'email_address',
        'first_name',
        'last_name',
    ],
    notification_email_address => 'yourname@company.com',
} );

PHP

$bg_id = $vrapi->appendFileToListBackground( array(
    'session_id' => $sid,
    'list_id'    => $lid,
    'file'       => array(
        'filename'  => 'list_2019.csv',
        'delimiter' => 'csv',
        'contents'  => $fcontents,
    ),
    'fields' => array(
        'email_address',
        'first_name',
        'last_name',
    ),
    'notification_email_address' => 'yourname@company.com',
) );

Ruby

bg_id = vr.appendFileToList({
  'session_id' => sid,
  'delimiter'  => 'tab',
  'list_id'    =>  lid,
  'file'       => {
       'filename' => filename,
       'delimiter' => 'tab',
        'contents' => list.read
  },
  'fields'     => [ "email_address", "first_name", "last_name"]
  'notification_email_address' => 'yourname@company.com'
})

C#.NET

byte[] FileContents = new System.Text.ASCIIEncoding().GetBytes(fileData);
FileSpec fsFileCotents = new FileSpec();
fsFileCotents.filename = "list_2010.csv";
fsFileCotents.delimiter = "csv";
fsFileCotents.contents = FileContents;

string[] arrFields = new string[] { "first_name", "email_address", "last_name" };

appendFileToListArgs objAppendFileToList = new appendFileToListArgs();
objAppendFileToList.session_id = _sSessionId;
objAppendFileToList.list_id = iListId;
objAppendFileToList.file = fsFileCotents;
objAppendFileToList.fields = arrFields;
objAppendFileToList.notification_email_address = "user@company.com"

int backTaskId = vr.appendFileToListBackground(objAppendFileToList);