You are here

function MCAPI::campaigns in Mailchimp 5

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

Get the list of campaigns and their details matching the specified filters

Related

@example xml-rpc_campaigns.php

@returnf string id Campaign Id (used for all other campaign functions) @returnf string title Title of the campaign @returnf string type The type of campaign this is (regular, plaintext, absplit, rss, etc.) @returnf date create_time Creation time for the campaign @returnf date send_time Send time for the campaign @returnf integer emails_sent Number of emails email was sent to @returnf string status Status of the given campaign (sent,scheduled,etc.) @returnf string from_name From name of the given campaign @returnf string from_email Reply-to email of the given campaign @returnf string subject Subject of the given campaign @returnf string to_email Custom "To:" email string using merge variables @returnf string archive_url Archive link for the given campaign @returnf boolean inline_css Whether or not the campaigns content auto-css-lined

Parameters

string $filter_id optional - only show campaigns from this list id - get lists using lists():

integer $filter_folder optional - only show campaigns from this folder id - get folders using campaignFolders():

string $filter_fromname optional - only show campaigns that have this "From Name":

string $filter_fromemail optional - only show campaigns that have this "Reply-to Email":

string $filter_title optional - only show campaigns that have this title:

string $filter_subject optional - only show campaigns that have this subject:

string $filter_sendtimestart optional - only show campaigns that have been sent since this date/time - format is YYYY-MM-DD HH:mm:ss (24hr):

string $filter_sendtimeend optional - only show campaigns that have been sent before this date/time - format is YYYY-MM-DD HH:mm:ss (24hr):

boolean $filter_exact optional - flag for whether to filter on exact values when filtering, or search within content for filter values:

integer $start optional - control paging of campaigns, start results at this campaign #, defaults to 1st page of data (page 0):

integer $limit optional - control paging of campaigns, number of campaigns to return with each call, defaults to 25 (max=5000):

Return value

array list of campaigns and their associated information (see Returned Fields for description)

File

./MCAPI.class.php, line 311

Class

MCAPI

Code

function campaigns($filter_id = NULL, $filter_folder = NULL, $filter_fromname = NULL, $filter_fromemail = NULL, $filter_title = NULL, $filter_subject = NULL, $filter_sendtimestart = NULL, $filter_sendtimeend = NULL, $filter_exact = true, $start = 0, $limit = 25) {
  $params = array();
  $params["filter_id"] = $filter_id;
  $params["filter_folder"] = $filter_folder;
  $params["filter_fromname"] = $filter_fromname;
  $params["filter_fromemail"] = $filter_fromemail;
  $params["filter_title"] = $filter_title;
  $params["filter_subject"] = $filter_subject;
  $params["filter_sendtimestart"] = $filter_sendtimestart;
  $params["filter_sendtimeend"] = $filter_sendtimeend;
  $params["filter_exact"] = $filter_exact;
  $params["start"] = $start;
  $params["limit"] = $limit;
  return $this
    ->callServer("campaigns", $params);
}