REST API v4: GET XML logfiles

Copernica keeps logfiles which you can request with the API. This method can be used to download a logfile as XML using its filename. If you don't know the filename please see "More information" for instructions. To execute the method you can send an HTTP GET request to the following URL:

https://api.copernica.com/v4/logfile/$filename/xml

The $filename should be replaced by the name of the file you want to request.

Available parameters

The following parameters can be added to the URL as query variables:

  • from: unix timestamp indicating the point in time from which the logfile should be read. Only log entries with a timestamp after this value will be returned. Note: this parameter is only available via the endpoint https://rest.copernica.com and does not work with https://api.copernica.com.

Example

In the example below, only log entries from the specified timestamp are returned.

https://rest.copernica.com/v4/logfile/cdm-impression.2026-03-24.log/xml?from=1774389600

Returned value

An XML representation of the requested log file. An example is shown below.

<records>
    <record>
        <id>XXXXXXXXXX1</id>
        <time>2016-11-04 11:01:00</time>
        <mailingid>12345</mailingid>
        <profileid>1111111</profileid>
        <subprofileid>2</subprofileid>
        <databaseid>133</databaseid>
        <collectionid>0</collectionid>
        <senderdomain>copernica.com</senderdomain>
        <templateid>1234</templateid>
        <tags></tags>
        <email>employee1234@copernica.com</email>
    </record>
    <record>
        ...
    </record>
    ...
</records>

PHP Example

The following PHP script demonstrates how to use the API method. Don't forget to substitute the filename in the URL. An example of such a filename is cdm-attempts.2016-11-04.log to retrieve all delivery attemps made on the 4th of November 2016.

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

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

// do the call, and print result
print_r($api->get("logfile/{$filename}/xml"));

The example above requires the CopernicaRestApi class.

More information