REST API v4: GET statistics (HTML mailing destination)

You can retrieve the statistics for an HTML emailing destination by sending an HTTP GET request to the following URL:

https://api.copernica.com/v4/html/destination/$id/statistics

Where the $id should be replaced with the ID of the destination.

Return value

Fields

The JSON object contains the following fields:

  • ID: ID of the destination
  • abuses: An array with a 'total' field for the abuses that this mailing received.
  • clicks: An array with a 'total' field for the clicks that this mailing received.
  • deliveries: An array with a 'total' field for the deliveries to this destination.
  • errors: An array with a 'total' field for the errors that this mailing received.
  • impressions: An array with a 'total' field for the impressions that this mailing received.
  • unsubscribes: An array with a 'total' field for the unsubscribes that this mailing received.

Example

The JSON output will look something like this:

{  
   "ID":"893915",
   "abuses":{  
      "total":4
   },
   "clicks":{  
      "total":4
   },
   "deliveries":{  
      "total":5
   },
   "errors":{  
      "total":4
   },
   "impressions":{  
      "total":1
   },
   "retries":{  
      "total":4
   },
   "unsubscribes":{  
      "total":0
   }
}

PHP example

This script demonstrates how to use this API method:

// dependencies
require_once('CopernicaRestAPI.php');

// change this into your access token
$api = new CopernicaRestAPI("your-access-token", 4);

// execute the call
print_r($api->get("html/destination/{$destinationID}/statistics/"));

This example requires the REST API class.

More information