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.

Error message "You don't have permission to perform this action" when deleting a contact using API

Highlighted
Occasional Participant

Error message "You don't have permission to perform this action" when deleting a contact using API

Hello.

 

I am trying to delete a contact using a curl command from the command-line on a Mac, but am getting an error message saying that I do no have permission to perform this action.

 

The syntax of the command that I am issuing is:

 

curl -X PUT "https://api.constantcontact.com/v2/contacts?api_key=API_KEY&access_token=ACCESS_TOKEN&action_by=ACTI..." -H "Content-Type: application/json" -d "\"email_addresses\":[{\"id\":\"EMAIL_ADDRESS_ID\"}],\"lists\":[{}]\""

 

I am using a valid API key, access token and email address id, and I found a posting elsewhere on this site that said that in order to delete a contact one has to assign a null set of lists to that contact.

 

The full error message that I get when issuing the above command is:

 

[{"error_key":"user.privilege.forbidden","error_message":"You don't have permission to perform this action; please see your account owner."}]

 

Can you advise me on the correct format for a curl command to delete a contact or otherwise unsubscribe them from all lists?  Or is there something else that I need to do with the setup of my API key in order to be able to delete contacts?

 

Thank you.

3 REPLIES 3
Highlighted
Moderator

Re: Error message "You don't have permission to perform this action" when deleting a conta

Hello,

 

Thank you for reaching out to Constant Contact API Support.

 

The first thing I notice is that you need to include the ID of the contact that you are updating in your URL path. You also need to include the contact's email address. See the below example:

 

curl -X PUT \
  'https://api.constantcontact.com/v2/contacts/{contactId}?api_key={API Key}' \
  -H 'Authorization: Bearer {Access Token}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{
    "lists": [],
    "email_addresses": [
        {
            "email_address": "email@address.here"
        }
    ]
}'

You can see the full documentation for making this call at http://developer.constantcontact.com/docs/contacts-api/contacts-resource.html?method=PUT

 

Please let me know if you have any other questions and I'll be happy to help in any way I can!

 

Regards,
David Bornstein
Tier II API Support Engineer

Highlighted
Occasional Participant

Re: Error message "You don't have permission to perform this action" when deleting a conta

Hello.

 

Thank you for your reply.

 

When I try your suggestion, I now get this error message:

 

[{"error_key":"http.status.not_found","error_message":"No matching resource was found for the supplied URL."}]

 

What does this error message mean, and what can be done to avoid it?

 

Thank you.

Highlighted
Occasional Participant

Re: Error message "You don't have permission to perform this action" when deleting a conta

I've identified what the problem was that was causing the "No matching resource was found for the supplied URL" message - I was using the email address ID instead of the contact ID.  Once I used the correct ID, the curl command worked.

 

Thank you again.

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