Showing results for 
Search instead for 
Did you mean: 
Constant Contact wants to help you succeed! We’re celebrating our professional service programs on the Constant Contact Community this month and you have a chance to try one of the services for free! Learn more.

415 Error When Adding a New List in VB.Net


415 Error When Adding a New List in VB.Net

Hi, (Using VB.Net 2010)

I found an HttpWebRequest example for VB.Net here:

I've copied the significant parts.

When I run it, I receive a "415 Unsupported Media Type" error on request.GetResponse()

Here is my code:

   Dim strURI As String = ""
   Dim strCredentials As String = strCC_AppKey & "%" & strCC_LoginName
   Dim strListsURI As New Uri(strURI)
   Dim strXML As String = GetCreateListXML()
   Dim request As HttpWebRequest = WebRequest.Create(strListsURI)

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

   Dim encoding As New Text.UTF8Encoding() 'Use UTF8Encoding for XML requests

   Dim postByteArray() As Byte = encoding.GetBytes(strXML)

   request.ContentLength = postByteArray.Length

   Dim postStream As IO.Stream = request.GetRequestStream()

   postStream.Write(postByteArray, 0, postByteArray.Length)


   Dim response As HttpWebResponse = request.GetResponse()

The strXML string looks like this:

<entry xmlns="">
  <title type="text">Contact Lists for Customer cascadedsdev</title>
  <author />
  <content type="application/vnd.ctct+xml">
    <ContactList xmlns="">
      <Name>My New List</Name>

I've reviewed the post that talks about the 415 error but I'm at a loss as to what the problem might be.  Everything looks correct

I would greatly appreciate any assistance.



CTCT Employee

Re: 415 Error When Adding a New List in VB.Net

Hi Chris,


It looks like the issue is that you're setting the wrong content type to add a contact list.  You want to set your Content type to "application/atom+xml".


I hope that helps!


Best Regards,

Shannon W.

API Support Specialist.


Re: 415 Error When Adding a New List in VB.Net

Thank you Shannon, that's exactly the problem.