REST API v3: GET template (Marketing Suite)

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

https://api.copernica.com/v3/ms/template/$id?access_token=xxxx

Where $id should be replaced with the ID of the emailing template you want summarized.

Returned fields

The method returns a JSON object containing the following information:

  • id: The ID of the template.
  • name: The name of the template.
  • from_address: The from address for the template. Array containing a 'name' and 'email' field.
  • subject: The template subject.
  • type: The template type ('json' or 'html').
  • archived: Whether or not the template is archived.
  • directory: The directory in which the template is located (if any).

JSON example

The JSON will look something like this:

{  
   "id":"2820",
   "name":"Theme: conference",
   "from_address":{  
      "name":"Infinity",
      "email":"info@valtaf.nl"
   },
   "subject":"Infinity conference",
   "type":"json",
   "archived":false,
   "directory":"78"
}

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", 3);

// execute the call
print_r($api->get("ms/template/{$templateID}"));

This example requires the REST API class

More information