REST API: GET deliveries (Publisher mailing)

Each emailing is tracked, which allows Copernica to provide you with emailing statistics. Deliveries are one of these statistics. You can retrieve the deliveries for an emailing by sending an HTTP GET call to the following URL:

https://api.copernica.com/v3/publisher/emailing/$id/deliveries?access_token=xxxx

Where the $id should be replaced with the ID of the emailing. This method also support the use of the fields parameter for the timestamp field.

Returned fields

The method returns a JSON object with several deliveries under the 'data' property. For each delivery the following information is available:

  • ID: The ID of the delivery.
  • timestamp: The timestamp of delivery.
  • attempt: The attempt of the delivery.
  • smtp-response: The description of the delivery returned by the SMTP server.
  • emailing: The ID of the mailing that was delivered.
  • destination: The ID of the destination.
  • profile: The ID of the profile that was delivered to.
  • subprofile: The ID of the subprofile that was delivered to (if applicable).

JSON example

The JSON for a single delivery looks somewhat like this:

{  
   "ID":"1",
   "timestamp":"2010-01-04 12:17:51",
   "attempt":"0",
   "smtp-response":"test",
   "emailing":"671",
   "destination":"57092",
   "profile":"2384041",
   "subprofile":null
}

PHP example

This script demonstrates how to use this API method:

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

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

// set the period
$parameters = array(
    'fields'    =>  array('timestamp>2019-01-01', 'timestamp<2019-02-01')
);

// execute the call
print_r($api->get("publisher/emailing/{$emailingID}/deliveries/", $parameters));

This example requires the REST API class.

More information