Method: GET
Endpoint: /api/getCustomFields
Parameter
Parameter |
Type |
Required |
Description |
id |
int |
No |
id of the specific custom field |
user_id |
int |
No |
Get custom fields of a particular user |
limit_start |
int (default: 0) |
No |
Starting row of result. Default: 0 |
limit_count |
int (default: 25) |
No |
Number of records to get. Default: 25 |
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/getCustomFields';
//parameters
$data = array (
//'id' => '2',
'user_id' => '2',
'limit_start' => '0',
'limit_count' => '2',
);
$params = '';
foreach($data as $key=>$value)
$params .= $key.'='.$value.'&';
$params = trim($params, '&');
// Defining cURL Request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$domain.$endpoint.'?'.$params);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array('Content-Type: application/json', 'Authorization: Bearer ' . $api_token));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// 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": [
{
"id": 29,
"name": "Gender",
"tag": "gender",
"type": "select",
"is_default": 0,
"is_required": 0,
"options": "male\r\nfemale",
"field_order": 10,
"list_ids": "2",
"user_id": 2,
"is_deleted": 0,
"created_at": "2019-05-15 05:31:06",
"updated_at": "2019-05-15 05:31:06"
},
{
"id": 30,
"name": "Office no",
"tag": "office_no",
"type": "text",
"is_default": 0,
"is_required": 0,
"options": null,
"field_order": 1,
"list_ids": "2",
"user_id": 2,
"is_deleted": 0,
"created_at": "2019-05-15 05:36:30",
"updated_at": "2019-05-15 05:36:30"
}
]
}
Status value of the success response will be "Success"
Example Error Response (JSON)
{
"status": "error",
"result": "Error: Custom field doesn't exist."
}
Possible Errors
- Invalid custom field id
- Invalid user id
- Access Denied