Knowledgebase

Update Custom Fields

Following section discusses updating of the information saved for an already existing custom field, using API services, there is also a sample request with the json based responses it returns with.

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/Variable

Priority

Description

field_id

Required

ID of the particular custom field you want to update

field_name

Required

Name of the custom field is another requirement to submit the request successfully

field_type

Required

Which type of the custom field is this.

Sample Request

Following sample request updates custom field order of the list number 9. See the following sample request.

$postData['custom_field_id']    = '9';
$postData['field_name']        = 'gender';
$postData['field_type']     = 'checkbox';
$postData['field_order']    = '2';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'http://www.yourdomain.com/API/updateCustomField');
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

Status value for successfully updating custom field will be- “success”
Data Returned- List ID

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

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
If the Custom Field ID, Field Name, Field Type is not mentioned or incorrect, or if the custom field doesn't exist.