There was a conflict between the supplied data and the existing resource

Regular Participant

There was a conflict between the supplied data and the existing resource

Hi there:


I have a question concerning an error message being returned for a handful of contacts in our account when updating through the PHP SDK. Without going into too much detail we are a choral group where singers can register for a season (fall, winter, spring etc) online. As part of the registration form singers are added to the respective mailing lists for the season through the API using the PHP SDK. I based my integration function on this sample code. Basically I am using the getContacts method to retrieve the contact by email address, then using the updateContact method to add the contact to the appropriate mailing lists and update the contact.


In my testing the integration is working fine. However for a small handful of contacts (15-20 out of 250) the following error message is being returned:


stdClass Object ( [error_key] => http.status.conflict [error_message] => There was a conflict between the supplied data and the existing resource.


I'm unclear on specifically what this error message means. Any idea on why this is being returned? When updateContact is called the only information I am passing back to Constant Contact is the First Name, Last Name, and Email Address.


Hope all of the above makes sense! Thanks for your help and please get back to me when you have a chance.


Hi @_Mystic_Chorale,


Thank you for reaching out to Constant Contact's API Support.


The reason for that error is most likely due to attempting to update a contact that you do not have the permission to update. If a contact is in the implied permission status then it can be updated by the account owner or the contact. If a contact is in the express permission status then it can only be updated by the contact.


The way this is decided when using the API is by the query parameter ACTION_BY_OWNER or ACTION_BY_VISITOR. You can read about this information in our Contacts documentation:


Jimmy D.
Tier II API Support Engineer

Hi Jimmy:


Thanks for getting back to me and for your explanation concerning the difference between implied and express permission status. One follow up question: when updating a contact can you retrieve the current status (action by owner or action by visitor) for the contact and then save the contact with that status?


For example in my function I am doing the following for existing contacts:


//Retrieving the contact by email address

$response = $cc->contactService->getContacts(ACCESS_TOKEN, array("email" => $email));


//Assigning the contact object returned to a variable

$contact = $response->results[0];


//Updating the contact option with the first and and last name from our local database

$contact->first_name = $first_name;

$contact->last_name = $last_name;


//Saving (returning) the updated contact back to Constant Contact

$returnContact = $cc->contactService->updateContact(ACCESS_TOKEN, $contact);


Does the contact object contain the current permission status for the contact and can it be updated similar to the way I am updating the first and last name above?


Thanks again for your help! Please get back to me when you have a chance.

Hi @_Mystic_Chorale,


When you do a GET on the contact you will have the email_addresses array and that should include the opt_in_source. Here is an example:


"email_addresses": [{
            "id": "d20b6d70-9029-11e3-987e-d4ae5292c47d",
            "status": "ACTIVE",
            "confirm_status": "CONFIRMED",
            "opt_in_source": "ACTION_BY_VISITOR",
            "opt_in_date": "2018-01-04T21:41:26.000Z",
            "email_address": ""

In this example the contact is express permission which you can tell in two different ways. The confirm_status is set to CONFIRMED which means the contact confirmed the information. Also the opt_in_source is ACTION_BY_VISITOR indicates this person was added in a method that reflects the contact themselves took the action.

Jimmy D.
Tier II API Support Engineer

Hi Jimmy:


Thanks again for your reply with the additional information concerning the fields returned in the email address array. I tested this with my function and I was able to successfully access these fields from the contact object that is returned via the PHP SDK.


When you have a chance could you provide me with a complete list of values (or combinations of values) for status, confirm_status, and opt_in_source which would cause a contact to be in express permission (where the contact can't be added to mailing lists by the API)? I think I understand this from your last post but I would like to confirm that I have all combinations account for.


Also will the API always return an error message in cases the contact is in express status or do I need to handle this specifically in my function after checking the values in the email addresses array?


For example in testing over the weekend there were two cases where a contact failed to be updated. In the first the contact had a status value of OPTOUT. In the second the contact had status of CONFIRMED and an opt_in_source of ACTION_BY_OWNER.


One last question: I noticed that when the contact value is returned I can update values in the email addresses array for the contact locally. For example I can change the opt_in_source from ACTION_BY_VISITOR to ACTION_BY_OWNER. Can I modify these values locally and use them to update the status for the contact when saving the contact back via the API? (I'm assuming no)

Hi @_Mystic_Chorale,


The potential combinations are actually covered by all the scenarios you mentioned. The OPTOUT is technically not one of those scenarios, but it does react the same way as the account owner cannot resubscribe a contact; only the contact can do that. This is the actual purpose of ACTION_BY_VISITOR.


The confirm_status in the email_addresses array can be CONFIRMED, UNCONFIRMED, or NO_CONFIRMATION_REQUIRED as listed on this page (scroll down to the Structure and click on the + next to email_addresses).


There is also a confirmed property which can be true or false. This is used to identify if the contact has confirmed their data.


Think of confirmed:true/false as a profile level confirmation and the confirm_status under the email_addresses array as an email address level confirmation. We no longer allow a contact to have more than one email address, but this is a hold over from when we did. Basically if you try to do a PUT and receive a 409 error then try again with the ACTION_BY_VISITOR parameter.

Jimmy D.
Tier II API Support Engineer
Developer Portal

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

Visit Page