cancel
Showing results for 
Search instead for 
Did you mean: 

DELETE on a contact

SOLVED
Highlighted
Occasional Advisor

DELETE on a contact

I seems that when I perform a HTTP DELETE on a contact it doesn't remove that contact, but sets its status to OPTOUT.

Is this really correct? If so, is there any way to remove contacts through your API?

8 REPLIES 8
Moderator

Re: DELETE on a contact

Constant Contact does not provide any way to permanently delete a Contact from our databases.  While our UI does have a "Delete" option, it should be noted that those contacts are solft deleted and still exist.  We simply hide them in the UI.  This is similar to the Remove function in our older Contacts Management system. 

Dave Berard
Senior Product Manager, Constant Contact
Occasional Advisor

Re: DELETE on a contact

So just to be clear: you are saying there is no way to remove a contact without opting it out?

 

I am trying to remove old contacts but I don't want to add their email addresses to your opt out list.

 

EDIT: Also, are we billed for contacts that are hidden from the UI?

Moderator

Re: DELETE on a contact

If you want to have a Contact not be on any lists but not be opted out, simply update (PUT) the Contact with an empty lists array.  This will move the Contact to Removed status and will no longer count for billing purposes.  You can readd the contact by updating (PUT) the Contact at a later time with one or more active lists.

Dave Berard
Senior Product Manager, Constant Contact
Occasional Advisor

Re: DELETE on a contact

I'm dealing with the same issue so I'd like to add that you can no longer PUT the contact with an empty lists array. You can (hopefully) achieve the same with an undocumented call contactService->deleteContactFromLists. I found it by diggint in the PHP library.

Occasional Advisor

Re: DELETE on a contact


@PetrPePaP wrote:

"...you can no longer PUT the contact with an empty lists array."


Really? I just tested this manually on my account and it seems to still work like it always did.

 

I performed a PUT to the endpoint

https://api.constantcontact.com/v2/contacts/{ID}?action_by=ACTION_BY_OWNER&api_key=MYKEY

 with a request body of something like: 

 

{

   
"lists": [],

   
"email_addresses": [

       
{

           
"email_address": "email@domain.com"

       
}

   
]

}

 

and I got a respone of 200 and the contact's status was set to "REMOVED".

 

In what situation is this failing for you?

Occasional Advisor

Re: DELETE on a contact

Sorry, you're right. It is possible to submit an empty array for lists when updating an existing contact.

 

I got confused because I was getting an error when creating a new contact with empty lists.

 

Let me summarize then.

  • you cannot delete a contact
  • you can hide an existing contact from GUI by submitting an empty array of lists
    method PUT; $client->updateContact()
  • you can't delete it by deleting it, contrary to what the documentation says
    That would just permanently unsubscribe the contact and its e-mail addresses, and it would remain visible in GUI.
    method DELETE, $client->deleteContact()
  • you cannot submit an empty array of lists when creating a new contact
    Which isn't relevant to this topic of deleting a contact but anyway.
    method POST; $client->addContact()

Documentation is misleading because it mixes information about PUT and POST.

 

There are separate pages for creating contacts

http://developer.constantcontact.com/docs/contacts-api/contacts-collection.html?method=POST

and updating them

http://developer.constantcontact.com/docs/contacts-api/contacts-resource.html?method=PUT#structure

and yet the updating page mentions that you must include at least 1 list. True, it says that it relates to POST but I misread it and didn't suspect that a page about updating would be talking about creating.

 

- lists

array

REQUIRED. Array of the contact lists that the contact is a member of

id

string

REQUIRED. Unique ID of contactlist the contact is a member of, must include at least 1 list on POST.

status

string

Contact list status, valid values:

  • ACTIVE: List is the current default contactlist
  • HIDDEN - List is not the default contact list
(Read Only)

 

I hope I got it right this time :-)

Moderator

Re: DELETE on a contact

That is a pretty accurate overview.  Looks like we have a couple of documentation areas to improve and I would also like to bring back to the team the lists array being required.  It is only required on a POST (Create) call, not a PUT (Update) call.  So, here's the two areas we have to correct and one area we need to investigate.  Thank you greatly for pointing all of this out by the way, hugely appreciated!

 

1. DELETE Contact Documentation: says you delete the Contact in question.  We do not support hard deleting a Contact, the DELETE verb actually allows you to Unsubscribe a Contact.  This is inaccurate and we need to correct this.

2. Lists array in documentation: ambiguously says required field but then statys it's only required for POST.  Need to get this cleaned up.

2. Lists array in PUT: this may be optional in it's entirety for a PUT (meaning you can pass null or leave it out entirely).  Will check this on our side and update documentation accordingly.

 

Thanks again for the feedback and pointing these errors out!

Dave Berard
Senior Product Manager, Constant Contact
Occasional Advisor

Re: DELETE on a contact

Thank you Dave, I'm glad that you found my input worth something.

I added some additional information for less experienced programmers and posted it on my blog. Feel free to comment there if it's lacking.