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.

The requested URL returned error: 400

Highlighted
Occasional Contributor

The requested URL returned error: 400

Now, When I am trying to create an account by using the partner's name, then the requested API URL shows the error as The requested URL returned error: 400

 

Please suggest me, what to do? How can I resolve this issue?

12 REPLIES 12
Highlighted
Employee

Re: The requested URL returned error: 400

Hello,

 

A 400 error usually means that the XML you are sending in your post is malformed.  Could you post the XML here on the forum that you are trying to send to the API server?  I can definitely take a look and see if I see a problem!

 

Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Highlighted
Occasional Visitor

Re: The requested URL returned error: 400

Hi,

 

I'm experiencing the same error.

 

Here's my XML:

 

<entry xmlns="http://www.w3.org/2005/Atom">
 <title></title>
 <updated>2011-06-29T19:14:57+01:00</updated>
 <author><name>ItalyTile Website</name></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>test@test.com</EmailAddress>
   <FirstName>test</FirstName>
   <LastName></LastName>
   <MiddleName></MiddleName>
   <CompanyName></CompanyName>
   <JobTitle></JobTitle>
   <OptInSource>ACTION_BY_CUSTOMER</OptInSource>
   <HomePhone></HomePhone>
   <WorkPhone></WorkPhone>
   <Addr1></Addr1>
   <Addr2></Addr2>
   <Addr3></Addr3>
   <City></City>
   <StateCode></StateCode>
   <StateName>CT</StateName>
   <CountryCode>USA</CountryCode>
   <PostalCode></PostalCode>
   <SubPostalCode></SubPostalCode>
   <Note></Note>
   <EmailType>HTML</EmailType>
   <ContactLists>
    <ContactList id="http://api.constantcontact.com/ws/customers/ITALTRADE/lists/1"/>
   </ContactLists>
  </Contact>
 </content>
</entry>

 

Let me know what you think.

Thanks!

 

 

/////////////////// UPDATE ///////////////////////

 

The 400 errors occurs upon calling the addSubscriber method of ConstantContact class. Hope that's helpful.

Please respond promptly!

Tags (1)
Highlighted
Employee

Re: The requested URL returned error: 400

Hello,

 

I believe the reason you are getting a 400 error is due to the Country Code.  The country code must be US for the United States. Here is a valid list of country codes that can be used.

 

If you have any questions please let me know.

 

Sincerely,

Benjamin Soder
NOC Analyst
Constant Contact
Highlighted
Occasional Visitor

Re: The requested URL returned error: 400

Yes, that seem to have fixed it!

 

Thanks!

Highlighted
Occasional Participant

Re: The requested URL returned error: 400

I'm sorry to bother you with the same issue but  I cant find a solution. I keep getting "The requested URL returned error: 400".

 

Heres the xml data:

 

<entry xmlns="http://www.w3.org/2005/Atom">
<title type="text"></title><updated>2011-12-01 01:28:03</updated>
<author><name>Amanady Products</name></author><id>urn:uuid:565e2c979b514e38924f2127b81fc0db</id>
<summary type="text">Contact</summary>
<content type="application/vnd.ctct+xml">
<Contact xmlns="http://ws.constantcontact.com/ns/1.0/">
<EmailAddress>xxx@yyy.com</EmailAddress>
<FirstName>xxxx</FirstName>
<LastName>yyyy</LastName>
<CompanyName>xw</CompanyName>
<WorkPhone>408</WorkPhone>
<Addr1>2147 Street</Addr1>
<City>Milpitas</City>
<StateCode>CA</StateCode>
<CountryCode>US</CountryCode>
<PostalCode>95035</PostalCode>
<OptInSource>ACTION_BY_CONTACT</OptInSource>
<ContactLists>
<ContactList id="http://api.constantcontact.com/ws/customers/USERNAME/lists/1"></ContactList></ContactLists>
</Contact></content></entry>
Highlighted
Moderator

Re: The requested URL returned error: 400

XML is correct, what URI are you making the request to and what type of request are you making (PUT, POST, DELETE)?

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Moderator

Re: The requested URL returned error: 400

Also, edited your post to hide customer information.

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Occasional Participant

Re: The requested URL returned error: 400

the uri is https://api.constantcontact.com/ws/customers/USERNAME  and using POST. Not sure if  the username: Amanady is authorized, connected or has issues.

Highlighted
Moderator

Re: The requested URL returned error: 400

So you would correctly be recieving an error making a POST request to that URI.  The URI for creating a new contact is the following format:

 

https://api.constantcontact.com/ws/customers/{username}/contacts

 

Documentation on this is found here: http://community.constantcontact.com/t5/Documentation/Creating-a-Contact/ba-p/25059

Dave Berard
Senior Product Manager, Constant Contact
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