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.

Contact API - PUT method returns "Error 400" Help!

Highlighted
Member

Contact API - PUT method returns "Error 400" Help!

I first do a GET method and then do a PUT method with the same XML results and I receive the "Error 400: The request contains errors in the common Atom sections, which lie outside <entry> or <Content>, such as <feed>, <id>, <author> or <updated>"

 

When calling the URL:  https://api.constantcontact.com/ws/customers/{username}/contacts/13

 

<entry xmlns="http://www.w3.org/2005/Atom">
<link href="/ws/customers/{username}/13" rel="edit"/>
<id>http://api.constantcontact.com/ws/customers/{username}/contacts/13</id>
<title type="text">Contact: {emailaddress}</title>
<updated>2012-12-07T16:26:26.243Z</updated>
<author>
<name>Constant Contact</name>
</author>
<content type="application/vnd.ctct+xml">
<Contact xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/{username}/contacts/13">
<Status>Active</Status>
<EmailAddress>{emailaddress}</EmailAddress>
<EmailType>HTML</EmailType>
<Name>Mindy Meek</Name>
<FirstName>Mindy</FirstName>
<MiddleName/>
<LastName>Meek</LastName>
<JobTitle/>
<CompanyName/>
<HomePhone/>
<WorkPhone/>
<Addr1/>
<Addr2/>
<Addr3/>
<City/>
<StateCode/>
<StateName/>
<CountryCode/>
<CountryName/>
<PostalCode/>
<SubPostalCode/>
<Note/>
<CustomField1/>
<CustomField2/>
<CustomField3/>
<CustomField4/>
<CustomField5/>
<CustomField6/>
<CustomField7/>
<CustomField8/>
<CustomField9/>
<CustomField10/>
<CustomField11/>
<CustomField12/>
<CustomField13/>
<CustomField14/>
<CustomField15/>
<ContactLists>
<ContactList id="http://api.constantcontact.com/ws/customers/{emailaddress}/lists/26">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/{emailaddress}/lists/26" rel="self"/>
<OptInSource>ACTION_BY_CUSTOMER</OptInSource>
<OptInTime>2012-12-07T16:26:26.243Z</OptInTime>
</ContactList>
<ContactList id="http://api.constantcontact.com/ws/customers/{emailaddress}/lists/10">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/{emailaddress}/lists/10" rel="self"/>
<OptInSource>ACTION_BY_CUSTOMER</OptInSource>
<OptInTime>2012-12-07T16:26:26.243Z</OptInTime>
</ContactList>
<ContactList id="http://api.constantcontact.com/ws/customers/{emailaddress}/lists/31">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/{emailaddress}/lists/31" rel="self"/>
<OptInSource>ACTION_BY_CUSTOMER</OptInSource>
<OptInTime>2012-12-07T16:26:26.243Z</OptInTime>
</ContactList>
</ContactLists>
<Confirmed>true</Confirmed>
<InsertTime>2012-11-20T16:15:46.254Z</InsertTime>
<LastUpdateTime>2012-12-07T16:26:26.243Z</LastUpdateTime>
</Contact>
</content>
<source>
<id>http://api.constantcontact.com/ws/customers/{emailaddress}/contacts</id>
<title type="text">Contacts for Customer: {emailaddress}</title>
<link href="contacts"/>
<link href="contacts" rel="self"/>
<author>
<name>{emailaddress}</name>
</author>
<updated>2012-12-07T16:26:26.243Z</updated>
</source>
</entry>

 

{username} = "My User Name"

{email} = "The Contacts Email"

 

Anyone have any ideas I ran my XML through various online Atom Validators all came back good formatting??

 

Ideas please??

 

1 REPLY 1
Highlighted
Employee

Re: Contact API - PUT method returns "Error 400" Help!

Hi,

 

Do you have the email address in all of the places you've referenced in the XML you posted here?  I see it in the last id node and name node, which should both reference the username for your account, not the email address of your contact.

 

Best Regards,

Shannon W.

API Support Specialist

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