Delete Segment
This endpoint allows for the deletion of a segment. This call accepts form-encoded request bodies and returns responses in JSON format.
POST
https://api.pushengage.com/apiv1/segments/delete
Request Parameters
Parameter Name | Type | Required | Description |
---|---|---|---|
segment_id | Number | Yes | The unique identifier for the segment. Use this ID to delete the segment. |
Response Object
Property Name | Type | Required | Description |
---|---|---|---|
success | Boolean | Yes | Indicates if the request was successful. Possible values are true or false . |
message | String | Yes | Provides a message explaining the outcome, whether it's a success or failure. |
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>",
"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
{
"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
}