Overview
With this request, you can subscribe or unsubscribe contacts in bulk. The parameters must be passed to the server in an array.
The Method
API | Method | Endpoint |
---|---|---|
REST | GET | https://[Your URL]/api/2.0/list_subscriptions/:list_id/bulk |
XML-RPC | Call | list._subscriptions.BulkListSubscription |
Your URL is the address of your install.
Your method must be structured as follows:
BulkListSubscription(integer $list_id, array $subscriptions) : array
Parameters
Property | Type | Description | Required |
---|---|---|---|
$list_id | integer | The ID of the list to add the contacts to. | yes |
$subscriptions | array | An array of the list subscriptions to create. | yes |
Properties
Property | Type | Description | Default | Required | Read Only |
---|---|---|---|---|---|
list_id | integer | List identifier | empty | yes | no |
contact_id | integer | Contact identifier | empty | yes | no |
email_status | string | Mapping email status Possible values: subscribed sunsubscribed sconfirmed sunconfirmed sforwarded | empty | no | no |
mobile_status | string | Mapping mobile status Possible values: subscribed unsubscribed confirmed unconfirmed forwarded | empty | no | no |
Responses
Type | Description |
---|---|
array | An array of the subscription results. Possible results: True if the creation was successful. An error message if the creation failed. |
Code Samples
PHP (using REST API):
$json = ' { "subscriptions":{ "1":{ "list_id":4, "contact_id":1, "email_status":"subscribed" }, "2":{ "list_id":4, "contact_id":2, "email_status":"subscribed" } } } '; $url = '(Your URL)/api/2.0/list_subscriptions/:list_id/bulk'; $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);