Bad Request when updating a contact

cristib60
Regular Participant

Bad Request when updating a contact

Hi,

 

I have this code which worked fine more than a year. Now, creating of new contacts works fine, but if contacts is already registered, for some unknown reasong I receive BAD REQUEST when updating it, do you know why?

 

 

Spoiler

public static void addContact(string email, string name, string surname, string phone, string listToAdd)
{

string[] emailAddress = new string[] { email };
string nextChunkId;
IList<Contact> list = Utility.SearchContactByEmail(auth, emailAddress, out nextChunkId);
if (list.Count == 0) // If the e-mail address doesn't exist
{
// Create new Contact
Contact contact = GetContactInformation(email, name, surname, listToAdd);
Utility.CreateNewContact(auth, contact);
}
else
{
// Get his original details
Contact c1 = Utility.GetContactDetailsById(auth, list[0].Id);

// Remove him from any list he was in
// Utility.RemoveContactFromAllLists(auth, list[0].Id);

// Update His Info
c1.Name = name;
c1.LastName = surname;
c1.WorkPhone = phone;
c1.HomePhone = phone;

// And re-add him
ContactOptInList contactOptInList = new ContactOptInList();
contactOptInList.ContactList = new ContactList(listToAdd);
c1.ContactLists.Add(contactOptInList);
c1.Status = ContactStatus.Active;
c1.OptInSource = ContactOptSource.ActionByCustomer;
Utility.UpdateContactFullForm(auth, c1);
}
}

5 REPLIES 5
DaveBerard
Moderator

Thanks for reporting this.  It sounds very similar to a couple of other reports we are getting and we are investigating now.  If possible, can you share the detailed response you're getting so we can confirm?

Dave Berard
Senior Product Manager, Constant Contact
cristib60
Regular Participant

Hi Dave,

 

I have no other details apart from the error I already put in the post.

 

I'm waiting for a detailed response as soon as possible cause my application is live and any user which is already registered to a specific list, when I try to update it (add to another list using that code) it's no longer working.

cristib60
Regular Participant

Hi Dave,

 

Any news about this? I expect from ConstantContact to investigate this asap....

Sorry for the long response time on this one.  It took us awhile to figure out what was going on.  Thanks to you and a couple of other developers for reporting this to us.  We got enough reports that we started to see common behaviors and that led us to figuring out the problem.

 

We found a bug in our new contact management system where duplicate phone numbers are incorrectly throwing errors.  Unfortunately, the only workaround is to not use the same phone number for both work and home.  Our contact management team is working on a fix for this but we do not have an ETA as yet.

Dave Berard
Senior Product Manager, Constant Contact
cristib60
Regular Participant

Thanks Dave, indeed it works if one of the phones I leave it empty.

 

Developer Portal

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

Visit Page