Knowledgebase

Add Custom Field

The section describes the Json document formation for adding a custom field ; with the details you can add, a sample request and its responses at the end of this section.

Username

The email that account holder uses to login MUMARA

API Token

The API token user has generated using API Configuration section of MUMARA, also mentioned above.

Method

Method being called (Post)

Path

Path to the API file being called ('http//www.yourdomain.com/API/deleteSubscriber)

Field Details

Label/Variable

Priority

Description

field_name

Required

Custom Field Name is required to add particular custom field, like designation, date of birth etc.

field_type

Required 

It is required to mentioned what kind of custom field you are about to add, will it be a text field, checkbox etc.

field_order

   

value_list

   

Sample Request

The following sample request adds a custom field with Field Name "Gender" and Field Type as "Checkbox"

$postData['field_name']    = 'Gender';
$postData['field_type']    = 'Checkbox';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'http//www.yourdomain.com/API/addCustomField');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_POST, count($postData));
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'APIToken: 343b1b831067b50e308e6bf93e0f06f0', 'Login: [email protected]'));

$data = curl_exec($ch);
if (curl_errno($ch)) {

   print "Error: " . curl_error($ch);

} else {

   // Show me the result
   print ($data);
   curl_close($ch);
}

Success Response

The required custom field name and type with other provided information will be added upon submitting valid information appropriately, as a result of successful submission, Json based response will return the ID of newly added custom field as in the following sample response.

Status value for successfully added custom field will be- “success”
Data Returned-"Custom Field ID"
Following is the example of a success response.

{"status":"success","response":{"Custom Field ID":"20"}};

Erroneous Response

When you submit request with inappropriate, incorrect information.

Status value for unsuccessful submission will be-"error”
Data Returned- Text based message describing reason of unsuccessful response
Some erroneous responses are as follows:

{"status":"error","response":"Field Name is required to create custom field."}
{"status":"error","response":"Field Type is required to create custom field."}