cancel
Showing results for 
Search instead for 
Did you mean: 

Can same email address used repetitively?

Occasional Contributor

Can same email address used repetitively?

I have updated contact with test@gmail.com. Can I add another contact with test@gmail.com with different details. if so can I know which HTTP request method I need to use? Thank you!!

 

Can anyone reply me urgently?

16 REPLIES 16
Moderator

Re: Can same email address used repetitively?

Currently, our contact system is based off email addresses, so two contacts cannot exist with the same email address.

 

Nick Galbraith
Support Engineer
Highlighted
Occasional Participant

Re: Can same email address used repetitively?

Thank you for clarification!!

Occasional Contributor

Re: Can same email address used repetitively?

Thanks!!

Trusted Contributor

Re: Can same email address used repetitively?

I'd like to add to what Nick has stated. I've  provided a description of our contact data model that explains this more thoroughly here.  Essentially, contacts are unique at the account level in our system, and list are "interest" attributes of the contact record.

Mark Coleman
Support Engineer
Occasional Contributor

Re: Can same email address used repetitively?

 There is an emergency issue with this to my clients. Contacts are not getting updated once contact is register. is there a way that I could reach you guys?  Please help us out.

Occasional Contributor

Re: Can same email address used repetitively?

Seems like issue is with post. Once the contact is created then how can I get the right contact using GET when I have list number and email address? Please hlep me soon. Thanks!

CTCT Employee

Re: Can same email address used repetitively?

Hi,

 

If you want to update existing contacts as well as add new contacts, you have to build in logic to do a search by email address, then PUT the contact if it already exists or POST the contact if it is new.  Here is my script that uses our PHP wrapper, for example.

 

<?php

session_start ();
require_once 'ConstantContact.php';
require_once 'config.php';

$ConstantContact = new ConstantContact("oauth2", $apikey, $username, $accessToken);  //OR
//$ConstantContact = new ConstantContact("basic", $apikey, $username, $password);
//Supply your credentials--API Key and other details--in config.php

// Get potential contact lists
$lists = $ConstantContact->getLists();
// Lists are returned in multidimentional arrays 0 being the list, and 1 being the next50

// Email address here is used for testing purposes
$emailAddress = "test_12132012@example.com";

// Search for our new Email address
$search = $ConstantContact->searchContactsByEmail($emailAddress);

// If the search didnt return a contact object
if($search == false)
{
	// Create a new Contact Object to store data into
	$contactObj = new Contact();
	// Adding multiple lists to this new Contact Object
	$contactObj->lists = array($lists['lists'][0]->id, $lists['lists'][1]->id);
	// Set the email address
	$contactObj->emailAddress = $emailAddress;
	//Set the opt in source
	$contactObj->optInSource = "ACTION_BY_CONTACT";
	// Create the Contact and DONE
	$Contact = $ConstantContact->addContact($contactObj);
	echo ("Contact added.");

} // Otherwise we update our existing contact
else 
{
	// Gather data from our previous search and store it into a data type
	$contactObj = $ConstantContact->getContactDetails($search[0]);

	 // We need to get the old list and add a new list to it as
	 // this request requires a PUT and will remove the lists
	 // as they are stored in an array
	 array_push($contactObj->lists, $lists['lists'][1]->id );
	 
	 //Set the opt in value
	 $contactObj->optInSource = "ACTION_BY_CONTACT";
	 $contactObj->firstName = 'firstname';
  	 $contactObj->lastName = 'CTCTlastname';
	// Update the contact and DONE
	$UpdateContact = $ConstantContact->updateContact($contactObj);
	
	echo ("Contact updated.");
}	

?>

 

 

Best Regards,

Shannon W.

API Support Specialist

Occasional Contributor

Re: Can same email address used repetitively?

Is there any Java code examples for the same issuer?

Occasional Contributor

Re: Can same email address used repetitively?

Actually my case is, I can't directly update existing contact and I should when it's not there in any lists but already registered and create a new one if not registered. And another thing is we don't have many list but just one so I knew list number.

 

 Thanks!