Knowledgebase

Update Custom Field

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

Parameter

Parameter Type Required

Description 

name string No Update custom field name
field_order int No Update positioning of the custom field
type int (default: 1) No Type of the custom field

Text Field = text
Multi-line Text Field = textarea
Checkboxes = checkbox
Dropdown = select
Radio Button = radio
Date Field = date
JSON = json
values string No for type 1,2,6,7

Yes for type 3,4,5
Comma separated values
required 0, 1 (default: 0) No While adding a contact, do you want to make it a required additional field?

0 = Not required while adding a contact
1 = Required field while adding a contact
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/updateCustomField/';

//Custom field id
$custom_field_id	=	 43;

//parameters
$params = [
    'type'        =>  'select',
    //'values' => 'male,female',
    'name'        => 'Designation',
    'field_order' => 59,
    'required'    => 1,
    'response'    => 1
];

// Defining cURL Request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$domain.$endpoint.$custom_field_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: Custom field updated successfully.",
    "response": {
        "id": 43,
        "name": "Designation",
        "tag": "designation",
        "type": "text",
        "is_default": 0,
        "is_required": 1,
        "options": "Dev\r\nHR\r\nSale",
        "field_order": 59,
        "list_ids": "14",
        "user_id": 2,
        "created_at": "2019-05-15 07:14:43",
        "updated_at": "2019-05-15 08:29:16"
    }
 }

Status value of the success response will be "Success"


Example Error Response (JSON)

 {
    "status": "success",
    "result": {
        "values": [
            "Error: Missing required parameter, values"
        ]
    }
 }


Possible Errors

  • Invalid custom field id
  • Invalid contact list id
  • Invalid format
  • Access Denied
PUT
/api/updateCustomField/{id}
Try it out