Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
71 lines (50 sloc) 2.19 KB

REST API: GET destination (Publisher)

You can use the REST API to retrieve a summary of a mailing destination with an HTTP GET call to the following URL:

https://api.copernica.com/v2/publisher/destination/$id?access_token=xxxx

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

Returned fields

The method returns a JSON object to represent the destination. The object contains the following fields:

  • ID: The ID of the destination.
  • timestampsent: The timestamp on which the mailing was sent to this recipient.
  • internal: The internal ID of the destination.
  • profile: The ID of the profile of the destination.
  • subprofile: The ID of the subprofile of the destination (if applicable).
  • mailing: The ID of the mailing.

Retrieving (sub)profile fields

An alternative method offers the option to retrieve the (sub)profile fields along with the regular returned fields. In this case the (sub)profile returned field will contain an array with keys 'ID' and 'fields'. You can send an HTTP GET request to the following URL to execute the method:

https://api.copernica.com/v2/publisher/destination/$id/fields?access_token=xxxx

JSON example

The JSON for the destination might look something like this (excluding the fields):

{  
   "ID":"56ed14bf71f7bc4e200e712e646ed32f",
   "timestampsent":"2014-08-26 10:14:15",
   "internal":"802345",
   "profile":"9180926",
   "subprofile":null,
   "mailing":"42913"
}

PHP example

The script below demonstrates how to use this API method. Don't forget to replace the ID in the URL before executing the call.

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

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

// execute the call
print_r($api->get("publisher/destination/{$destinationID}"));

This example requires the REST API class

More information

You can’t perform that action at this time.