You are here

function MCAPI::listBatchSubscribe in Mailchimp 6.2

Same name and namespace in other branches
  1. 5.2 MCAPI.class.php \MCAPI::listBatchSubscribe()
  2. 5 MCAPI.class.php \MCAPI::listBatchSubscribe()
  3. 6 MCAPI.class.php \MCAPI::listBatchSubscribe()
  4. 7 MCAPI.class.php \MCAPI::listBatchSubscribe()

Subscribe a batch of email addresses to a list at once. If you are using a serialized version of the API, we strongly suggest that you only run this method as a POST request, and <em>not</em> a GET request. Maximum batch sizes vary based on the amount of data in each record, though you should cap them at 5k - 10k records, depending on your experience. These calls are also long, so be sure you increase your timeout values.

Related

@example mcapi_listBatchSubscribe.php @example xml-rpc_listBatchSubscribe.php

@returnf integer success_count Number of email addresses that were succesfully added/updated @returnf integer error_count Number of email addresses that failed during addition/updating @returnf array errors Array of error structs. Each error struct will contain "code", "message", and the full struct that failed

Parameters

string $id the list id to connect to. Get by calling lists():

array $batch an array of structs for each address to import with two special keys: "EMAIL" for the email address, and "EMAIL_TYPE" for the email type option (html, text, or mobile) :

boolean $double_optin flag to control whether to send an opt-in confirmation email - defaults to true:

boolean $update_existing flag to control whether to update members that are already subscribed to the list or to return an error, defaults to false (return error):

boolean $replace_interests flag to determine whether we replace the interest groups with the updated groups provided, or we add the provided groups to the member's interest groups (optional, defaults to true):

Return value

struct Array of result counts and any errors that occurred

File

./MCAPI.class.php, line 1548

Class

MCAPI

Code

function listBatchSubscribe($id, $batch, $double_optin = true, $update_existing = false, $replace_interests = true) {
  $params = array();
  $params["id"] = $id;
  $params["batch"] = $batch;
  $params["double_optin"] = $double_optin;
  $params["update_existing"] = $update_existing;
  $params["replace_interests"] = $replace_interests;
  return $this
    ->callServer("listBatchSubscribe", $params);
}