Method: POST
Endpoint: /api/addList
Parameter | Type | Required |
Description |
list_name | string | Yes | Name of the contact list you're adding |
owner_name | string | Yes | Owner name of the contact list |
owner_email | string | Yes | Owner email of the contact list |
reply_email | string | Yes | The email where you should get replies |
bounce_email | string | Yes | Return path where the failed delivery reports will be sent |
group_name | string | No | Add this list to a group |
additional_fields | string | No | Assign additional fields to this list |
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/addList';
$params = [
'list_name' => 'Test List via Api',
'owner_name' => 'John Lee',
'owner_email' => '[email protected]',
'bounce_email' => '[email protected]',
'reply_email' => '[email protected]',
'additional_fields' => 'first_name,profession',
'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: List has been successfully created.",
"response": {
"id": 22,
"name": "Test List Via Api",
"group_id": 2,
"owner_name": "John Lee",
"owner_email": "[email protected]",
"reply_email": "[email protected]",
"bounce_email_id": 1,
"user_id": 2,
"created_at": "2019-05-08 09:17:41",
"updated_at": "2019-05-08 09:17:41",
"custom_fields": {
"2": "First Name",
"13": "Profession"
}
}
}
{
"status": "error",
"result": {
"list_name": [
"Error: Missing required parameter, list name"
]
}
}