Knowledgebase

Delete Custom Field

Following almost the same pattern of deleting subscribers and lists, you can use the API service to delete the custom field. The following section will elaborate it further with a sample request and returned Json responses both successful and unsuccessful.

Required to Submit Json Request

Username

The email that the account holder uses to login MUMARA

API Token

The API token user has generated using the 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

custom_field_id

Required

The only required field to delete a particular custom field is its ID.

Sample Request

The sample code in the following section has a valid API token, username, and path to delete the custom field list ID “9”.

$postData['custom_field_id']  = '9';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'http://www.yourdomain.com/API/deleteCustomField');
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 providing appropriate information such as API token, username, path and valid custom field ID, you will get your custom field deleted and will be given the following response.

Status value for successfully deleted List will be- “success”
Data Returned-"Custom Field ID" 

{"status":"success","response":{"Custom Field ID":"9"}}

Erroneous Response

When you submit a request with inappropriate, incorrect information.

Status value for unsuccessful submission will be "error” 
Data Returned- Text based message describing the reason for unsuccessful response

{"status":"error","response":"Custom Field ID is required to delete custom field"}