Rename a segment.

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


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


 $request = new HttpRequest();
   'cache-control' => 'no-cache',
   'Connection' => 'keep-alive',
   'Content-Length' => '49',
   'Accept-Encoding' => 'gzip, deflate',
   'Host' => '',
   'Cache-Control' => 'no-cache',
   'Authorization' => 'Bearer {access_token}',
   'Content-Type' => 'application/json',
   'Accept' => '*/*'
  	"name": "Opened any of my last ten campaigns"
 try {
   $response = $request->send();
   echo $response->getBody();
 } catch (HttpException $ex) {
   echo $ex;
curl -X PATCH \\
  -H 'Accept: */*' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Authorization: Bearer {access_token}' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: 49' \
  -H 'Content-Type: application/json' \
  -H 'Host:' \
  -H 'cache-control: no-cache' \
  -d '  {
    "name": "Opened any of my last ten campaigns"
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()
  .addHeader("Accept", "*/*")
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer {access_token}")
  .addHeader("Cache-Control", "no-cache")
  .addHeader("Host", "")
  .addHeader("Accept-Encoding", "gzip, deflate")
  .addHeader("Content-Length", "49")
  .addHeader("Connection", "keep-alive")
  .addHeader("cache-control", "no-cache")

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


      "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!