Method: PUT
Endpoint: /api/updateCustomField/{id}
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 |
Parameter | Type |
Description |
status | JSON | Success or Error |
result | JSON | Result of the operation |
response | JSON | Output of the operation |
<?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);
?>
{
"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": "success",
"result": {
"values": [
"Error: Missing required parameter, values"
]
}
}