You are here

public function Mailchimp::processBatchOperations in Mailchimp 8

Processes all pending batch operations.

Throws

MailchimpAPIException

See also

http://developer.mailchimp.com/documentation/mailchimp/reference/batches...

File

lib/mailchimp-api-php/src/Mailchimp.php, line 162

Class

Mailchimp
Mailchimp library.

Namespace

Mailchimp

Code

public function processBatchOperations() {
  $parameters = [
    'operations' => $this->batch_operations,
  ];
  try {
    $response = $this
      ->request('POST', '/batches', NULL, $parameters);

    // Reset batch operations.
    $this->batch_operations = [];
    return $response;
  } catch (MailchimpAPIException $e) {
    $message = 'Failed to process batch operations: ' . $e
      ->getMessage();
    throw new MailchimpAPIException($message, $e
      ->getCode(), $e);
  }
}