"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
Moderator

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

2 REPLIES 2
John__B
Moderator

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

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

Polls
How confident are you about the effectiveness of your current marketing strategy?

Top Choice: Not confident at all (62%)