REST API v4: GET logfiles names
Copernica keeps logfiles about several things such as clicks, opens, errors, accepted messages, etc. These logfiles can be downloaded with the API. By sending an HTTP GET request to the following URL you will get a list of all log files for a particular date.
https://api.copernica.com/v4/logfiles&date=$date&type=$type
In the URL you can add the $date
parameter to search for logfiles for a
specific date. You can also add $type
to specify a specific type of
logfile, like cdm-attempts (attempts for Marketing Suite). You can also
use both. Using neither will return the logfile dates
Returned fields
This method returns a JSON array of logfile name. The types of logfiles are provided in the table below.
Prefix | Type of information |
---|---|
cdm-attempts | General info about mails sent with Marketing Suite (MS) |
cdm-abuse | Info about mails sent via MS that triggered a notification |
cdm-click | Info about clicks generated from mails sent with MS |
cdm-delivery | Info about delivered mails sent with MS |
cdm-error | Info about mails sent with MS that triggered an error |
cdm-impression | Info about impressions from mails sent with MS |
cdm-retry | Info about mails sent via MS for which we retry a delivery |
cdm-unsubscribe | Info about mails sent via MS that triggered an unsubscribe |
pom-attempts | General info about mails sent with Publisher |
pom-abuses | Info about mails sent via Publisher that triggered an notification |
pom-clicks | info about clicks generated from mails sent with Publisher |
pom-deliveries | Info about delivered mails sent with Publisher |
pom-errors | Info about failed mails sent with Publisher |
pom-impressions | Info about impressions from mails sent with Publisher |
pom-retries | Info about mails sent via Publisher for which we retry a delivery |
pom-unsubscribes | Info about mails sent via Publisher that triggered an unsubscribe |
feedback-loop-errors | Info about errors in your feedback loops |
To download a log file please see the links under "More information" to find the instructions for the desired logfile format.
PHP Example
The following PHP script demonstrates how to use the API method. Don't forget to substitute the date in the URL (YYYY-MM-DD format).
// dependencies
require_once('CopernicaRestAPI.php');
// change this into your access token
$api = new CopernicaRestAPI("your-access-token", 4);
// the array used to specify the date and/or type
$parameters = array(
'type' => "cdm-attempts",
'date' => "2019-01-01",
);
// do the call, and print result
print_r($api->get("logfiles", $parameters));
The example above requires the CopernicaRestApi class.