« Back to Documentation Overview

campaignAbuseReports – v1.3

 campaignAbuseReports(string apikey, string cid, string since, int start, int limit)

Get all email addresses that complained about a given campaign

Section
Campaign Stats
mcapi_campaignAbuseReports.php
Parameters
apikey a valid API Key for your user account. Get by visiting your API dashboard
cid the campaign id to pull abuse reports for (can be gathered using campaigns())
start optional - for large data sets, the page number to start at - defaults to 1st page of data (page 0)
limit optional - for large data sets, the number of results to return - defaults to 500, upper limit set at 1000
since optional - pull only messages since this time - use YYYY-MM-DD HH:II:SS format in GMT
Returns
array reports the abuse reports for this campaign
inttotalthe total reports matched
arraydatathe report data for each, including:
stringdatedate/time the abuse report was received and processed
stringemailthe email address that reported abuse
stringtypean internal type generally specifying the orginating mail provider - may not be useful outside of filling report views

Examples (1)

download example code

[1] mcapi_campaignAbuseReports.php

  1. <?php
  2. /**
  3. This Example shows how to add grab a full set of Campaign Abuse Reports wtih
  4. some basic error checking.
  5. **/
  6. require_once 'inc/MCAPI.class.php';
  7. require_once 'inc/config.inc.php'; //contains apikey
  8.  
  9. // Connect to the MailChimp api with an API Key
  10. $api = new MCAPI($apikey);
  11.  
  12. $reports = $api->campaignAbuseReports($campaignId);
  13.  
  14. if ($api->errorCode){
  15. echo "Unable to run campaignAbuseReports()!\n";
  16. echo "\tCode=".$api->errorCode."\n";
  17. echo "\tMsg=".$api->errorMessage."\n";
  18. } else {
  19. echo "Total reports:".$reports['total']."\n";
  20. echo "Reports returned:".sizeof($reports['data'])."\n";
  21. foreach ($reports['data'] as $rpt){
  22. echo $rpt['date']." - ".$rpt['email']." - ".$rpt['type']."\n";
  23. }
  24. }
  25.  
  26. ?>
  27.