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.

Adding List

New Member

Adding List

I am trying to create a new list.

I am POSTing the XML to{account}/lists. Where {account} is my user account name.

The XML is:

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="">\r\n
<title type="text"/>\r\n
<author />\r\n
<content type="application/vnd.ctct+xml">\r\n
<ContactList xmlns="">\r\n

I do not get any response nor does the new list get created.  I do not have any problems GETing the current list.

Does any one know what might be wrong and is there a way for the Constact Contact server admin to look at their logs to see what is being received and what might need to be adjusted?

I am using PHP with the following method similar to one provided as samples:

function CallServer( $uri, $method, $args )
$data = "";

$url = sprintf( "%s/ws/customers/%s/%s", $this->host, $this->account, $uri );
$auth = sprintf( "%s%s%s:%s", CRM_CONSTANT_CONTACT_KEY, '%', $this->account, $this->password );
$ch = curl_init();

printf( "url <br>", $url );

if( $method == "GET" )
if( $args != "" )$url .= '?' . $args;
curl_setopt( $ch, CURLOPT_HTTPGET, true );
else if( $method == "POST" )
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $args );
else if( $method == "PUT" )
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, "PUT" );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $args );
else if( $method == "DELETE" )
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, "DELETE" );

curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt( $ch, CURLOPT_USERPWD, $auth );
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
//curl_setopt( $ch, CURLOPT_HTTPHEADER, array( "Content-Type:application/atom+xml" ) );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array( "Content-Type:application/atom+xml", 'Content-Length: ' . strlen( $args ) ) );
curl_setopt( $ch, CURLOPT_FAILONERROR, 1);
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0);

$data = curl_exec( $ch ); // reply
curl_close( $ch );

return $data;

John Tegen

OnSite Connex

New Member

Error found

Content type needed to be

<content type="application/vnd.atom+xml">

John Tegen

OnSite Connex


Re: Error found

I apologize for not responding sooner, I was just beginning to look at your code, but I am glad that you were able to resolve the 400 error that you were receiving.


For more information regarding list creation, I would recommend taking a look at Creating a List, as this will show example of the XML needed to create a list in your account.


Please let us know if you have any further questions.


David J

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