cancel
Showing results for 
Search instead for 
Did you mean: 

403 Forbidden Error when deleting list

SOLVED
Advisor

403 Forbidden Error when deleting list

Hi,

 

I'm attempting to delete a list from CC.  Seems to me this should be pretty straight forward

 

   Dim strListsURI As New Uri(strURI & "/" & strListKey)

' //  (  https://api.constantcontact.com/ws/customers/cascadedsdev/lists/13   )


   Dim request As HttpWebRequest = WebRequest.Create(strListsURI)

   request.Credentials = New NetworkCredential(strCredentials, strCC_Password)
   request.Method = "DELETE"
   request.ContentType = "application/x-www-form-urlencoded"

   Dim response As HttpWebResponse = request.GetResponse()

 

If I "GET" the list it works works fine. It doesn't like the "DELETE" however.  What am I doing wrong? 

 

Thanks.

 

Chris

 

8 REPLIES 8
CTCT Employee

Re: 403 Forbidden Error when deleting list

Hi,

 

I can delete a list in my account by doing a DELETE method on the URI: https://api.constantcontact.com/ws/customers/my_username/lists/list_ID using the Content Type of application/atom+xml.  Testing in my account, I can actually also perform the task with the content type you provided as well, so I don't see anything wrong with your request.  

 

The 403 is usually caused by trying to access a URI for an account other than the one your provided credentials for.  Are you providing credentials for the same username in the URI?  Also, double check what you are providing for your password.

 

Best Regards,

Shannon W.

API Support Specialist

Advisor

Re: 403 Forbidden Error when deleting list

I'm using the same credentials as I use for every other operation.  As I said above, using the exact same code, if I replace the "Delete" with a "Get", it works in that I get a status returned as OK.  So I don't think it's a permissions issue.

 

One interesting note.  I've been working with a list that had no contacts on it.  I just tried the same thing on a list with contacts and receive the same error.  However, now all the contacts are remove from the list. 

 

Now I just tried it on an older VB6 application that we have in production and I'm also getting the 403 error. I wonder if my developer account doesn't have the ability to delete lists?

CTCT Employee

Re: 403 Forbidden Error when deleting list

Hi,

 

I see the issue.  Your list 13 is currently set to be the default list that people go into when they join your mailing list.  You can change this by logging into your account, and going to Contacts>>Grow My Contact List>>Lists and change the dropdown to be some other list in your account (then save).

 

The issue is that you can't delete your default list.

 

Best Regards,

Shannon W.

API Support Specialist

Advisor

Re: 403 Forbidden Error when deleting list

Okay.  Good answer.  Here's the problem.  It seems to think that all my lists are default lists.  I just tried to delete a list from within Constant Contact that was not marked as my default and got the message that I can't delete my default list.

Advisor

Re: 403 Forbidden Error when deleting list

According to Constant Contact, my "defaut" list is "Change My List Name" 12 (That's what it says on the web site)  13 is apparently a default list as well?. Can you have more than one default list? Perhaps it's something I'm doing when I created the list?

Highlighted
CTCT Employee

Re: 403 Forbidden Error when deleting list

Yes, I see that.  I apologize.  This is a defect with our API in that it CAN make multiple default lists.  Unfortunately I can't set them back to "not default" on my side since I can't access your account through the API (and our UI provides no way to do this), but if you update your lists  (do a GET, update the XML, and PUT it back) and set the OptInDefault node in the XML to "false" instead of true, you can then delete the list afterward.  You do need to have one default list in the account.

 

Sorry you ran into that!

 

Best Regards,

Shannon W.

API Support Specialist

Advisor

Re: 403 Forbidden Error when deleting list

Thanks Shannon.  My bad for not understanding the effects of setting OptInDefault to true.

 

On a completly and totally unrelated matter, if the account name someone has to log into Constant Contact has spaces in it "Barny's Bakery" does the "space" have to be encoded in the URI string?  If so, what is the encoded value?

 

Thanks.

CTCT Employee

Re: 403 Forbidden Error when deleting list

Hi,

 

Users with spaces in their Constant Contact username actually can't access their account through the API for this reason (url encoding/decoding issues).  That's one reason we stopped allowing users to have spaces in their username (I think this was a few years ago, but it could have been sooner).  Sadly, they'll have to change their username to use the API (or your integration).  They can login and go to My Account>>User Name to change it.

 

Best Regards,

Shannon W.

API Support Specialist