Method: POST
Endpoint: /api/addCustomField
Parameter | Type | Required |
Description |
name | string | Yes | Custom field name goes here |
type | string | Yes | 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 | Yes for type checkbox,select,radio |
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 |
list_id | int | Yes | id of the contact list to assign this field to them |
field_order | int | Yes | Position of the custom field which 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/addCustomField';
//parameters
$params = [
'name' => 'Designation',
'type' => 'Text Field',
'field_order' => '3',
'list_id' => '14',
'response' => 1];
// Defining cURL Request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$domain.$endpoint);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_HTTPHEADER,
array('Content-Type: application/json', 'Authorization: Bearer ' . $api_token));
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 created successfully.",
"response": {
"id": 43,
"name": "Designation",
"tag": "designation",
"type": "text",
"is_default": 0,
"is_required": 0,
"options": null,
"field_order": 3,
"list_ids": "14",
"user_id": 2,
"created_at": "2019-05-15 07:14:43",
"updated_at": "2019-05-15 07:14:43"
}
}
{
"status": "error",
"result": {
"values": [
"Error: Missing required parameter, values"
]
}
}