Update or add custom fields to a list


Parameter

Description

Required

list_idID of the list to add toYES
field_nCustom field value where n is an integer between 1 and 10. You can also use the names of the custom fields you have chosen for your list, e.g. field.birthday.YES (at least 1)


Example


curl https://api.transmitsms.com/add-field-to-list.json \
  -u 2e24c1cbdd987221e165d543f34b84bf:secret \
  -d list_id=1234567 \
  -d 'field_1=Sydney'


JSON Response

{
  custom_1: "Sydney",
  id: 1234567,
  error: {
    code: "SUCCESS",
    description: "OK"
  }
}

XML Response

<?xmlversion="1.0"encoding="UTF-8"?>
<response>
  <custom_1>Sydney</custom_1>
  <id>1234567</id>
  <error>
    <code>SUCCESS</code>
    <description>OK</description>
  </error>
</response>


Error Codes


Code

Header

Description

KEY_NO_EXISTS400List with such id is not existing
MISSING_PARAM400Field param is missing (eg. field_n)


PHP Examples


<?php
  include '../../APIClient2.php';

  $api = new transmitsmsAPI('API_KEY', 'API_SECRET');
  $customFields = array('custom1_value', 'custom2_value');
  $result = $api->addFieldToList(6195, $customFields);

  if ($result->error->code == 'SUCCESS') {
    echo "Custom field(s) added";

  } else {
    echo "Error: {$result->error->description}";
  }