The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Problem updating contact list using Python API for Constant Contact

SOLVED
Go to solution
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."
}

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Occasional Contributor

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

It works when you specify the action is from owner.

View solution in original post

2 REPLIES 2
Highlighted
Occasional Contributor

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

It works when you specify the action is from owner.

View solution in original post

Highlighted
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

Developer Portal

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

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured