campaigns(string apikey, string filter_id, integer filter_folder, string filter_fromname, string filter_fromemail, string filter_title, string filter_subject, string filter_sendtimestart, string filter_sendtimeend, boolean filter_exact, integer start, integer limit)
Get the list of campaigns and their details matching the specified filters
| Section | Campaign Related |
|---|
| Parameters | |
|---|---|
| apikey | a valid API Key for your user account. Get by calling Get by visiting your API dashboard |
| filter_id | optional - only show campaigns from this list id - get lists using lists() |
| filter_folder | optional - only show campaigns from this folder id - get folders using campaignFolders() |
| filter_fromname | optional - only show campaigns that have this "From Name" |
| filter_fromemail | optional - only show campaigns that have this "Reply-to Email" |
| filter_title | optional - only show campaigns that have this title |
| filter_subject | optional - only show campaigns that have this subject |
| filter_sendtimestart | optional - only show campaigns that have been sent since this date/time - format is YYYY-MM-DD HH:mm:ss (24hr) |
| filter_sendtimeend | optional - only show campaigns that have been sent before this date/time - format is YYYY-MM-DD HH:mm:ss (24hr) |
| filter_exact | optional - flag for whether to filter on exact values when filtering, or search within content for filter values |
| start | optional - control paging of campaigns, start results at this campaign #, defaults to 1st page of data (page 0) |
| limit | optional - control paging of campaigns, number of campaigns to return with each call, defaults to 25 (max=5000) |
| Returns | |
|---|---|
| array | list of campaigns and their associated information (see Returned Fields for description) |
| Returned Fields | string | id | Campaign Id (used for all other campaign functions) | string | web_id | The Campaign id used in our web app, allows you to create a link directly to it | string | list_id | The List used for this campaign | string | folder_id | The Folder this campaign is in | string | title | Title of the campaign | string | type | The type of campaign this is (regular,plaintext,absplit,rss,inspection,trans,auto) | date | create_time | Creation time for the campaign | date | send_time | Send time for the campaign | integer | emails_sent | Number of emails email was sent to | string | status | Status of the given campaign (save,paused,schedule,sending,sent) | string | from_name | From name of the given campaign | string | from_email | Reply-to email of the given campaign | string | subject | Subject of the given campaign | string | to_email | Custom "To:" email string using merge variables | string | archive_url | Archive link for the given campaign | boolean | inline_css | Whether or not the campaigns content auto-css-lined |
|---|
[1] mcapi_campaigns.php
<?php /** This Example shows how to retrieve a list of your campaigns via the MCAPI class. **/ require_once 'inc/MCAPI.class.php'; require_once 'inc/config.inc.php'; //contains apikey $retval = $api->campaigns(); if ($api->errorCode){ } else { foreach($retval as $c){ } }
[2] xml-rpc_campaigns.php
<?php /** This Example shows how to pull a list of Campaigns on your account using XML-RPC Note that we are using the PEAR XML-RPC2 client and recommend others do as well. **/ require_once 'XML/RPC2/Client.php'; require_once 'inc/config.inc.php'; try { $result = $client->campaigns($apikey); foreach($result as $c){ } } catch (XML_RPC2_FaultException $e){ }