Deleting a Segment#

Getting Started#

Introduction

This endpoint is used to delete a segment. The request method of this call needs to be "POST". Segment id has to be sent as POST parameters to the API endpoint.

Request URL

 https://api.pushengage.com/apiv1/segments/delete

Method

  POST

Request Parameters

Required Parameters

Parameter Name Parameter Type Description
segment_id Number This defines the segment id. You can delete segment from segment id.

Response Objects

Required Object

Property Name Property Type Description
success Boolean To denote whether the request succeeded or not. Values can be 'true' or 'false'.
message String Used to denote reason of failure and success.

Deleting a Segment#

This endpoint is used to delete a segment. This request requires parameter segment_id.

Example#

Request

  • cURL
  • PHP
curl -X POST
-H "api_key: <your_pushengage_api_key>"
-H "Content-Type: application/x-www-form-urlencoded"
-d 'segment_id=12345'
"https://api.pushengage.com/apiv1/segments/delete"
<?php

    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.pushengage.com/apiv1/segments/delete",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "segment_id=12345",
      CURLOPT_HTTPHEADER => array(
        "api_key: <your_pushengage_api_key>",
        "cache-control: no-cache",
        "content-type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
?>

Response

  • 200 OK
  • 401 Unauthorized
  • 400 Bad Request
  • 400 Bad Request
{
  "message": "Segment successfully deleted",
  "success": true
}
{
  "success": false,
  "message": "API KEY Invalid"
}
{
  "message": "Enter a valid segment id",
  "success": false
}
{
  "message": "Your enter segment id does not exist",
  "success": false
}