Method: POST
Endpoint: /api/addBounceRule
Parameter | Type | Required |
Description |
label | string | Yes | Label for bounce rule |
code | string | Yes | Bounce Code i.e (5.1.1) |
code_condition | is | yes | is = where bounce code is |
type | no_process,hard,soft | Yes | Action to mark as bounce no_process = not bounced hard = hard bounced soft = soft bounces |
reason | string | No | Bounce reason |
reason_condition | is, contains | Yes if reason is set | is = where bounce reason is contains = where reason contains specfic character(s) |
details | string | No | Bounce details |
details_condition | is,contains | Yes if details set | is = where bounce details is contains = where details contains specfic character(s) |
details_reason | string | No | Bounce detailed reason |
reason_condition | is , contains | Yes if details_reason is set | is = where bounce details_reason is contains = where bounce details_reason contains specfic character(s) |
status | 0, 1 (Default: 1) | No | 0 = Inactive 1 = Active |
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/addBounceRule';
$params = [
'label' => '5.1.1 label',
'code' => '5.1.1',
'code_condition' =>'is',
'type' => 'hard',
'status' => '1',
'details' => 'unknown',
'details_condition' => 'contains',
'reason' => 'unknown mailbox',
'reason_condition' => 'is',
'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: Bounce Rule successfully added.",
"response": {
"code": "5.1.1",
"reason": "unknown mailbox",
"details": "unknown",
"label": "5.1.1 label",
"type": "hard",
"code_condition": "is",
"reason_condition": "is",
"details_condition": "contains",
"status": "1",
"user_id": 2,
"updated_at": "2020-10-09 14:26:17",
"created_at": "2020-10-09 14:26:17",
"id": 364
}
}
Status value of the success response will be "success"
{
"status": "error",
"result": {
"details_condition": [
"Invalid details condition."
]
}
}