Need An Email Marketing Solution For All Of Your Customers?

Partner With VerticalResponse!

addListMember


The addListMember() method adds a single member to the specified list. If the new list member fails validation, an exception is thrown.

This Method should not be used to add more than one list member record at a time. To add multiple list members in a single call, use the appendFileToList or appendFileToListBackground methods instead.

Input

[vrtypens:addListMemberArgs]

session_id [xsd:string] (required)
Your API session id.
list_member [vrtypens:ListMember] (required)
The list member argument must contain a list_id. The list_name and list_type fields are not used.
The member_data must at least contain an entry for email_address.
validate_postal_address [xsd:boolean]
If this is set to true and the list member’s postal address is invalid, then a fault will be thrown.

Output

[vrtypens:ListMember]
The output is the newly-added list member.

Examples

PHP

$vrapi->addListMember( array(
	'session_id'  => $sid,
	'list_member' => array(
		'list_id'     => $lid,
		'member_data' => array(
			array('name' =>'email_address', 'value' => 'email@example.com'),
			array('name' => 'first_name', 'value' => 'Peter'),
			array('name' => 'last_name', 'value' => 'Parker'),
		),
	),
));

Ruby

vr.addListMember({
	'session_id'  => sid,
		'list_member' => {
		'list_id'     => lid,
			'member_data' =>  [ 
				{'name' => 'email_address', 'value' => 'email@example.com'},
				{'name' => 'first_name', 'value' => 'Peter'},
				{'name' => 'last_name', 'value' => 'Parker'}
			]
		}
})

Java

int member_data_needed = 3;
NVPair[] member_data = new NVPair [member_data_needed];  
int ix = 0;

member_data [ix++] = new NVPair ("email@example.com", MEMBER_EMAIL_ADDRESS);
member_data [ix++] = new NVPair ("Peter", MEMBER_FIRST_NAME);
member_data [ix++] = new NVPair ("Parker", MEMBER_LAST_NAME);

ListMember list_member = new ListMember ( listID, listName, type, member_data );
	list_member.setList_id(listID);
	list_member.setMember_data(member_data);
	
AddListMemberArgs addListMemberArgs = new AddListMemberArgs ();
	addListMemberArgs.setList_member(list_member);
	addListMemberArgs.setSession_id(sessionID);

addedMember = vr.addListMember( addListMemberArgs );

C#.NET

ListMember objLM = new ListMember();
objLM.list_id = intlistId;
NVPair[] memberData = new NVPair[3];

memberData[0] = new NVPair();
memberData[0].name = "email_address";
memberData[0].value = "email@example.com";

memberData[1] = new NVPair();
memberData[1].name = "Peter";
memberData[1].value = "Example";

memberData[2] = new NVPair();
memberData[2].name = "Parker";
memberData[2].value = "List Member";

objLM.member_data = memberData;

addListMemberArgs objAL = new addListMemberArgs();

objAL.list_member = objLM;
objAL.session_id = sessionId;

try
{
    objVR.addListMember(objAL);
}
catch (Exception e)
{
    System.Console.WriteLine(e.Message);
}

Perl

$vrapi->addListMember( {
	session_id => $sid,
	list_member => {
		list_id     => $lid,
		member_data => [
			{name  =>'email_address', value => 'email@example.com'},
			{name  => 'first_name', value => 'Peter'},
			{name  => 'last_name', value => 'Parker'},
		],
	},
});