Rename an existing tag.
Make a PUT
call to the /contact_tags/{tag_id}
endpoint to rename an existing tag name
to a new unique tag name
.
Tag names must:
- be unique to avoid returning a 409 error response.
- consist of at least one character and not more than 255 characters to avoid returning a 400 error response.
- be alphanumeric, which can include spaces, and common keyboard symbols (with the exception of
<
and>
).
The following shows an example response for a PUT
call to the /contact_tags/{tag_id}
endpoint:
{
"tag_id": "30c97dd0-332e-11eb-923c-fa163e56c9c1",
"name": "Dogs Rule 2021 Donors",
"created_at": "2020-11-30T17:05:04Z",
"updated_at": "2021-01-21T10:40:41Z"
}
The response body returns the name
and tag_id
used to uniquely identify the tag, and timestamps (in ISO format) showing when the tag was first created (created_at
) and last updated (updated_at
).
Parameters
When making a PUT
call to the /contact_tags/{tag_id}
, use the tag_id
query parameter in the path to specify which tag to rename and use the name
query parameter in the request body to rename the tag.
Authorization Requirements
User privileges: contacts:write
Authorization scopes: contact_data
Example PUT Tag Requests
PUT https://api.cc.email/v3/contact_tags/{tag_id}
<?php
$curl = curl_init();
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.cc.email/v3/contact_tags/7a587488-4085-11eb-9b48-fa163e56c9c1',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS =>'{
"name": "Dogs Rule 2021 Donors",
}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer {access_token}',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
curl --location --request PUT 'https://api.cc.email/v3/contact_tags/7a587488-4085-11eb-9b48-fa163e56c9c1' \
--header 'Authorization: Bearer {access_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Dogs Rule 2021 Donors"
}'
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"name\": \"Dogs Rule 2021 Donors\"\n}");
Request request = new Request.Builder()
.url("https://api.cc.email/v3/contact_tags/7a587488-4085-11eb-9b48-fa163e56c9c1")
.method("PUT", body)
.addHeader("Authorization", "Bearer {access_token}")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Response
{
"tag_id": "7a587488-4085-11eb-9b48-fa163e56c9c1",
"name": "Dogs Rule 2021 Donors",
"created_at": "2020-12-17T16:32:39Z",
"updated_at": "2021-01-13T17:15:47Z"
}