REST API v4: GET template body (drag and drop template)
If you want to retrieve the body of a template created with Marketing Suite you can send a GET request to the following URL:
https://api.copernica.com/v4/draganddrop/template/$id/body/$type
where $id
is the ID of the template and $type
is
the format for the message.
Types
The message can be returned in three formats:
- MIME: Internet standard for email
- HTML: HyperText Language Markup/internet markup
- Text: Simple plain text
Depending on the format the output looks different. MIME includes all the headers for example, while text only shows the plain text. Include the desired type in the URL.
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('CopernicaRestAPI.php');
// change this into your access token
$api = new CopernicaRestAPI("your-access-token", 4);
// execute the call
print_r($api->get("draganddrop/template/{$templateID}/body/mime"));
This example requires the REST API class