Hi, I am trying to create a new campaign using API V3. I am using postman for this request. When I send a request to the server it returns an error JSON array. Below is the result of the API with code.
Response:
------------------
PHP cURL
-------------------
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.cc.email/v3/emails",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"name\": \"December Newsletter for Dog Lovers\",\n \"email_campaign_activities\": [\n {\n \"format_type\": 1,\n \"from_name\": \"Jake Dodge\",\n \"from_email\": \"jdodge@constantcontact.com\",\n \"reply_to_email\": \"jdodge@constantconatct.com\",\n \"subject\": \"Informed Daily Digest\",\n \"html_content\": \"<html><body> <a href=\\\"http://www.constantcontact.com\\\">Visit ConstantContact.com!</a> </body></html>\",\n \"physical_address_in_footer\": {\n \"address_line1\": \"123 Maple Street\",\n \"address_line2\": \"Unit 1\",\n \"address_line3\": \"string\",\n \"address_optional\": \"Near Boston Fire Station\",\n \"city\": \"Boston\",\n \"country_code\": \"US\",\n \"country_name\": \"United States\",\n \"organization_name\": \"Jake Dodge's Pancakes\",\n \"postal_code\": \"02451\",\n \"state_code\": \"MA\",\n \"state_name\": \"string\",\n \"state_non_us_name\": \"Victoria\"\n },\n \"document_properties\": {\n \"style_content\": \".white{color: #ffffff;}\",\n \"text_content\": \"<Text><Greetings/></Text>\",\n \"permission_reminder_enabled\": \"true\",\n \"permission_reminder\": \"Hi, just a reminder that you're receiving this email because you have expressed an interest in our company.\",\n \"view_as_webpage_enabled\": \"false\",\n \"view_as_webpage_text\": \"Having trouble viewing this email?\",\n \"view_as_webpage_link_name\": \"Click here to view this email as a web page\",\n \"greeting_salutation\": \"Hi,\",\n \"greeting_name_type\": \"F\",\n \"greeting_secondary\": \"Greetings!\",\n \"forward_email_link_enabled\": \"true\",\n \"forward_email_link_name\": \"Forward email\",\n \"subscribe_link_enabled\": \"false\",\n \"subscribe_link_name\": \"Subscribe to my email list!\",\n \"letter_format\": \"XHTML\"\n }\n }\n ]\n}",
CURLOPT_HTTPHEADER => array(
"Accept: */*",
"Accept-Encoding: gzip, deflate",
"Authorization: Bearer KM1t595gLa3RyI3LWpGoLxxxxxxx",
"Cache-Control: no-cache",
"Connection: keep-alive",
"Content-Length: 670",
"Content-Type: application/json",
"Host: api.cc.email",
"Postman-Token: 3aa39fdb-c1fd-40a4-9eef-f8363d55cffe,3e7979a1-4f58-4a77-9571-5bef8fddfb2b",
"User-Agent: PostmanRuntime/7.20.1",
"cache-control: no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
excuse me for stating the obvious. but do you have the required authorizations to create new campaign?
Hi @RicK22,
As @raleighb3 mentioned either your Access Token does not have the correct scopes required, or the account does not have the correct permissions to create an email campaign.