Showing results for 
Search instead for 
Did you mean: 

Getting list of Lists via cURL

All Star

Getting list of Lists via cURL

I am having problems figuring out how to get a list of Lists via cURL.


I am able test the API with my APIKey and Token on site, but can't replicate it in my own code:


$url = "". $apiKey;
echo "Getting mailing list IDs ... ";
$header[] = "Authorization: Bearer $token";
$header[] = 'Content-Type: application/json';

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER,$header);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPGET, true);
echo curl_exec($ch);
$response = json_decode(curl_exec($ch));

print_r ($response);


The response I am getting is:

[{"error_key":"query.param.invalid","error_message":"The query parameter is not supported."}]Array ( [0] => stdClass Object ( [error_key] => query.param.invalid [error_message] => The query parameter is not supported. ) )


Any idea what I am doing wrong, or am missing?




Re: Getting list of Lists via cURL

Hello @ShelleyM2 ,


Thank you for reaching out to Constant Contact's API Support.


Looks to be a syntax error. You have both a ? and & before api_key. Since this is the first (and only) query parameter you just need the ?.

Jimmy D.
Tier II API Support Engineer