Need An Email Marketing Solution For All Of Your Customers?

Partner With VerticalResponse!


The appendFileToList() method adds the members listed in the specified file to the specified list. For the file argument, provide a filename and contents. Records that fail validation are returned to the user with an explanation, and the location of a file containing the rejected records is returned for downloading as well.



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.



The output describes new statistics for the list that the recipients were added to.



            // Load file into FileSpec
            int listId = 5555;
            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" };
            AppendFileToListResult result = vrapi.appendFileToList( new AppendFileToListArgs(
            null ) );


use File::Slurp;

my $fcontents   = read_file($location);
my $filename = 'list_2010.csv';

$ap_file_resp = $vrapi->appendFileToList( {
    session_id => $sid,
    list_id    => $lid,
    file       => {
       filename => $filename,
       delimiter=> 'csv',
       contents => $fcontents,
    fields => [
} );


$file_name = "list_2019.csv";
if (file_exists($file_name)) {
    $handle = fopen($file_name,'rb');                
    $fcontents = fread($handle,filesize($file_name));
    $ap_file_resp = $vrapi->appendFileToList( array(
        'session_id' => $sid,
        'list_id'    => $lid,
        'file'       => array(
            'filename'  => $file_name,
            'delimiter' => 'csv',
            'contents'  => base64_encode($fcontents),
        'fields' => array(
    ) );


filename  = 'list_2019.csv'
fcontents =

      'session_id' => sid,
      'delimiter'  => 'tab',
      'list_id'    =>  lid,
      'file'       => {
          'filename' => filename,
          'delimiter' => 'tab',
          'contents' =>
  'fields' => [ "email_address", "first_name", "last_name"]


StreamReader tr = new StreamReader("list_2010.csv");
string fileData = tr.ReadToEnd(); 

byte[] FileContents = new System.Text.ASCIIEncoding().GetBytes(fileData);

FileSpec fsFileContents = new FileSpec();
fsFileContents.filename = "list_2010.csv";
fsFileContents.delimiter = "csv";
fsFileContents.contents = FileContents;

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

appendFileToListArgs objAppendFileToList = new appendFileToListArgs();
objAppendFileToList.session_id = _sSessionId;
objAppendFileToList.list_id = _intListId;
objAppendFileToList.file = fsFileContents;
objAppendFileToList.fields = arrFields;

appendFileToListResult results = objVR.appendFileToList(objAppendFileToList);