We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

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

GeorgeR80
Participant

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
Shannon_W
Employee

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