Got a 'How do I' question? Join 'Ask a Trainer' Monday to Friday, 11am to 4pm ET for instant help and pro tips!

"Bad request." response when sending a request to https://api.constantcontact.com/v2/contacts

SOLVED
Go to solution
JesseB9
Rookie
0 Votes

I'm using Constant Contact's v2 API version and trying to add a contact by sending a request to https://api.constantcontact.com/v2/contacts. This almost always succeeds and returns a 201 response, but sometimes I get a 400 response code with the error_key = 'http.status.bad_request" and error_message = 'Bad request.'

 

At first, I found this https://developer.constantcontact.com/api_guide/glossary_responses.html#:~:text=400%3A%20Bad%20Reque... and assumed that the data we sent with the request wasn't formatted properly.

 

After testing, I found that this was not from the JSON being malformed. I also found, by process of elimination, that the email address was the issue. When I changed the email address to something random like 'test_email_for_cc@gmail.com' then the request went through successfully, so I started looking up email validation errors for CC and found quite a few: https://community.constantcontact.com/t5/API-Developer-Support/Email-Validation/m-p/417409
https://community.constantcontact.com/t5/API-Developer-Support/v3-api-returns-Email-address-is-inval...

https://wordpress.org/support/topic/is-email-error-notification-message-misleading/

It sounds like my issue, as an email address didn't work one day, but did a couple weeks later when I tested it again. All those examples are using the v3 API version, so my guess is that the v2 version returns a generic error message whereas the v3 API has been improved to return a more detailed error message.

 

So I just wanted confirmation that this is/could be the case here, because if so, then we know what to do when we see this error message and could add handling so we don't crash when we receive a 400. Or if it could be something else then that would be good to know.

 

Thanks!

 

1 ACCEPTED SOLUTION
John__B
Employee

Hello JesseB9,

 

Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.

 

If you’ve confirmed that the email address was the source of the 400 error, then the cause is most likely that our system has detected signup abuse with that particular address. Signup abuse occurs when more than 5 attempts are made by an email address to subscribe to Constant Contact newsletters or update its profile within a 24 hour period. When signup abuse is detected, the address is flagged for 48 hours and won’t be able to be added to Constant Contact accounts for that period of time.

 

I can confirm that when this occurs in a V2 API request, the response is a 400 error with a “Bad request” error message. You are correct that the error message has been improved when this occurs with a V3 API request. When this occurs in a V3 API request, the status code is still 400, but the error message is “Email address is invalid”.

 

Please have a look and let us know if you have any other questions!

 

Regards,

 


John B.
API Support Specialist
Did I answer your question? If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.

View solution in original post

4 REPLIES 4
John__B
Employee

Hello JesseB9,

 

Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.

 

If you’ve confirmed that the email address was the source of the 400 error, then the cause is most likely that our system has detected signup abuse with that particular address. Signup abuse occurs when more than 5 attempts are made by an email address to subscribe to Constant Contact newsletters or update its profile within a 24 hour period. When signup abuse is detected, the address is flagged for 48 hours and won’t be able to be added to Constant Contact accounts for that period of time.

 

I can confirm that when this occurs in a V2 API request, the response is a 400 error with a “Bad request” error message. You are correct that the error message has been improved when this occurs with a V3 API request. When this occurs in a V3 API request, the status code is still 400, but the error message is “Email address is invalid”.

 

Please have a look and let us know if you have any other questions!

 

Regards,

 


John B.
API Support Specialist
Did I answer your question? If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.
JesseB9
Rookie
0 Votes

Awesome, I think we will look into upgrading to the v3 API. Thanks for your time!

 

- Jesse

DeniseB52
Rookie
0 Votes

i get this too every time i schedule a blast - email is fine. it's a microsoft exchange email

HTTP Status 400 – Bad Request


Type Exception Report

Message Request header is too large

Description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

Exception

java.lang.IllegalArgumentException: Request header is too large
	org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:770)
	org.apache.coyote.http11.Http11InputBuffer.parseHeader(Http11InputBuffer.java:964)
	org.apache.coyote.http11.Http11InputBuffer.parseHeaders(Http11InputBuffer.java:591)
	org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:286)
	org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
	org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:928)
	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1794)
	org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
	org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
	org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(Thread.java:750)

Note The full stack trace of the root cause is available in the server logs.

John__B
Employee
0 Votes

Hello DeniseB52,

 

Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.

 

It looks like we'll need some additional information in order to assist with troubleshooting. If you could please provide us with the API key that you’re using, a full example campaign scheduling request, including headers, and any timestamps or general timeframes you may have from previous failed requests, we'll be able to better assist in pinpointing the cause of the 400 error response that you’ve encountered. Please provide this information securely by reaching out to us via email at webservices@constantcontact.com, we look forward to assisting you!

 

Please have a look and let us know if you have any other questions!

 

Regards,


John B.
API Support Specialist
Did I answer your question? If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.
Resources
Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up