The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

409 Error

Highlighted
Occasional Participant

409 Error

Hi,


I'm trying to implement constant contact API using php. My code was working for a month, but now it has stopped working. File hasn't been updated for a month now. I get this error "The requested URL returned error: 409" when someone tries to sign up. 


Would be alright to post my code here?


 

14 REPLIES 14
Highlighted
Employee

Re: 409 Error

You can certainly post your code here if you're comfortable with that, otherwise you can feel free to send an email to our webservices support team and we would be happy to take a look there instead.


Regarding the 409 error you are receiving, this is typically due to a conflict in the resource you are trying to post. For example attempting to create a contact that already exists in your system would return a 409. You can verify if this contact exists already or not by Searching for Contact by Email Address. You can also find a list of all of our error codes at http://developer.constantcontact.com/doc/errorCodes.


I hope this helps. Please let us know if you have any other questions or concerns. Thanks.

David J

Highlighted
Occasional Visitor

Re: 409 Error

Is there anywhere that I can find a list of all possible errors that could be returned when trying to add a user via PHP API ($ConstantContact->addContact)? I need to do error checking on a website I am builiding and can't find these codes anywere. I know that there is a 401 and 409 errors, but what else? 

 

http://developer.constantcontact.com/doc/errorCodes does not have such a listing.

Highlighted
Honored Contributor

Re: 409 Error

Hello,

 

You can find a general list of HTTP status codes that will be returned by the API here: http://community.constantcontact.com/t5/Documentation/Error-Codes/ba-p/25077

 

As far as the HTTP status codes that could be returned while adding a user:

 

201 - Created (Success) - A new contact was created
204 - Updated (Success) - A contact was updated
400 - Invalid Request - The request format was invalid. Usually indicates an XML error.
401 - Unauthorized - The request failed to authenticate. Double-check your credentials before trying again.
409 - Conflict - A contact already exists and you need to update the contact instead of adding a new contact. (PUT instead of POST)

 

If you have any furhter questions, please reply to this post and we will be happy to assist you!

Sincerely,

Elijah G.

Tier 2 Support

Elijah G.
API Support Engineer
Highlighted
Occasional Participant

here is the code

 include_once('cc_class.php');


$ccContactOBJ = new CC_Contact();


$ccListOBJ = new CC_List(); 


/**


 * If we have post fields means that the form have been submitted.


 * Therefore we start submiting inserted data to ConstantContact Server. 


 */


if (!empty($_POST)) {


 


//Adding an array to store contact list(s) the user should be subscribed to 'babylon'; 


$lists = array();


$lists[] = "http://api.constantcontact.com/ws/customers/onerace/lists/1";




$postFields = array();


$postFields = $_POST;



//Assign the array of lists to the postFields lists array


$postFields = $lists;




foreach($_POST as $key=>$val) {



if (strncmp($key, 'custom_field_', strlen('custom_field_')) === 0) {


$postFields = $val;


}


 


}


 


$contactXML = $ccContactOBJ->createContactXML(null,$postFields);



if (!$ccContactOBJ->addSubscriber($contactXML)) {


$error = true;


} else {


$error = false;


$_POST = array();


}


 


}



if (isset($error)) {



if ($error === true) {


$message = $ccContactOBJ->lastError;


//echo "success=no";


} else {


                //echo "success=yes";


                header("Location: redirectpage.php");


}      


}

Highlighted
Occasional Participant

 I searched the database and

 I searched the database and email address I'm trying to add does not exist.

Highlighted
Employee

Re: I searched the database and

A 409 error should not be happening if that contact does not exist. In order to really dig into this, I would need to have your username, as well as the email address that you are looking to add to your account. If you can either reply to this with that information, or email it to out webservices support team, I'd be happy to look into this.

David J

Highlighted
Occasional Participant

Re: I searched the database and

I'm having the same error (The requested URL returned error: 409).

Highlighted
Occasional Participant

Re: I searched the database and

This is my XML

 

<entry xmlns="http://www.w3.org/2005/Atom"><title>TitleNode</title><updated>2011-08-02T11:16:37+01:00</updated><author><name>CTCT Samples</name></author><id>urn:uuid:E8553C09F4xcvxCCC53F481214230867087</id><summary type="text">Customer document</summary><content type="application/vnd.ctct+xml"><Contact xmlns="http://ws.constantcontact.com/ns/1.0/">Customer document<EmailAddress>sgrowing@gmail.com</EmailAddress><FirstName></FirstName><LastName></LastName><MiddleName></MiddleName><CompanyName></CompanyName><JobTitle></JobTitle><OptInSource>ACTION_BY_CONTACT</OptInSource><HomePhone></HomePhone><WorkPhone></WorkPhone><Addr1></Addr1><Addr2></Addr2><Addr3></Addr3><City></City><StateCode></StateCode><StateName></StateName><CountryCode></CountryCode><PostalCode></PostalCode><SubPostalCode></SubPostalCode><Note></Note><EmailType></EmailType><ContactLists><ContactList id="http://api.constantcontact.com/ws/customers/orbitDev/lists/1"/><ContactList id="http://api.constantcontact.com/ws/customers/orbitDev/lists/2"/></ContactLists></Contact></content></entry>

Highlighted
Occasional Participant

Re: I searched the database and

Sorry for the rapid-fire posts...a small update:

 

I've found that I am receiving this error when trying to sign up with an email that is currently on my list or has been previously added. For example, I added my email address, and was successful. I logged into constant contact and removed my email address from all lists. When I tried to add my email address again, I got the error. To test, I tried this several different times with different addresses...it looks like I can only sign up once with an email address...if I try to submit a duplicate OR I delete the email address and try to re-submit, I get an error 409.

 

Please help!

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured