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.

Errors with Magento Integration

Highlighted
Occasional Visitor

Errors with Magento Integration

For Magento integration, Constant Contact seems to recommend a module by Free Lunch Labs, which uses the v1 API.

 

When signing up to the newsletter through Magento, this module also pushes this into Constant Contact through two calls. The first one fails with a message '409 Conflict' by the CC API, but the second one, with just the email address, succeeds. Note the different API endpoints.

 

I've attempted to contact the vendor to no avail, so I'm hoping someone could point me in the right direction on what's actually going on in this exchange so that I can attempt to fix it. Is there a need for two calls here? From a business standpoint, if I were to add the first/last name of the user (if available) to that second API call, would that be enough, or is that first 'full' contact something that should be kept, as well?

 

Thank you!

 

2017-09-26T19:08:13+00:00 DEBUG (7): https://api.constantcontact.com/ws/customers/user@account.com/contacts ---
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
   <title>TitleNode</title>
   <updated>2017-09-26T19:08:13+01:00</updated>
   <author>
      <name>Contact</name>
   </author>
   <id>urn:uuid:E8553C09F4xcvxCCC53F481214230867087</id>
   <summary type="text" />
   <content type="application/vnd.ctct+xml">
      <Contact xmlns="http://ws.constantcontact.com/ns/1.0/">
         <EmailAddress>my@email.com</EmailAddress>
         <FirstName>Firstname</FirstName>
         <LastName>Lastname</LastName>
         <OptInSource>ACTION_BY_CONTACT</OptInSource>
         <CompanyName />
         <HomePhone>215-702-3566</HomePhone>
         <Addr1>123 Sesame St.</Addr1>
         <Addr2>Ste 456</Addr2>
         <City>New York City</City>
         <StateName>New York</StateName>
         <CountryCode>US</CountryCode>
         <PostalCode>10128</PostalCode>
         <Note />
         <EmailType />
         <ContactLists>
            <ContactList id="http://api.constantcontact.com/ws/customers/user@account.com/lists/1412278173" />
         </ContactLists>
      </Contact>
   </content>
</entry>
--- The requested URL returned error: 409 Conflict --- 22 ---
 
2017-09-26T19:08:16+00:00 DEBUG (7): https://api.constantcontact.com/ws/customers/user%40account.com/contacts/1091032352 ---
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
   <title>TitleNode</title>
   <updated>2017-09-26T19:08:14+01:00</updated>
   <author>
      <name>Contact</name>
   </author>
   <id>http://api.constantcontact.com/ws/customers/user%40account.com/contacts/1091032352</id>
   <summary type="text" />
   <content type="application/vnd.ctct+xml">
      <Contact xmlns="http://ws.constantcontact.com/ns/1.0/">
         <EmailAddress>my@email.com</EmailAddress>
         <FirstName />
         <LastName />
         <OptInSource>ACTION_BY_CONTACT</OptInSource>
         <Note />
         <EmailType />
         <ContactLists>
            <ContactList id="http://api.constantcontact.com/ws/customers/user@account.com/lists/1412278173" />
         </ContactLists>
      </Contact>
   </content>
</entry> ---  --- 0 ---

 

 

Tags (1)
1 REPLY 1
Highlighted
Moderator

Re: Errors with Magento Integration

Hello @JasonY0092,

 

Thank you for reaching out to Constant Contact's API Support.

 

 

I apologize for the late reply; your message got lost for a moment there.

 

The first call has two issues. It is only used to create a new contact and the @ symbol needs to be encoded. The conflict error makes me think in this scenario the email address has already been used to create a contact.

 

The second call is used to update an existing email address. It also has encoded the @ symbol as well. 

 

Generally a developer would use some type of if statement when sending information over. You would do a GET on the email address; IF the address exists then do a PUT to update with the second call you see. ELSE do a POST with the first call.

 

Hope this info helps.


Regards,
Jimmy D.
Tier II API Support Engineer
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