REST API v4: GET emailing unsubscribes (drag and drop template)
Each emailing is tracked, which allows Copernica to provide you with emailing statistics. Unsubscribes are one of these statistics. You can retrieve all unsubscribes by sending an HTTP GET call to the following URL:
https://api.copernica.com/v4/draganddrop/emailing/{$emailingID}/unsubscribes
Parameters
The following optional parameters are available:
- begintime: The timestamp after which the unsubscribe must have occurred (YYYY-MM-DD HH:MM:SS format).
- endtime: The timestamp before which the unsubscribe must have occurred (YYYY-MM-DD HH:MM:SS format).
- unique: Only retrieve the unique unsubscribes (true / false)
Bold is the default value
Returned fields
The method returns a JSON object with several unsubscribe clicks. For each unsubscribe the following information is available:
- ID: The ID of the unsubscribe.
- mailing: The ID of the mailing.
- timestamp: Timestamp of the unsubscribe.
- destination: The ID of the destinations that unsubscribed.
- source: Source of the unsubscribe.
- success: Is the unsubscribe behavior triggered? (true/false)
- profile: The ID of the profile that triggered the unsubscribe
- subprofile: The ID of the subprofile that triggered the unsubscribe
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("draganddrop/emailing/{$emailingID}/unsubscribes"));
This example requires the REST API class.