cancel
Showing results for 
Search instead for 
Did you mean: 

Problem updating contact list using Python API for Constant Contact

SOLVED
Highlighted
Occasional Contributor

Problem updating contact list using Python API for Constant Contact

I'm getting an error when I try to add a contact to a list using the api https://github.com/magellantoo/ctct-python-sdk 

 

Here's the overview of the how it moves:

 

ct = ConstantContact(api_key, access_token)

email_status = ct.get_contacts(email=email)['results']

...

if contact exists

 

email_id = email_status['id']

 

email_ct = ct.get_contact(email_id)
print json.dumps(email_ct, indent = 4, sort_keys = True)

 

Example Output:

 

{
"addresses": [],
"cell_phone": "",
"company_name": "",
"confirmed": false,
"created_date": "2015-03-20T12:37:34.000Z",
"custom_fields": [],
"email_addresses": [
{
"confirm_status": "NO_CONFIRMATION_REQUIRED",
"email_address": "hidden_email@hidden.com",  
"id": "xxxxxxxxx",
"opt_in_date": "2015-03-20T12:37:34.000Z",
"opt_in_source": "ACTION_BY_OWNER",
"status": "ACTIVE"
}
],
"fax": "",
"first_name": "Hidden Name",
"home_phone": "",
"id": "166",
"job_title": "",
"last_name": "Hidden Name",
"lists": [
{
"id": "2",
"status": "ACTIVE"
}
],
"middle_name": "",
"modified_date": "2015-03-20T12:37:34.000Z",
"notes": [],
"prefix_name": "",
"source": "Site Owner",
"source_details": "",
"status": "ACTIVE",
"work_phone": ""
}

 

I've replaced the text for email and username(s) for obvious reasons. I've gone through online similar error some pages suggest a list with over 1000 contacts will not allow new emails to be added, I tried it on a list not used with no contacts and still got the same error when running the code below:

 

email_ct.add_list_id('5')

response = ct.update_contact(email_ct)

print json.dumps(response, indent = 4, sort_keys = True)

 

{
"error_key": "http.status.conflict",
"error_message": "There was a conflict between the supplied data and the existing resource."
}

 

 

 

2 REPLIES 2
Occasional Contributor

Re: Problem updating contact list using Python API for Constant Contact

It works when you specify the action is from owner.

Moderator

Re: Problem updating contact list using Python API for Constant Contact

Hello,

Thank you for reaching out to the API Support team here at Constant Contact.

 

In order to tell you exactly why you may be getting a conflict error, we will need a bit more information. Please email webservices@constantcontact.com with the Constant Contact username and the contact email address you are having trouble adding. Once we have this, we can dig into this a bit deeper and give you a specific reason for that error.

Sincerely,
David B.
API Support Specialist