Use PATCH /emails/{campaign_id}
to rename an existing campaign.
The campaign name cannot exceed 80 characters and it is not visible to contacts. You cannot rename email campaigns that have a Removed
status.
Authorization Requirements
User privileges: campaign:read
Authorization scopes: campaign_data
Parameters
Required parameters include the campaign_id
and the name
parameter in the request body
.
-
Use the
campaign_id
parameter in the URL to specify the campaign that you want to rename. For example:PATCH https://api.cc.email/v3/emails/{campaign_id}
-
Use the
name
property in the request body parameter to specify the new unique email campaign name.
The response body returns general email campaign information, the new campaign name, and lists the role and campaign activity IDs associated with the campaign.
Example PATCH Email Campaign Name Request
PATCH https://api.cc.email/v3/emails/{campaign_id}
<?php
HttpRequest::methodRegister('PATCH');
$request = new HttpRequest();
$request->setUrl('https://api.cc.email/v3/emails/c71a1f71-8349-4bda-8387-855c003c2ce2');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders(array(
'Postman-Token' => '73da8b06-665f-454d-afb5-8d856a6ac214',
'cache-control' => 'no-cache',
'Content-Type' => 'application/json',
'Authorization' => 'Bearer {access_token}'
));
$request->setBody('{
"name": "December Newsletter for Dog Lovers"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
curl -X PATCH \
https://api.cc.email/v3/emails/c71a1f71-8349-4bda-8387-855c003c2ce2 \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: b30561c8-f1e8-4d94-a453-70586179ff32' \
-H 'cache-control: no-cache' \
-d '{
"name": "December Newsletter for Dog Lovers"
}'
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"name\": \"December Newsletter for Dog Lovers\"\n}");
Request request = new Request.Builder()
.url("https://api.cc.email/v3/emails/c71a1f71-8349-4bda-8387-855c003c2ce2")
.patch(body)
.addHeader("Authorization", "Bearer {access_token}")
.addHeader("Content-Type", "application/json")
.addHeader("cache-control", "no-cache")
.addHeader("Postman-Token", "67bc6b49-496c-49b3-ae47-bccbe89a6f66")
.build();
Response response = client.newCall(request).execute();
Response
{
"campaign_activities": [
{
"campaign_activity_id": "9aacbeea-82b3-47c1-ab50-e8014c2b1e72",
"role": "permalink"
},
{
"campaign_activity_id": "b8165ae1-338e-4946-a92c-6402e2ebd609",
"role": "primary_email"
}
],
"campaign_id": "c71a1f71-8349-4bda-8387-855c003c2ce2",
"created_at": "2019-01-25T19:58:28.000Z",
"current_status": "DRAFT",
"name": "December Newsletter for Dog Lovers",
"type": "CUSTOM_CODE_EMAIL",
"updated_at": "2019-01-31T22:20:04.000Z"
}