Constant
Contact
API Guide

Rename a Segment

Use the PATCH /segments/{segment_id}/name method to rename an existing segment. The segment name must be unique.

Parameters

In the request body, specify the new name (name) for the segment. If the segment name already exists, the system returns a 409 error response.

Example PATCH Segments Requests

PATCH
https://api.cc.email/v3/segments/{segment_id}/name
 
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \t\"name\": \"Opened any of my last ten campaigns\"\n}");
Request request = new Request.Builder()
  .url("https://api.cc.email/v3/segments/3/name")
  .patch(body)
  .addHeader("Accept", "*/*")
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer {access_token}")
  .addHeader("Cache-Control", "no-cache")
  .addHeader("Host", "your_host.com")
  .addHeader("Accept-Encoding", "gzip, deflate")
  .addHeader("Content-Length", "49")
  .addHeader("Connection", "keep-alive")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

Response

{
     "name": "Opened any of my the last ten campaigns",
     "segment_criteria": "{\"version\":\"1.0.0\",\"criteria\":{\"type\":\"and\",\"group\":[{\"source\":\"tracking\",\"field\":\"opened\",\"op\":\"contains-any\",\"const_value\":\"last-n-campaigns\",\"param\":\"5\"}]}}",
     "segment_id": 3,
     "created_at": "2020-01-21T15:25:52.000Z",
     "edited_at": "2020-01-21T15:25:52.000Z"
 }
Try it!

On this page