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 - 400 API 3 - Adding a new Contact

LAUW
Rookie
0 Votes

Hi,

 

I'm attempting to add (Post) a new contact and receiving a 400 - Bad Request Error.

 

Dim request = New RestRequest(Method.POST)

 

request.AddHeader("content-type", "application/json")
request.AddHeader("cache-control", "no-cache")
request.AddHeader("accept", "application/json")
request.AddHeader("scope", "contact_data")
request.AddHeader("authorization", strToken)
request.AddParameter("application/json",  strBody,  ParameterType.RequestBody)

 

Here is the JSON body: 

 

{""email_address"":{""address"":""karen-wilson@mpsi20.org"",""permission_to_send"":""implicit""},""company_name"":""MPS Muskogee High School"",""first_name"":""Karen"",""last_name"":""Wilson"",""create_source"":""Account"",""update_source"":""Account"",""list_memberships"":[""0882b6be-6bd4-11eb-91bb-fa163e6eddcc""]}"

 

(Please ignore the double-quotes as that is how it's displayed in Visual Studio)

 

I'm sending this on behalf of a Constant Contact customer who is receiving this error message.  I'm able to create Contacts in other CC environments but there is something preventing me from doing so for this specific customer.  I don't see anything wrong.  I have a valid Connection (I can download lists, list members, etc.)  The email address is valid.  The List ID is valid. 

 

I am able to update lists for existing Contacts.  Just can't seem to add new ones.

 

Please let me know if you require additional information.

 

Thanks,

 

Chris

 

 

1 REPLY 1
Courtney_E
Moderator
0 Votes

Hello Chris,

 

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 your request was formatted correctly, but the list that you are trying to post to (based on the example you provided) has been deleted, which is most likely what caused the 400 response.

 

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


Regards,

Courtney E.
Tier II API Support Engineer

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