REST API v4: PUT template
A method to update the properties of a template. This is an HTTP PUT method, accessible at the following address:
https://api.copernica.com/v3/draganddrop/template/$id?access_token=xxxx
Replace the $id
by the identifier of the template you want to edit.
Available data
The following variables can be used in the body of the HTTP PUT request:
- name: name of the new template to be created (required)
- description: optional description of the template
- from_address: object with the following properties:
- name: the sender's name
- address: the sender's email address
- source: object with the following properties:
- html: the HTML source code of the template
- text: the plain text version of the template
- language: the language of the template
- timezone: the timezone of the template
- reply to: the reply-to address of the template
- bcc: the BCC address of the template
- archived: optional boolean value to immediately archive the template
- unsubscribe_header: indicates whether an unsubscribe header should be
included. Possible values:
both
(default),email
,link
, orno
.
JSON example
The following JSON demonstrates how to use the API method:
{
"subject": "New subject",
"source": {
"html": "<html><body>New souce code</body></html>",
"text": "This is a text version"
}
}
PHP example
The following example demonstrates how to use the API method:
// dependencies
require_once('copernica-rest-api.php');
// change this into your access token
$api = new CopernicaRestAPI("your-access-token", 4);
// data to be sent to the api
$data = array(
'subject' => 'New subject',
'source' => array(
'html' => '<html><body>New souce code</body></html>',
'text' => 'This is a text version'
)
);
// do the call
$api->put("draganddrop/template/{$templateID}", $data);
The example above requires the CopernicaRestApi class.