REST API v4: GET destination/message abuses (drag and drop template)
Each emailing is tracked, which allows Copernica to provide you with emailing statistics. Abuses are one of these statistics. You can retrieve all abuses for a specific destination by sending an HTTP GET call to the following URL:
https://api.copernica.com/v4/draganddrop/destination/{$destinationID}/abuses
Note: The terms 'destination' and 'message' can be used interchangeably in this article, including the code examples.
Parameters
The parameters for this method can be set to retrieve the statistics from a certain period. The following optional parameters are available:
- begintime: The timestamp after which the abuses must have occurred (YYYY-MM-DD HH:MM:SS format).
- endtime: The timestamp before which the abuses must have occurred (YYYY-MM-DD HH:MM:SS format).
Returned fields
The method returns a JSON object with several abuses under the 'data' property. For each abuse the following information is available:
- ID: The ID of the abuse.
- mailing: The ID of the mailing.
- timestamp: Timestamp of the abuse.
- report: The abuse report.
- destination: The ID of the destination that reported the abuse.
- profile: The ID of the profile that reported the abuse.
- subprofile: The ID of the subprofile that reported the abuse.
JSON example
A single abuse might look something like this:
{
"ID":"12",
"mailing":"233482",
"timestamp":"2019-03-05 14:44:52",
"report":{
},
"destination":"1264524",
"profile":null,
"subprofile":null
}
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/destination/{$destinationID}/abuses"));
This example requires the REST API class.