I successfully received the access token. And also I can check the token info, token info display these details "{"scopes":["contact_data","campaign_data"]}"
But when I try to do any API action I receive this error "{"error_key":"unauthorized","error_message":"Unauthorized"}"
I am using following code to create new list:
$url = 'https://api.cc.email/v3/contact_lists';
$ch = curl_init();
$data = array(
"name" => "Multiple Countries",
"favorite" => true,
"description" => "List multiple countries"
);
$jsonDataEncoded = json_encode($data);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);
// Set HTTP Header for POST request
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Cache-Control' => 'no-cache',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Authorization' => 'Bearer '.$access_token
));
// Submit the POST request
$result = curl_exec($ch);
$err = curl_error($ch);
// Close cURL session handle
curl_close($ch);
if ($err) {
echo "cURL Error #:" . $err;
} else {
print_r($result);
}
Please let me know what is that issue.