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
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": 8,
            "email": "[email protected]",
            "list_id": 10,
            "bounced": "no_process",
            "is_spamed": 0,
            "is_unsubscribed": 0,
            "is_confirmed": 0,
            "is_verified": 0,
            "is_active": 0,
            "format": "html",
            "user_id": 2,
            "created_at": "2019-05-09 06:03:35",
            "updated_at": "2019-05-09 06:03:35",
            "additional_fields_data": {
                "first_name": "John",
                "last_name": "Lee"
            }
        },
        {
            "id": 9,
            "email": "[email protected]",
            "list_id": 10,
            "bounced": "no_process",
            "is_spamed": 0,
            "is_unsubscribed": 0,
            "is_confirmed": 0,
            "is_verified": 0,
            "is_active": 0,
            "format": "html",
            "user_id": 2,
            "created_at": "2019-05-09 06:04:46",
            "updated_at": "2019-05-09 06:04:46",
            "additional_fields_data": {
                "first_name": "Kevin",
                "last_name": "Richard"
            }
        }
    ]
 }
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