This is an older version of the Campaign Monitor API. We strongly encourage you to quit livin' in the past and use the shiny new RESTful version with lots of new functionality. You won't regret it.
List.CreateCustomField
Creates a new custom field for a list
Parameters and required information
Here’s a list of all the parameters you’ll need to pass to the List.CreateCustomField method. All of the parameters are required unless otherwise noted.
ApiKey
Your API application key. See here for more details.
ListID
The ID of the list whose custom fields should be returned. See here for more details.
FieldName
The Name for the new Custom Field. This will be used to generate the custom fields Key.
DataType
The Data Type for the new Custom Field. This must be one of Text, Number, MultiSelectOne, MultiSelectMany, Country, USState or Date
Options
The available options for a multi-valued custom field. Options should be separated by a double pipe “||”. This field must be null for Text, Number, Country, and USState custom fields. In the case of Country and USState fields the options will be automatically generated (and made available by calling List.GetCustomFields for the same list)
Return Codes
Success
0: Success
The Custom Field was successfully created
Error
100: Invalid API Key
The API key pass was not valid or has expired.
101: Invalid ListID
The ListID value passed in was not valid.
254: Invalid FieldName
The FieldName value passed in was not valid.
255: The Field Key already exists
A Custom Field using the Key generated from the Field Name already exists.
256: Options Defined for Text or Number Field
The Options value was not either null or an empty string for a Text, Number, Country, or USState based field.
257: No Options Defined for Multi-Valued Field
There were no Options defined for a Multi-Valued Custom Field.
259: DataType must be one of (Text|Number|MultiSelectOne|MultiSelectMany|Country|USState|Date)
DataType must be one of Text, Number, MultiSelectOne, MultiSelectMany, Country, USState or Date
SOAP 1.1
The following is a sample SOAP request and response. The placeholders shown need to be replaced with actual values.
POST /api/api.asmx HTTP/1.1
Host: api.createsend.com
Content-Type: text/xml; charset=utf-8
Content-Length: lengthSOAPAction: "http://api.createsend.com/api/List.CreateCustomField"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<List.CreateCustomField xmlns="http://api.createsend.com/api/">
<ApiKey>string</ApiKey>
<ListID>string</ListID>
<FieldName>string</FieldName>
<DataType>Text or Number or MultiSelectOne or MultiSelectMany</DataType>
<Options>string</Options>
</List.CreateCustomField>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<List.CreateCustomFieldResponse xmlns="http://api.createsend.com/api/">
<List.CreateCustomFieldResult>
<Code>int</Code>
<Message>string</Message>
</List.CreateCustomFieldResult>
</List.CreateCustomFieldResponse>
</soap:Body>
</soap:Envelope>
HTTP GET
The following is a sample HTTP GET request and response. The placeholders shown need to be replaced with actual values.
GET /api/api.asmx/List.CreateCustomField?ApiKey=string&ListID=string&FieldName=string&DataType=string&Options=string HTTP/1.1
Host: api.createsend.com
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<Result xmlns="http://api.createsend.com/api/">
<Code>int</Code>
<Message>string</Message>
</Result>
HTTP POST
The following is a sample HTTP POST request and response. The placeholders shown need to be replaced with actual values.
POST /api/api.asmx/List.CreateCustomField HTTP/1.1
Host: api.createsend.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
ApiKey=string&ListID=string&FieldName=string&DataType=string&Options=string
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<Result xmlns="http://api.createsend.com/api/">
<Code>int</Code>
<Message>string</Message>
</Result>