Knowledgebase

Add Custom Field to List

Make use of the API function to add custom field in some particular list. The section describes the Json document formation for adding the custom field into a list; a sample request and its responses at the end of this section.

Required to Submit Json Request

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

Priority

Description

list_id

Required

Provide the ID of the list to which you want to add custom field to

custom_field_id

Required

What is the custom field ID you want to add to particular list

Sample Request

The following sample request adds custom field ID number 4 to the field with the ID 5. Here is the sample request.

$postData['list_id']            = '5';
$postData['custom_field_id']    = '4';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'http//www.yourdomain.com/API/addCustomFieldtoList');
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

Upon submitting valid request with correct list ID and custom field ID, you will get your custom field added to the provided list. 

Status value for successfully added subscriber will be- “success”
Data Returned-"Text Message Mentioning The Custom Field ID being added to the List ID"
Following is the example of a success response.

{"status":"success","response":{"Custom Field 4 added to list 5"}};

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":"Custom field id is required to add custom field to list."}
{"status":"error","response":"List id is required to add custom field to list"}
{"status":"error","response":"Custom Field 4 added to list 5"}