Method: GET
Endpoint: /api/getLists
Parameters
Parameter |
Type |
Required |
Description |
list_id |
int |
No |
Get details of a specific contact list |
user_id |
int |
No |
Get contact lists of a specific user |
group_id |
int |
No |
Get contact lists for a specific group |
limit_start |
int (default: 0) |
No |
Starting row of result. Default: 0 |
limit_count |
int (default: 25) |
No |
Number of records to get. Default: 25 |
- user_id needs admin rights
- For list_id, you should have permissions to this list
Response Parameters
Parameter |
Type |
Response |
status |
JSON |
Success or Error |
result |
JSON |
Result of the operation |
response |
JSON |
Output of the operation |
Example Request (CURL)
<?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/getLists';
//parameters
$data = array (
'group_id' => '2',
'user_id' => '2',
'limit_start' => '1',
'limit_count' => '2',
//'list_id' => '2'
);
$params = '';
foreach($data as $key=>$value)
$params .= $key.'='.$value.'&';
$params = trim($params, '&');
// Defining cURL Request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$domain.$endpoint.'?'.$params);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array('Content-Type: application/json', 'Authorization: Bearer ' . $api_token));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Executing cURL
$output = curl_exec ($ch);
// Printing Output
echo "<pre>";
print_r(json_decode($output,true));
// Closing cURL
curl_close ($ch);
?>
Example Response (JSON)
{
"status": "success",
"result": [
{
"name": "List 1",
"id": 6,
"owner_name": "John Lee",
"reply_email": "[email protected]",
"user_id": 2,
"group_id": 2,
"total_subscribers": 0,
"group_name": "Unsorted",
"bounce_email": "[email protected]",
"bounce_id": 1,
"created_at": "2019-05-06 09:23:10",
"updated_at": "2019-05-14 08:22:17",
"custom_fields": null
},
{
"name": "List 2",
"id": 7,
"owner_name": "Kevin Smith",
"reply_email": "[email protected]",
"user_id": 2,
"group_id": 2,
"total_subscribers": 1,
"group_name": "Test 2",
"bounce_email": "[email protected]",
"bounce_id": 1,
"created_at": "2019-05-06 09:57:24",
"updated_at": "2019-05-13 08:47:38",
"custom_fields": {
"2": "First Name",
"13": "Profession"
}
}
]
}
Status value of the success response will be "success"
Example Error Response (JSON)
{
"status": "error",
"result": "Error: Contact list doesn't exist."
}
Possible Errors
- Invalid contact list id
- Invalid user id
- Invalid group id
- Access Denied