Knowledgebase

Update Contact Details

Method: PUT
Endpoint: /api/updateContact/{id}

Parameters

Parameter Type Required

Description

email string No Change email address of the contact
format TEXT, HTML (default: HTML) No Which format this contact should receive the email

HTML = Will receive HTML version of the email
TEXT = WIll receive 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/updateContact/';

//Contact id
$contact_id	=	10;

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

// Defining cURL Request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$domain.$endpoint.$contact_id);
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: Contact doesn't exist."
}


Possible Errors

  • Contact doesn't exist
  • Invalid contact id
  • Access denied
PUT
/api/updateContact/{id}
Try it out