Overview
You can use this request to create a new subscription list. Subscription lists are used to send email campaigns to groups of contacts. A contact will have a subscription status on a list, denoting whether or not the contact should receive messages when a campaign is sent to that list.
The Method
| API | - | Method |
|---|---|---|
| REST | POST | https://[Your URL]/api/2.0/lists |
| XML-RPC | Call | lists.CreateList |
Your URL is the address of your install.
Your method must be structured as follows:
CreateList(\struct | array $properties) : int
Parameters
| Property | Type | Description | Required |
|---|---|---|---|
| $properties | structarray | An array of the properties of the list you need to create. | yes |
Properties
| Property | Type | Description | Default | Required | Read Only |
|---|---|---|---|---|---|
| list_group_id | integer | List group identifier. | 0 | no | no |
| name | string | Name of the list. | empty | yes | no |
| public_name | string | Public name of the list. | empty | no | no |
| owner_name | string | Name of the list owner. | empty | no | no |
| owner_email | string | Email address for the list owner. | empty | yes | no |
| owner_reply_email | string | The list owner’s reply address. | empty | no | no |
| company_name | string | Name | empty | no | no |
| company_address | string | Address | empty | no | no |
| company_city | string | City | empty | no | no |
| company_state | string | State | empty | no | no |
| company_country | string | Country | empty | no | no |
| company_postal_code | string | Postal Code | empty | no | no |
| company_telephone | string | Telephone Number | empty | no | no |
| company_mobile | string | Mobile Number | empty | no | no |
| company_fax | string | Fax Number | empty | no | no |
| company_email | string | Email Address | empty | no | no |
| company_url | string | URL | empty | no | no |
| notify_owner_on_list_subscribe | string | Notify owner on list subscribe Possible values: yes no | no | no | no |
| notify_owner_on_list_unsubscribe | string | Notify owner on list unsubscribe Possible values: yes no | no | no | no |
| ask_for_unsubscribe_reason | string | Ask for reason on list unsubscribe Possible Values: yes no | no | no | no |
| send_unsubscribe_confirmation | string | Confirmation message sent on unsubscribe Possible values: yes no | no | no | no |
| redirect_url_on_unsubscribe | string | Custom unsubscribe URL | empty | no | no |
Responses
| Type | Description |
|---|---|
| integer | The ID of the created list. |
Code Samples
PHP (using REST API):
$json = '
{
"name":"This is the name of the list",
"owner_email":"[email protected]"
}
';
$url = '(Your URL)/api/2.0/lists';
$method = 'POST';
$cSession = curl_init();
$headers = array();
$auth = base64_encode($username . ':' . $apikey);
$headers[] = 'Authorization: Basic ' . $auth;
curl_setopt($cSession, CURLOPT_URL, $url);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, strtoupper($method));
curl_setopt($cSession, CURLOPT_POSTFIELDS, $json);
$headers[] = 'Content-Type: application/json';
curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($cSession);
curl_close($cSession);