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.

Invalid Request from Form Submission (Resolved)

Highlighted
New Member

Invalid Request from Form Submission (Resolved)

Hi -


I've created a simple form to add a single entry to one of our CC lists.  It accepts a first name, last name, and email address, and POSTs the form using PHP, taken directly from the samples provided on this developer site.


The resulting XML string is:


<?xml version="1.0"?>

<entry xmlns="http://www.w3.org/2005/Atom">

 <title type="text"></title>

 <updated>2010-05-05T17:11:07+01:00</updated>

 <author></author>

 <id>urn:uuid:E8553C09F4xcvxCCC53F481214230867087</id>

 <summary type="text">Contact</summary>

 <content type="application/vnd.ctct+xml">

  <Contact xmlns="http://ws.constantcontact.com/ns/1.0/">

   <EmailAddress>langservcal@gmail.com</EmailAddress>

   <FirstName>Cal</FirstName>

   <LastName>Langserv</LastName>

   <OptInSource>ACTION_BY_CUSTOMER</OptInSource>

   <ContactLists>

    <ContactList id="https://api.constantcontact.com/ws/customers/{USERNAME}/lists/5"/>

   </ContactLists>

  </Contact>

 </content>

</entry>

 


(The email address is real, but it is for a dummy testing account; number 5 is the desired list ID, and "XXXXXXX" is the account name.)


This submission returns a 400 request error.  What am I missing?


Thanks,


- Dave

2 REPLIES 2
Highlighted
Employee

400 Error Creating Contact

Hey Dave,


I took a look at your XML and was successfully able to create a contact using it. The only adjustments that I had to make was to modify the list ID to be an actual list contained within my account. You may possibly be recieving a 400 error if list id number '5' does not exist. Another possible error you could be recieving is an error 409 if the contact already exists within your account.


I would recommend that you take a look at the REST Client and see if you are able to create a contact this program. If you are still running into any issues creating a contact, please reply to this post with the PHP that you are using and I'll be happy to take a look. If you would prefer, you can also send your PHP to our webservices support team and we would be happy to take a look at it. Thanks.

David J

Highlighted
New Member

Invalid Request from Form Submission Solved

Thanks for getting back to me -- the REST Client really made a difference.


My problem was that I was not programmaticaly generating a response containing my collection of lists.


Instead I was trying to pass a specific list directly, by what I assumed was the ID number ("5").


Turns out that's actually the content of the "ContactCount" element.  A little note clarifying the distinction might be helpful, for future reference!


Thanks again,


- Dave


 

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