Knowledgebase

Update Contact By Email

Method: PUT
Endpoint: /api/updateContactByEmail/{email}

Parameters

Parameter Type Required Description
list_id int No If no list id has been given, it will work globally on all lists
recursive 0, 1 (default: 1) No Update all matching contacts globally. If set to 0, it will just update the first matching contact
format TEXT, HTML (default: HMTL) No Which format this contact should receive the email

HTML = Will receive HTML version of the email
TEXT = WIll receive a simple text version
is_confirmed 0, 1 (default: 1) No Confirmation status of the contact

0 = Add this contact as unconfirmed
1 = Add this contact as confirmed
is_active 0, 1 (default: 1) No Status of the contact

0 = Mark as inactive (will not receive emails)
1 = Mark as active
bounced 0, 1, 2 (default: 0) No Bounced status of the contact

0 = Add as not bounced
1 = Add as soft bounced
2 = Add as hard bounced
is_unsubscribed 0, 1 (default: 0) No Subscription status of the contact

0 = Mark as subscribed
1 = Mark as unsubscribed
is_spam 0, 1 (default: 0) No If this contact has produced a spam complaint

0 = Mark as spam
1 = Don't mark as spam
additional_field string No Add details to additional fields
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/updateContactByEmail/';

//Contact email
$email	=	'[email protected]';

//parameters
$params  = [
    'first_name'    => 'John',
    'last_name'     => 'Lee',
    'city'          => 'NewYork',
    'bounced'       =>  0,
    //'list_id'       =>  5,
    'response'      =>  1];

// Defining cURL Request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$domain.$endpoint.$email);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_HTTPHEADER,
    array('Content-Type: application/json', 'Authorization: Bearer ' . $api_token));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
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);

?>


Example Response (JSON)

{
    "status": "success",
    "result": "Success: Contact has been successfully updated.",
    "response": {
        "id": 10,
        "email": "[email protected]",
        "list_id": 10,
        "bounced": "no_process",
        "is_spamed": 1,
        "is_unsubscribed": 1,
        "is_confirmed": 1,
        "is_verified": 0,
        "is_active": 1,
        "is_sent": 0,
        "format": "text",
        "user_id": 2,
        "created_at": "2019-05-09 06:05:34",
        "updated_at": "2019-05-09 10:24:25",
        "additional_fields_data": {
            "first_name": "John",
            "last_name": "Lee",
            "city": "NewYork"
        }
    }
 }
Status value of the success response will be "Success"


Example Error Response (JSON)

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


Possible Errors

  • Invalid format
  • Invalid contact list id
  • Access denied
PUT
/api/updateContactByEmail/{email}
Try it out