Knowledgebase

Get Contacts

Method: GET
Endpoint: /api/getContacts


Parameters

Parameter Type Required Description
list_id int No Contact list id which contacts you want to get
user_id int No Get contacts of a particular user
email email No Get contacts by email
bounced sotf, hard, no_process  No soft = Get soft bounced contacts
hard = Get hard bounced contacts
no_process = Get non bouned contacts
is_spammed 0, 1 No 1 = Get contacts marked as spammed
0 = Get contacts marked as non spammed
is_unsubscribed 0, 1 No 0 = Get subscribed contacts
1 = Get un-subscribed contacts
is_confirmed 0, 1 No 0 = Get un-confirmed contacts
1 = Get confrimed contacts
format text, html No Get contacts with email format
is_active 0, 1   0 = Get inactive contacts
1 = Get active contacts
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
full_details 0, 1 (default: 0) No If 1 It will get full details of the contacts along with custom fields. Otherwise, just contact id and email address will be returned
response 0, 1 (default: 0) No Get full response of the operation


Response Parameters

Parameter Type Description
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/getContacts';

//parameters
$data = array (
    //'user_id'	    => '2',
    'limit_start'	=> '1',
    'limit_count'	=> '2',
    //'list_id'	    => '2',
    'full_details'  => '1'
);

$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>";
echo json_encode(json_decode($output),JSON_PRETTY_PRINT );

// Closing cURL
curl_close ($ch);

?>

 

Example Response (JSON)

{
    "status": "success",
    "result": [
        {
            "id": 2,
            "process_bounce_report": 0,
            "name": "[email protected]",
            "host": null,
            "port": null,
            "username": null,
            "password": "eyJpdiI6InprVlN6b2tVNDd6YTZIMFhGTU9ZeGc9PSIsInZhbHVlIjoiMWN5cURONk9Sa3QrZTB4bEZ3UHBPUT09IiwibWFjIjoiZTUzMzA3NDJhMGQ4YzliMmRkMThjYTNiNmVjZDQ5ZDk4NGRhMjE0ODU2NjM2NmUxNTcxYWQ4OGFkN2ZhZDRlMiJ9",
            "folder": "INBOX",
            "validate_certificates": 0,
            "bounce_encryption": "notls",
            "delete_emails": 0,
            "processing_protocols": "pop",
            "user_id": 4,
            "pmta_id": 0,
            "test_status": "",
            "created_at": "2020-05-08 16:02:49",
            "updated_at": "2020-06-30 06:20:18",
            "is_active": 0,
            "has_error": 0
        },
        {
            "id": 3,
            "process_bounce_report": 0,
            "name": "[email protected]",
            "host": "yahoo.com",
            "port": 110,
            "username": "adnan",
            "password": null,
            "folder": "INBOX",
            "validate_certificates": 0,
            "bounce_encryption": "None",
            "delete_emails": 0,
            "processing_protocols": "pop",
            "user_id": 2,
            "pmta_id": 0,
            "test_status": "",
            "created_at": "2020-10-08 15:00:46",
            "updated_at": "2020-10-08 15:00:46",
            "is_active": 1,
            "has_error": 0
        }
    ]
}
Status value of the success response will be "Success"


Example Error Response (JSON)

 {
    "status": "error",
    "result": "Error: Contact doesn't exist."
 }


Possible Errors

  • Invalid contact list id
  • Invalid user id
  • Access Denied
GET
/api/getContacts
Try it out