Parameter | Type | Required | Description |
type | 0, 1 | Yes | 0 = Global suppression 1 = List based suppression |
reference | string | Yes | Reference for the suppression |
email or domain or ip |
string | Yes | Email address, domain and ip you want to add in suppression |
list_id | int | No | id of the contact list in which you want to suppress (0 will add in global) |
user_id | int | No | Suppress emails, domains & ips in a specified user |
response | 0, 1 (default: 0) | No | Get full response of the operation |
Parameter | Type | Description |
status | JSON | Success or Error |
result | JSON | Result of the operation |
response | JSON | Output of the operation |
<?php
// Authentication
$api_token = 'API_KEY'; // Mumara API Key (can be found in Settings -> API Key)
$domain = 'http://www.anydomain.com'; // Your Mumara Domain Name
// API Endpoint
$endpoint = '/api/suppress';
//parameters
$params = [
'reference' => 'added via api',
'type' => 1,
'list_id' => 2,
'user_id' => 2,
'email' => '[email protected]',
'response' => 1
];
// Defining cURL Request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$domain.$endpoint);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_HTTPHEADER,
array('Content-Type: application/json', 'Authorization: Bearer ' . $api_token));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Executing cURL
$output = curl_exec ($ch);
// Printing Output
echo "<pre>";
echo json_encode(json_decode($output),JSON_PRETTY_PRINT );
// Closing cURL
curl_close ($ch);
?>
{
"status": "success",
"result": "Success: Email has been successfully added to suppression list",
"response": {
"id": 4,
"label": "added via api",
"email": "[email protected]",
"list_id": 2,
"is_suppressed": 1,
"user_id": 2,
"created_at": "2019-05-16 07:14:18",
"updated_at": "2019-05-16 07:14:18"
}
}
{
"status": false,
"result": "Error: You must specify value of one of these parameters email, ip, domain."
}